[PATCH V2] Makefile: Sort u-boot-initial-env output
Christoph Niedermaier
cniedermaier at dh-electronics.com
Fri Feb 25 23:08:41 CET 2022
This will sort the default environment file generated by
"make u-boot-initial-env", but won't sort the default
environment in the compiled u-boot binary. The file
u-boot-initial-env is considered to use for the userpace
environment access tools [1] in case of that the
environments is written the first time into its location.
This is done on the one hand for a better overview and
comparison of the generated environment file. On the other
hand it is to synchronize the output with the script
get_default_env.sh, which generated a sorted default
environment file. The sorting preserves the order of equal
variable names by sorting only the variable name, and
disable the last-resort comparison. After sorting,
unnoticed blank lines at the end move to the top. Avoid
that by removing it before sorting.
[1] https://github.com/sbabic/libubootenv
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 66d9e78cc7..a6a94dc681 100644
--- a/Makefile
+++ b/Makefile
@@ -2441,7 +2441,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)
--
2.11.0
More information about the U-Boot
mailing list