summaryrefslogtreecommitdiff
path: root/env/env.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2023-02-03 13:22:51 +0100
committerTom Rini <trini@konsulko.com>2023-02-10 11:24:08 -0500
commit5ab81058364b5e49bdc6f530368d49e94dfcb960 (patch)
tree6a8d68acebd4fae2d3bf1276da5cba5d9309c32a /env/env.c
parent01065043ad9deec894dcd76b1ac44eb9e502f6e0 (diff)
downloadu-boot-5ab81058364b5e49bdc6f530368d49e94dfcb960.tar.gz
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>
Diffstat (limited to 'env/env.c')
-rw-r--r--env/env.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/env/env.c b/env/env.c
index 0f73ebc08e..ad774f4117 100644
--- a/env/env.c
+++ b/env/env.c
@@ -192,6 +192,14 @@ int env_load(void)
int best_prio = -1;
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++) {
int ret;