Re: [PATCH v5 3/5] env: Allow U-Boot scripts to be placed in a .env file

Rasmus Villemoes
2021-10-04T07:28:57Z

On 02/10/2021 02.38, Simon Glass wrote:
> 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.

Indeed, the pain of CONFIG_EXTRA_ENV_SETTINGS was part of the motivation
for introducing CONFIG_USE_DEFAULT_ENV_FILE.

> Add 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).
>
> 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.
>
> Comments are not permitted in the environment with this commit.

Perhaps some remarks on how this compares/relates to
CONFIG_USE_DEFAULT_ENV_FILE and CONFIG_ENV_IMPORT_FDT would be in order?
In particular, the latter seems like it could already do the "amend the
environent per vendor/board" with appropriate settings in the
-u-boot.dtsi files?

I don't think either of those currently support using CONFIG_ variables
in the definitions, but perhaps that could be fixed.

I don't have anything against these patches as such, I'd just like to
understand precisely what they bring that cannot already be done with
existing mechanisms.

Rasmus