summaryrefslogtreecommitdiff
path: root/env/env.c
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-07-28 11:51:20 +0200
committerTom Rini <trini@konsulko.com>2020-07-31 10:13:00 -0400
commit0115dd3a6a144e9c974e00a9f3f41c5bb053236e (patch)
treeb493f2af6ae993f3fe319d5f97c3833d160041af /env/env.c
parent466d9855d4ee828c998ee3ea29e5685e38d3064e (diff)
downloadu-boot-0115dd3a6a144e9c974e00a9f3f41c5bb053236e.tar.gz
cmd: env: add env load command
Add the new command env load to load the environment from the current location gd->env_load_prio. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Diffstat (limited to 'env/env.c')
-rw-r--r--env/env.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/env/env.c b/env/env.c
index 5cf5bd238f..785a2b8552 100644
--- a/env/env.c
+++ b/env/env.c
@@ -230,6 +230,34 @@ int env_load(void)
return -ENODEV;
}
+int env_reload(void)
+{
+ struct env_driver *drv;
+
+ drv = env_driver_lookup(ENVOP_LOAD, gd->env_load_prio);
+ if (drv) {
+ int ret;
+
+ printf("Loading Environment from %s... ", drv->name);
+
+ if (!env_has_inited(drv->location)) {
+ printf("not initialized\n");
+ return -ENODEV;
+ }
+
+ ret = drv->load();
+ if (ret)
+ printf("Failed (%d)\n", ret);
+ else
+ printf("OK\n");
+
+ if (!ret)
+ return 0;
+ }
+
+ return -ENODEV;
+}
+
int env_save(void)
{
struct env_driver *drv;