
On Mon, 18 Oct 2021 12:13:18 -0600 Simon Glass sjg@chromium.org 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.
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> directory, typically called <board>.env and controlled by the CONFIG_ENV_SOURCE_FILE option.
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. Note that environment variables may not end in + but can start with other strange characters, including underscore, comma and slash.
In many cases environment variables need access to the U-Boot CONFIG variables to select different options. Enable this so that the environment scripts can be as useful as the ones currently in the board config files. This uses the C preprocessor, means that comments can be included in the environment using /* ... */
Also support += to allow variables to be appended to. This is needed when using the preprocessor.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Marek Behún marek.behun@nic.cz Tested-by: Marek Behún marek.behun@nic.cz
Tested on Turris Omnia, but we use distroboot, so will convert only after distroboot is supported.