u-boot/env
Simon Glass 86b9c3e4e4 env: Allow U-Boot scripts to be placed in a .env file
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>
2021-11-16 14:35:08 -05:00
..
attr.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
callback.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
common.c env: Simplify env_get_default() 2021-11-13 08:16:39 -07:00
eeprom.c env: Drop env_get_char_spec() and old, unused .get_char() implementations 2021-10-21 12:50:48 -06:00
embedded.c env: Allow U-Boot scripts to be placed in a .env file 2021-11-16 14:35:08 -05:00
env.c env: Inline env_get_char() into its only user 2021-10-21 12:50:48 -06:00
ext4.c env: add ENV_ERASE_PTR macro 2021-04-16 17:32:34 -04:00
fat.c env/fat.c: support redund environment 2021-04-16 13:37:06 -04:00
flags.c env: Fix warning when forcing environment without ENV_ACCESS_IGNORE_FORCE 2021-04-16 11:55:55 -04:00
flash.c env: flash: Cosmetic fix 2021-10-31 12:26:44 -06:00
Kconfig env: Allow U-Boot scripts to be placed in a .env file 2021-11-16 14:35:08 -05:00
Makefile env: remove callback.o for an SPL build 2020-04-24 10:09:59 -04:00
mmc.c env: mmc: Add support for redundant env in both eMMC boot partitions 2021-10-25 14:33:13 -04:00
nand.c env: nand: Put ENV_INVALID into gd->env_valid if default environment 2021-10-31 12:26:44 -06:00
nowhere.c env: nowhere: Cosmetic fix 2021-10-31 12:26:44 -06:00
nvram.c env: nvram: Cosmetic fix in env_nvram_init() 2021-10-31 12:26:44 -06:00
onenand.c mtd: Remove mtd_erase_callback() entirely 2021-10-23 15:47:33 +05:30
remote.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
sata.c env: Discern environment coming from external storage 2020-07-31 10:13:00 -04:00
sf.c env: sf: Put ENV_INVALID into gd->env_valid on CRC failure 2021-10-31 12:26:44 -06:00
ubi.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00