diff options
| author | Pali Rohár <[email protected]> | 2021-10-25 15:12:57 +0200 |
|---|---|---|
| committer | Stefan Roese <[email protected]> | 2021-11-03 06:45:27 +0100 |
| commit | 82c5a0ac713500f4da9d8562cd4764c733b65e56 (patch) | |
| tree | 13f4b5a5b73cc0f6dde5b8b513141f7e79e0aa30 | |
| parent | 063cb352814b5363aebb4c733a41b951787b1f5f (diff) | |
tools: kwboot: Recalculate 4-byte data checksum after injecting baudrate code
If data part of image is modified, update 4-byte data checksum.
It looks like A385 BootROM does not verify this checksum for image
loaded via UART, but we do not know if other BootROMs are also ignoring
it. It is always better to provide correct checksum.
Signed-off-by: Pali Rohár <[email protected]>
[ refactored ]
Signed-off-by: Marek Behún <[email protected]>
Reviewed-by: Stefan Roese <[email protected]>
| -rw-r--r-- | tools/kwboot.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/kwboot.c b/tools/kwboot.c index bf26a667b73..1131c2eb1c4 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -1544,6 +1544,9 @@ kwboot_img_patch(void *img, size_t *size, int baudrate) kwboot_printv("Injecting code for changing baudrate back\n"); _inject_baudrate_change_code(img, size, 1, baudrate, 115200); + /* Update the 32-bit data checksum */ + *kwboot_img_csum32_ptr(img) = kwboot_img_csum32(img); + /* recompute header size */ hdrsz = kwbheader_size(hdr); } |
