All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3] Makefile: Sort u-boot-initial-env output
@ 2022-03-01  8:38 Christoph Niedermaier
  2022-03-12  2:25 ` Simon Glass
  2022-04-08 12:30 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Niedermaier @ 2022-03-01  8:38 UTC (permalink / raw)
  To: u-boot
  Cc: Christoph Niedermaier, Stefano Babic, Simon Glass, Marek Behún

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@dh-electronics.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
Tested-by: Stefano Babic <sbabic@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Marek Behún <marek.behun@nic.cz>
To: u-boot@lists.denx.de
---
V2: - More detailed description of the patch in the commit message
V3: - Add forgotten tags
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index e6fc80aa6f..603747c3cc 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V3] Makefile: Sort u-boot-initial-env output
  2022-03-01  8:38 [PATCH V3] Makefile: Sort u-boot-initial-env output Christoph Niedermaier
@ 2022-03-12  2:25 ` Simon Glass
  2022-04-08 12:30 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2022-03-12  2:25 UTC (permalink / raw)
  To: Christoph Niedermaier
  Cc: U-Boot Mailing List, Stefano Babic, Marek Behún

On Tue, 1 Mar 2022 at 01:42, Christoph Niedermaier
<cniedermaier@dh-electronics.com> wrote:
>
> 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@dh-electronics.com>
> Reviewed-by: Stefano Babic <sbabic@denx.de>
> Tested-by: Stefano Babic <sbabic@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Marek Behún <marek.behun@nic.cz>
> To: u-boot@lists.denx.de
> ---
> V2: - More detailed description of the patch in the commit message
> V3: - Add forgotten tags
> ---
>  Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V3] Makefile: Sort u-boot-initial-env output
  2022-03-01  8:38 [PATCH V3] Makefile: Sort u-boot-initial-env output Christoph Niedermaier
  2022-03-12  2:25 ` Simon Glass
@ 2022-04-08 12:30 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2022-04-08 12:30 UTC (permalink / raw)
  To: Christoph Niedermaier
  Cc: u-boot, Stefano Babic, Simon Glass, Marek Behún

[-- Attachment #1: Type: text/plain, Size: 1381 bytes --]

On Tue, Mar 01, 2022 at 09:38:51AM +0100, Christoph Niedermaier wrote:

> 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@dh-electronics.com>
> Reviewed-by: Stefano Babic <sbabic@denx.de>
> Tested-by: Stefano Babic <sbabic@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Marek Behún <marek.behun@nic.cz>
> To: u-boot@lists.denx.de
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-08 12:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01  8:38 [PATCH V3] Makefile: Sort u-boot-initial-env output Christoph Niedermaier
2022-03-12  2:25 ` Simon Glass
2022-04-08 12:30 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.