]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: kwboot: Patch nandpagesize to zero also for v1 image
authorPali Rohár <pali@kernel.org>
Fri, 22 Oct 2021 10:37:47 +0000 (12:37 +0200)
committerStefan Roese <sr@denx.de>
Thu, 28 Oct 2021 08:33:32 +0000 (10:33 +0200)
kwbimage v1 has also nandpagesize field. So set it to zero for both image
versions when image is not signed.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwboot.c

index eb4f5ab87917d1e35ff7526f22162d79eafb0385..7e1be296230248622ae03da0f935f16931c24471 100644 (file)
@@ -1428,13 +1428,6 @@ kwboot_img_patch(void *img, size_t *size, int baudrate)
        if (csum != hdr->checksum)
                goto err;
 
-       if (image_ver == 0) {
-               struct main_hdr_v0 *hdr_v0 = img;
-
-               hdr_v0->nandeccmode = IBR_HDR_ECC_DISABLED;
-               hdr_v0->nandpagesize = 0;
-       }
-
        srcaddr = le32_to_cpu(hdr->srcaddr);
 
        switch (hdr->blockid) {
@@ -1480,6 +1473,12 @@ kwboot_img_patch(void *img, size_t *size, int baudrate)
                hdr->blockid = IBR_HDR_UART_ID;
        }
 
+       if (!is_secure) {
+               if (image_ver == 0)
+                       ((struct main_hdr_v0 *)img)->nandeccmode = IBR_HDR_ECC_DISABLED;
+               hdr->nandpagesize = 0;
+       }
+
        if (baudrate) {
                uint32_t codesz = sizeof(kwboot_baud_code);
                void *code;