This enables the building user to specify environment values to be included in the static default_environment with an image. This is useful to build multiple otherwise like configured images, varying by environment unique entries.
--- I expected something like this to already be present, but couldn't find such a mechanism. I also assumed that something similar may have been proposed previously, but also couldn't find anything via searching. Signed-off-by: Joel Johnson <mrj...@lixil.net> --- env/Kconfig | 19 +++++++++++++++---- include/env_default.h | 3 +++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/env/Kconfig b/env/Kconfig index ed12609f6a..5049cb78be 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -556,14 +556,25 @@ config SYS_RELOC_GD_ENV_ADDR Relocate the early env_addr pointer so we know it is not inside the binary. Some systems need this and for the rest, it doesn't hurt. +config USER_ENV_SETTINGS + string "User build-time additional environment entries" + help + This value is reserved for the building user to provide custom + environment entries to be added to the default environment. Care must + be taken to not break the environment, incompatible entries may cause + failure to compile, or failure of the target board to properly + initialize or boot. The format is key=value pairs, with entries + separated by C-style escaped null terminated values, such as: + "key1=valueA\0key2=valueB\0key3=valueC". + config USE_DEFAULT_ENV_FILE bool "Create default environment from file" help Normally, the default environment is automatically generated - based on the settings of various CONFIG_* options, as well - as the CONFIG_EXTRA_ENV_SETTINGS. By selecting this option, - you can instead define the entire default environment in an - external file. + based on the settings of various CONFIG_* options, combined with values + of board specific CONFIG_EXTRA_ENV_SETTINGS and user provided + CONFIG_USER_ENV_SETTINGS. By selecting this option, you can instead + define the entire default environment in an external file. config DEFAULT_ENV_FILE string "Path to default environment file" diff --git a/include/env_default.h b/include/env_default.h index 56a8bae39a..9396a34715 100644 --- a/include/env_default.h +++ b/include/env_default.h @@ -109,6 +109,9 @@ const uchar default_environment[] = { #endif #ifdef CONFIG_EXTRA_ENV_SETTINGS CONFIG_EXTRA_ENV_SETTINGS +#endif +#ifdef CONFIG_USER_ENV_SETTINGS + CONFIG_USER_ENV_SETTINGS #endif "\0" #else /* CONFIG_USE_DEFAULT_ENV_FILE */ -- 2.20.1