diff options
author | Patrick Delaunay <patrick.delaunay@st.com> | 2020-07-28 11:51:20 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-07-31 10:13:00 -0400 |
commit | 0115dd3a6a144e9c974e00a9f3f41c5bb053236e (patch) | |
tree | b493f2af6ae993f3fe319d5f97c3833d160041af /env/env.c | |
parent | 466d9855d4ee828c998ee3ea29e5685e38d3064e (diff) | |
download | u-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.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -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; |