From 0115dd3a6a144e9c974e00a9f3f41c5bb053236e Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Tue, 28 Jul 2020 11:51:20 +0200 Subject: 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 --- env/env.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'env') 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; -- cgit