Merge https://source.denx.de/u-boot/custodians/u-boot-marvell
authorTom Rini <trini@konsulko.com>
Wed, 5 Jan 2022 18:08:45 +0000 (13:08 -0500)
committerTom Rini <trini@konsulko.com>
Wed, 5 Jan 2022 18:08:45 +0000 (13:08 -0500)
- kwbimage: Fix checksum calculation for v1 images (Pierre)

tools/kwbimage.c

index da8bfe0..224d815 100644 (file)
@@ -1400,9 +1400,6 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
                                               headersz, image, secure_hdr))
                return NULL;
 
-       /* Calculate and set the header checksum */
-       main_hdr->checksum = image_checksum8(main_hdr, headersz);
-
        *imagesz = headersz;
 
        /* Fill the real header size without padding into the main header */
@@ -1412,6 +1409,9 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
        main_hdr->headersz_lsb = cpu_to_le16(headersz & 0xFFFF);
        main_hdr->headersz_msb = (headersz & 0xFFFF0000) >> 16;
 
+       /* Calculate and set the header checksum */
+       main_hdr->checksum = image_checksum8(main_hdr, headersz);
+
        return image;
 }