On 3/23/23 20:57, Pali Rohár wrote:
Commit 7665ed2fa04e ("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: 7665ed2fa04e ("tools: kwboot: Fix parsing UART image without data 
checksum")
Signed-off-by: Pali Rohár <p...@kernel.org>

Reviewed-by: Stefan Roese <s...@denx.de>

Thanks,
Stefan

---
  tools/kwboot.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/tools/kwboot.c b/tools/kwboot.c
index dd894e80db1c..23a893a9b9f8 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -2082,6 +2082,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) &&

Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de

Reply via email to