[U-Boot] [PATCH v3 0/5] env: Add support for environment files

Otavio Salvador otavio at ossystems.com.br
Sat Oct 26 18:18:18 CEST 2013


Hello Simon,

On Sat, Oct 26, 2013 at 2:59 AM, Simon Glass <sjg at chromium.org> wrote:
> (Note that Wolfgang is looking at a way of adjusting the environment
> within a U-Boot binary - this series could fit with that but aims to
> improve the creation of the initial default environment).

I really appreciate this patchset; I will merge it in my tree and try
to convert some boards to see how it goes. I think it'll allow for
much better environment reuse :-)

> At present U-Boot environment variables, and thus scripts, are defined
> by CONFIG_EXTRA_ENV_SETTINGS. It is painful to add large amounts of text
> to this file and dealing with quoting and newlines is harder than it
> should be. It would be better if we could just type the script into a
> text file and have it included by U-Boot.
>
> This series adds a feature that brings in a .env file associated with the
> board config, if present. To use it, create a file in a board/<vendor>/env
> directory called <board>.env (or common.env if you want the same
> environment for all boards for that vendor).
>
> The environment variables should be of the form "var=value". Values can
> extend to multiple lines. See the README under 'Environment Variables:'
> for more information and an example.
>
> After discussion on the mailing list the .emv file was moved from
> include/configs to board/. See here:
>
>    http://patchwork.ozlabs.org/patch/237120/
>
> There was also talk of using the C preprocessor for these boards. I tried
> this out and found it to be extremely useful. In fact without it, the
> scripts probably cannot move from the config header file, since many scripts
> are put together based on information from CONFIG variables.

Agreed; this is critical.

> Another discussion was compatibility with the environment commands
> 'env export -t' and 'env import -t'. This series permits these to be used
> and the environment is exported and imported as expected. I have dropped
> the ugly \0 approach in favour of a more flexible awk script for parsing
> the environment file. The environment commands use \ at the end of a line
> for continuation which works nicely with this feature. I have added a patch
> to 'run' so that it runs the entire script, not just the first line. A nice
> benefit is that there is no longer any need to put ';' at the end of every
> line - in other words U-Boot scripts become proper scripts with multiple
> lines instead of messy and fragile continuations.
>
> As an example, I have converted most of the tegra environment over to this
> new approach on an RFC basis. If the rest of this series is accepted then
> I will need to adjust this patch based on the mainline code.
...

In my point of view, patch 3 and 4 could be squashed. So it would
allow for a 'complete' feature add in the commit 3.

Regards,

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


More information about the U-Boot mailing list