[PATCH u-boot-mvebu 2/5] tools: kwboot: Fix invalid UART kwbimage v1 headersz
Stefan Roese
sr at denx.de
Fri Mar 24 09:22:58 CET 2023
On 3/23/23 20:57, Pali Rohár wrote:
> Ensure that UART aligned header size is always stored into kwbimage v1
> header. It is needed for proper UART booting. Calculation of headersz field
> was broken in commit d656f5a0ee22 ("tools: kwboot: Calculate real used
> space in kwbimage header when calling kwboot_img_grow_hdr()") which
> introduced optimization of kwboot_img_grow_hdr() function.
>
> Fixes: d656f5a0ee22 ("tools: kwboot: Calculate real used space in kwbimage header when calling kwboot_img_grow_hdr()")
> Signed-off-by: Pali Rohár <pali at kernel.org>
Reviewed-by: Stefan Roese <sr at denx.de>
Thanks,
Stefan
> ---
> tools/kwboot.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/tools/kwboot.c b/tools/kwboot.c
> index c131711444ec..dd894e80db1c 100644
> --- a/tools/kwboot.c
> +++ b/tools/kwboot.c
> @@ -2171,6 +2171,17 @@ kwboot_img_patch(void *img, size_t *size, int baudrate)
>
> kwboot_printv("Aligning image header to Xmodem block size\n");
> kwboot_img_grow_hdr(img, size, grow);
> + hdrsz += grow;
> +
> + /*
> + * kwbimage v1 contains header size field and for UART type it
> + * must be set to the aligned xmodem header size because BootROM
> + * rounds header size down to xmodem block size.
> + */
> + if (kwbimage_version(img) == 1) {
> + hdr->headersz_msb = hdrsz >> 16;
> + hdr->headersz_lsb = cpu_to_le16(hdrsz & 0xffff);
> + }
> }
>
> hdr->checksum = kwboot_hdr_csum8(hdr) - csum;
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: sr at denx.de
More information about the U-Boot
mailing list