summaryrefslogtreecommitdiff
path: root/scripts/env2string.awk
Commit message (Collapse)AuthorAgeFilesLines
* env: Allow text-env tests to run with awkSimon Glass2022-04-071-1/+4
| | | | | | | | | | | | | At present the tests assume that gawk is being used. Adjust the tests so that the names are inserted in alphabetical order, so that awk is happy. Also use PROCINFO to make gawk output in alphabetical order. This is not ideal, since it changes the env-car ordering from what the user provided, but it may be acceptable. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Fixes: https://source.denx.de/u-boot/u-boot/-/issues/10
* env: Avoid using GNU features in awkSimon Glass2021-11-281-9/+20
| | | | | | | | | | GNU has a very useful third argument to match() but this is not supported in the POSIX awk. Update the code to cope, so that the script is POSIX-compliant. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Mark Kettenis <mark.kettenis@xs4all.nl>
* env: Allow U-Boot scripts to be placed in a .env fileSimon Glass2021-11-161-0/+80
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. 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>