mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
tools: kwbimage: Fix generating of kwbimage v0 header checksum
Checksum for v0 image must be generated after filling all fields in the main header. Otherwise it would be invalid. Exactly same problem for v1 images was already fixed in the past in commit9203c73895
("tools: kwbimage: Fix checksum calculation for v1 images"). Fixes:5c61710c98
("tools: kwbimage: Properly set srcaddr in kwbimage v0") Signed-off-by: Pali Rohár <pali@kernel.org>
This commit is contained in:
parent
226abde867
commit
ee3da92d85
1 changed files with 3 additions and 2 deletions
|
@ -1009,8 +1009,6 @@ static void *image_create_v0(size_t *imagesz, struct image_tool_params *params,
|
|||
e = image_find_option(IMAGE_CFG_NAND_BADBLK_LOCATION);
|
||||
if (e)
|
||||
main_hdr->nandbadblklocation = e->nandbadblklocation;
|
||||
main_hdr->checksum = image_checksum8(image,
|
||||
sizeof(struct main_hdr_v0));
|
||||
|
||||
/*
|
||||
* For SATA srcaddr is specified in number of sectors.
|
||||
|
@ -1049,6 +1047,9 @@ static void *image_create_v0(size_t *imagesz, struct image_tool_params *params,
|
|||
sizeof(struct ext_hdr_v0));
|
||||
}
|
||||
|
||||
main_hdr->checksum = image_checksum8(image,
|
||||
sizeof(struct main_hdr_v0));
|
||||
|
||||
*imagesz = headersz;
|
||||
return image;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue