[PATCH u-boot-marvell 06/13] tools: kwboot: Recalculate 4-byte data checksum after injecting baudrate code

Stefan Roese sr at denx.de
Tue Oct 26 07:44:21 CEST 2021


On 25.10.21 15:12, Marek Behún wrote:
> From: Pali Rohár <pali at kernel.org>
> 
> 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 <pali at kernel.org>
> [ refactored ]
> Signed-off-by: Marek Behún <marek.behun at nic.cz>

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan

> ---
>   tools/kwboot.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/tools/kwboot.c b/tools/kwboot.c
> index bf26a667b7..1131c2eb1c 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);
>   	}
> 


Viele Grüße,
Stefan

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


More information about the U-Boot mailing list