* [PATCH] Makefile: Sort u-boot-initial-env output
@ 2022-02-23 9:33 Christoph Niedermaier
2022-02-23 13:12 ` Stefano Babic
2022-02-23 22:59 ` Simon Glass
0 siblings, 2 replies; 6+ messages in thread
From: Christoph Niedermaier @ 2022-02-23 9:33 UTC (permalink / raw)
To: u-boot; +Cc: Christoph Niedermaier, Stefano Babic, Simon Glass,
Marek Behún
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@dh-electronics.com>
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
---
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)
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Makefile: Sort u-boot-initial-env output
2022-02-23 9:33 [PATCH] Makefile: Sort u-boot-initial-env output Christoph Niedermaier
@ 2022-02-23 13:12 ` Stefano Babic
2022-02-23 22:59 ` Simon Glass
1 sibling, 0 replies; 6+ messages in thread
From: Stefano Babic @ 2022-02-23 13:12 UTC (permalink / raw)
To: Christoph Niedermaier, u-boot
Cc: Stefano Babic, Simon Glass, Marek Behún
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@dh-electronics.com>
> 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
> ---
> 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@denx.de>
Tested-by: Stefano Babic <sbabic@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@denx.de
=====================================================================
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Makefile: Sort u-boot-initial-env output
2022-02-23 9:33 [PATCH] Makefile: Sort u-boot-initial-env output Christoph Niedermaier
2022-02-23 13:12 ` Stefano Babic
@ 2022-02-23 22:59 ` Simon Glass
2022-02-24 9:59 ` Christoph Niedermaier
1 sibling, 1 reply; 6+ messages in thread
From: Simon Glass @ 2022-02-23 22:59 UTC (permalink / raw)
To: Christoph Niedermaier
Cc: U-Boot Mailing List, Stefano Babic, Marek Behún
Hi Christoph,
On Wed, 23 Feb 2022 at 02:33, Christoph Niedermaier
<cniedermaier@dh-electronics.com> 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@dh-electronics.com>
> 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
> ---
> Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Does this sort the text environment too?
>
> 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)
> --
> 2.11.0
>
Regards,
Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] Makefile: Sort u-boot-initial-env output
2022-02-23 22:59 ` Simon Glass
@ 2022-02-24 9:59 ` Christoph Niedermaier
2022-02-24 23:54 ` Simon Glass
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Niedermaier @ 2022-02-24 9:59 UTC (permalink / raw)
To: Simon Glass; +Cc: U-Boot Mailing List, Stefano Babic, Marek Behún
From: Simon Glass [mailto:sjg@chromium.org]
Sent: Wednesday, February 23, 2022 11:59 PM
>
> Hi Christoph,
>
Hi Simon,
> On Wed, 23 Feb 2022 at 02:33, Christoph Niedermaier <cniedermaier@dh-electronics.com> 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@dh-electronics.com>
>> 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
>> ---
>> Makefile | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> Does this sort the text environment too?
It sorts only the generated file "u-boot-initial-env" which comes
from the default environment.
What exactly do you mean by "text environment"?
>
>>
>> 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)
Regards
Christoph
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Makefile: Sort u-boot-initial-env output
2022-02-24 9:59 ` Christoph Niedermaier
@ 2022-02-24 23:54 ` Simon Glass
2022-02-25 22:27 ` Christoph Niedermaier
0 siblings, 1 reply; 6+ messages in thread
From: Simon Glass @ 2022-02-24 23:54 UTC (permalink / raw)
To: Christoph Niedermaier
Cc: U-Boot Mailing List, Stefano Babic, Marek Behún
Hi Christoph,
On Thu, 24 Feb 2022 at 02:59, Christoph Niedermaier
<cniedermaier@dh-electronics.com> wrote:
>
> From: Simon Glass [mailto:sjg@chromium.org]
> Sent: Wednesday, February 23, 2022 11:59 PM
> >
> > Hi Christoph,
> >
>
> Hi Simon,
>
> > On Wed, 23 Feb 2022 at 02:33, Christoph Niedermaier <cniedermaier@dh-electronics.com> 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@dh-electronics.com>
> >> 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
> >> ---
> >> Makefile | 3 ++-
> >> 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > Does this sort the text environment too?
>
> It sorts only the generated file "u-boot-initial-env" which comes
> from the default environment.
> What exactly do you mean by "text environment"?
https://u-boot.readthedocs.io/en/latest/usage/environment.html#text-based-environment
Can you please expand your commit message a bit to explain exactly
what this affects? Also how about an update to the above page that
describes how the env is sorted.
>
> >
> >>
> >> 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)
>
Regards,
Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] Makefile: Sort u-boot-initial-env output
2022-02-24 23:54 ` Simon Glass
@ 2022-02-25 22:27 ` Christoph Niedermaier
0 siblings, 0 replies; 6+ messages in thread
From: Christoph Niedermaier @ 2022-02-25 22:27 UTC (permalink / raw)
To: Simon Glass; +Cc: U-Boot Mailing List, Stefano Babic, Marek Behún
From: Simon Glass [mailto:sjg@chromium.org]
Sent: Friday, February 25, 2022 12:54 AM
>
> Hi Christoph,
>
Hi Simon,
> On Thu, 24 Feb 2022 at 02:59, Christoph Niedermaier
> <cniedermaier@dh-electronics.com> wrote:
>>
>> From: Simon Glass [mailto:sjg@chromium.org]
>> Sent: Wednesday, February 23, 2022 11:59 PM
>>>
>>> Hi Christoph,
>>>
>>
>> Hi Simon,
>>
>>> On Wed, 23 Feb 2022 at 02:33, Christoph Niedermaier <cniedermaier@dh-electronics.com> 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@dh-electronics.com>
>>>> 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
>>>> ---
>>>> Makefile | 3 ++-
>>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> Does this sort the text environment too?
>>
>> It sorts only the generated file "u-boot-initial-env" which comes
>> from the default environment.
>> What exactly do you mean by "text environment"?
>
> https://u-boot.readthedocs.io/en/latest/usage/environment.html#text-based-environment
>
> Can you please expand your commit message a bit to explain exactly
> what this affects? Also how about an update to the above page that
> describes how the env is sorted.
I will make a V2 of the patch with a better commit message.
The sorting only affects the u-boot-initial-env file for the userspace
tools [1]. The environments of the bootloader are sorted if printed by
printenv. I think mentioning the u-boot-initial-env file in the page
above will lead to more confusion. It think it belongs more to the
userspace tools [1].
[1] https://github.com/sbabic/libubootenv
>>>>
>>>> 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)
>>
Regards
Christoph
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-25 22:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-23 9:33 [PATCH] Makefile: Sort u-boot-initial-env output Christoph Niedermaier
2022-02-23 13:12 ` Stefano Babic
2022-02-23 22:59 ` Simon Glass
2022-02-24 9:59 ` Christoph Niedermaier
2022-02-24 23:54 ` Simon Glass
2022-02-25 22:27 ` Christoph Niedermaier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox