[PATCH 2/3] tools: kwboot: Patch nandpagesize to zero also for v1 image

Stefan Roese sr at denx.de
Tue Oct 26 06:47:14 CEST 2021


On 22.10.21 12:37, Pali Rohár wrote:
> kwbimage v1 has also nandpagesize field. So set it to zero for both image
> versions when image is not signed.
> 
> Signed-off-by: Pali Rohár <pali at kernel.org>

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

Thanks,
Stefan

> ---
>   tools/kwboot.c | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/kwboot.c b/tools/kwboot.c
> index eb4f5ab87917..7e1be2962302 100644
> --- a/tools/kwboot.c
> +++ b/tools/kwboot.c
> @@ -1428,13 +1428,6 @@ kwboot_img_patch(void *img, size_t *size, int baudrate)
>   	if (csum != hdr->checksum)
>   		goto err;
>   
> -	if (image_ver == 0) {
> -		struct main_hdr_v0 *hdr_v0 = img;
> -
> -		hdr_v0->nandeccmode = IBR_HDR_ECC_DISABLED;
> -		hdr_v0->nandpagesize = 0;
> -	}
> -
>   	srcaddr = le32_to_cpu(hdr->srcaddr);
>   
>   	switch (hdr->blockid) {
> @@ -1480,6 +1473,12 @@ kwboot_img_patch(void *img, size_t *size, int baudrate)
>   		hdr->blockid = IBR_HDR_UART_ID;
>   	}
>   
> +	if (!is_secure) {
> +		if (image_ver == 0)
> +			((struct main_hdr_v0 *)img)->nandeccmode = IBR_HDR_ECC_DISABLED;
> +		hdr->nandpagesize = 0;
> +	}
> +
>   	if (baudrate) {
>   		uint32_t codesz = sizeof(kwboot_baud_code);
>   		void *code;
> 


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