mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-14 04:46:01 +01:00
env: Complete generic support for writable list
This completes what 890feecaab72 started by selecting ENV_APPEND and loading the default env before any other sources. This ensures that load operations pick up all non-writable vars from the default env and only permitted parts from other locations according to the regular priorities. With this change, boards only need to define the list of writable variables but no longer have to provide a custom env_get_location implementation. CC: Joe Hershberger <joe.hershberger@ni.com> CC: Marek Vasut <marex@denx.de> CC: Stefan Herbrechtsmeier <stefan.herbrechtsmeier-oss@weidmueller.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Marek Vasut <marex@denx.de>
This commit is contained in:
parent
01065043ad
commit
5ab8105836
1
env/Kconfig
vendored
1
env/Kconfig
vendored
@ -733,6 +733,7 @@ config ENV_APPEND
|
|||||||
|
|
||||||
config ENV_WRITEABLE_LIST
|
config ENV_WRITEABLE_LIST
|
||||||
bool "Permit write access only to listed variables"
|
bool "Permit write access only to listed variables"
|
||||||
|
select ENV_APPEND
|
||||||
help
|
help
|
||||||
If defined, only environment variables which explicitly set the 'w'
|
If defined, only environment variables which explicitly set the 'w'
|
||||||
writeable flag can be written and modified at runtime. No variables
|
writeable flag can be written and modified at runtime. No variables
|
||||||
|
8
env/env.c
vendored
8
env/env.c
vendored
@ -192,6 +192,14 @@ int env_load(void)
|
|||||||
int best_prio = -1;
|
int best_prio = -1;
|
||||||
int prio;
|
int prio;
|
||||||
|
|
||||||
|
if (CONFIG_IS_ENABLED(ENV_WRITEABLE_LIST)) {
|
||||||
|
/*
|
||||||
|
* When using a list of writeable variables, the baseline comes
|
||||||
|
* from the built-in default env. So load this first.
|
||||||
|
*/
|
||||||
|
env_set_default(NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
for (prio = 0; (drv = env_driver_lookup(ENVOP_LOAD, prio)); prio++) {
|
for (prio = 0; (drv = env_driver_lookup(ENVOP_LOAD, prio)); prio++) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user