[PATCH] Makefile: Sort u-boot-initial-env output

Stefano Babic sbabic at denx.de
Wed Feb 23 14:12:53 CET 2022


On 23.02.22 10:33, Christoph Niedermaier wrote:
> For a better overview and better comparison sort the initial
> environment as the get_default_env.sh script does. We need
> to preserve the order of equal variable names. So only sort
> by the variable name, and disable the last-resort comparison.
> Also remove blank lines before sorting.
> 
> Signed-off-by: Christoph Niedermaier <cniedermaier at dh-electronics.com>
> Cc: Stefano Babic <sbabic at denx.de>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Marek Behún <marek.behun at nic.cz>
> To: u-boot at lists.denx.de
> ---
>   Makefile | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 4b152249ca..67ed4edc1a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2439,7 +2439,8 @@ endif
>   
>   quiet_cmd_genenv = GENENV  $@
>   cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \
> -	sed --in-place -e 's/\x00/\x0A/g' $@
> +	sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/d' $@; \
> +	sort --field-separator== -k1,1 --stable $@ -o $@
>   
>   u-boot-initial-env: u-boot.bin
>   	$(call if_changed,genenv)

Reviewed-by: Stefano Babic <sbabic at denx.de>
Tested-by: Stefano Babic <sbabic at denx.de>

Best regards,
Stefano Babic

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


More information about the U-Boot mailing list