[PATCH v2] Makefile: fix generating environment file

Oleksandr Suvorov oleksandr.suvorov at toradex.com
Tue Apr 20 23:10:21 CEST 2021


Hi Rasmus,

Thanks for your feedback!
Yes, I noted that there were no possible situations with the trailing
code != 0x00, but simply removing the additional trailing 0x00
gives us an empty array default_environment[] for the empty defaultenv file.
I need to test whether this case is handled in u-boot properly and
then prepare the next patch version :P

On Tue, Apr 20, 2021 at 10:33 PM Rasmus Villemoes
<rasmus.villemoes at prevas.dk> wrote:
>
> On 20/04/2021 16.43, Oleksandr Suvorov wrote:
> > If the CONFIG_USE_DEFAULT_ENV_FILE=y and CONFIG_DEFAULT_ENV_FILE
> > points to the empty environment file, the auto-generated file has
> > the wrong syntax so it leads to the compilation failure:
> >
>
> Glad someone is using CONFIG_USE_DEFAULT_ENV_FILE :) And thanks for
> reporting this.
>
> >
> > Fix this issue conditionally adding the delimiter ", ".
>
> Hm, yeah, that should work. But I wonder if it would make more sense to
> ensure tr always gets a final newline (which then gets translated to a
> nul byte, which in turn gives the trailing 0x00). Something like (untested)
>
> define filechk_defaultenv.h
>         ( { grep -v '^#' | grep -v '^$$' ; echo '' ; } | \
>          tr '\n' '\0' | \
>          sed -e 's/\\\x0\s*//g' | \
>          xxd -i ; )
> endef
>
> Rasmus



--
Best regards
Oleksandr Suvorov

Toradex AG
Ebenaustrasse 10 | 6048 Horw | Switzerland | T: +41 41 500 48 00


More information about the U-Boot mailing list