[PATCH u-boot-mvebu v2 37/41] tools: kwbimage: Remove v1 kwbimage SPL padding to CONFIG_SYS_U_BOOT_OFFS bytes

Stefan Roese sr at denx.de
Thu Jul 22 10:52:50 CEST 2021


On 19.07.21 14:21, Marek Behún wrote:
> From: Pali Rohár <pali at kernel.org>
> 
> This padding depends on board config file and therefore it makes the
> mkimage binary tool board specific, which is not correct. One cannot use
> mkimage tool built as a result for board A to generate images for board
> B, even if both A and B are on the same platform.
> 
> This CONFIG_SYS_U_BOOT_OFFS padding was needed when kwbimage v1 contained
> SPL code which loaded main U-Boot binary based on CONFIG_SYS_U_BOOT_OFFS,
> instead of reading correct offset from kwbimage header.
> 
> Now that SPL code parses kwbimage header and deterinate correct offset,
> there is no need for this CONFIG_SYS_U_BOOT_OFFS padding anymore.
> 
> By removing it we also reduce the size of SPL code and therefore also
> decrease the final size of v1 kwbimage. This means there is more space
> for main U-Boot binary.
> 
> Signed-off-by: Pali Rohár <pali at kernel.org>
> Reviewed-by: Marek Behún <marek.behun at nic.cz>
> Reviewed-by: Chris Packham <judge.packham at gmail.com>

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

Thanks,
Stefan

> ---
>   tools/Makefile   |  4 ----
>   tools/kwbimage.c | 13 -------------
>   2 files changed, 17 deletions(-)
> 
> diff --git a/tools/Makefile b/tools/Makefile
> index 7c27069c86..11a5a15bc2 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -155,10 +155,6 @@ ifdef CONFIG_FIT_CIPHER
>   HOST_EXTRACFLAGS	+= -DCONFIG_FIT_CIPHER
>   endif
>   
> -ifneq ($(CONFIG_SYS_U_BOOT_OFFS),)
> -HOSTCFLAGS_kwbimage.o += -DCONFIG_SYS_U_BOOT_OFFS=$(CONFIG_SYS_U_BOOT_OFFS)
> -endif
> -
>   # MXSImage needs LibSSL
>   ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_FIT_SIGNATURE)$(CONFIG_FIT_CIPHER),)
>   HOSTCFLAGS_kwbimage.o += \
> diff --git a/tools/kwbimage.c b/tools/kwbimage.c
> index 9ecda861e4..ccb0b92266 100644
> --- a/tools/kwbimage.c
> +++ b/tools/kwbimage.c
> @@ -979,19 +979,6 @@ static size_t image_headersz_v1(int *hasext)
>   			*hasext = 1;
>   	}
>   
> -#if defined(CONFIG_SYS_U_BOOT_OFFS)
> -	if (headersz > CONFIG_SYS_U_BOOT_OFFS) {
> -		fprintf(stderr,
> -			"Error: Image header (incl. SPL image) too big!\n");
> -		fprintf(stderr, "header=0x%x CONFIG_SYS_U_BOOT_OFFS=0x%x!\n",
> -			(int)headersz, CONFIG_SYS_U_BOOT_OFFS);
> -		fprintf(stderr, "Increase CONFIG_SYS_U_BOOT_OFFS!\n");
> -		return 0;
> -	}
> -
> -	headersz = CONFIG_SYS_U_BOOT_OFFS;
> -#endif
> -
>   	/*
>   	 * The payload should be aligned on some reasonable
>   	 * boundary
> 


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