From: Pali Rohár Date: Thu, 23 Mar 2023 19:57:53 +0000 (+0100) Subject: tools: kwboot: Fix inserting UART data checksum without -B option X-Git-Tag: baikal/mips/sdk6.2~4^2~3^2~175^2~24^2~3 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=db949ef41bfc82a616ce0ae566a3b13c7af259a6;p=uboot.git tools: kwboot: Fix inserting UART data checksum without -B option Commit 83a1a335bc84 ("tools: kwboot: Fix parsing UART image without data checksum") added fixup code to insert place for data checksum if UART image does not have it. Together with option -B (change baudrate), kwboot calculates this checksum. Without option -B, it inserts only place for checksum but does not calculate it. This commit fix above logic and calculate data checksum also when kwboot is used without -B option. Fixes: 83a1a335bc84 ("tools: kwboot: Fix parsing UART image without data checksum") Signed-off-by: Pali Rohár Reviewed-by: Stefan Roese --- diff --git a/tools/kwboot.c b/tools/kwboot.c index ef108c8395..61a9c3065a 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -2079,6 +2079,8 @@ kwboot_img_patch(void *img, size_t *size, int baudrate) goto err; } kwboot_img_grow_data_right(img, size, sizeof(uint32_t)); + /* Update the 32-bit data checksum */ + *kwboot_img_csum32_ptr(img) = kwboot_img_csum32(img); } if (!kwboot_img_has_ddr_init(img) &&