summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-06-19 14:03:35 +0200
committerTom Rini <trini@konsulko.com>2020-07-26 14:35:30 -0400
commit2f96b3238ca330897b8eb5bde82db2da2c07effb (patch)
tree1d872f72a499dead0dcd4b66caf4e5da3c6abf06 /cmd
parent6718ebd0327a255c6e3e840c3105ee397c8c0326 (diff)
cmd: env: check real location for env info command
Check the current ENV location, dynamically provided by the weak function env_get_location to be sure that the environment can be persistent. The compilation flag ENV_IS_IN_DEVICE is not enough when the board dynamically select the available storage location (according boot device for example). This patch solves issue for stm32mp1 platform, when the boot device is USB. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/nvedit.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 6d7da09790..acd9f82667 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -1233,6 +1233,9 @@ static int do_env_info(struct cmd_tbl *cmdtp, int flag,
int eval_flags = 0;
int eval_results = 0;
bool quiet = false;
+#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
+ enum env_location loc;
+#endif
/* display environment information */
if (argc <= 1)
@@ -1274,9 +1277,15 @@ static int do_env_info(struct cmd_tbl *cmdtp, int flag,
/* evaluate whether environment can be persisted */
if (eval_flags & ENV_INFO_IS_PERSISTED) {
#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
- if (!quiet)
- printf("Environment can be persisted\n");
- eval_results |= ENV_INFO_IS_PERSISTED;
+ loc = env_get_location(ENVOP_SAVE, gd->env_load_prio);
+ if (ENVL_NOWHERE != loc && ENVL_UNKNOWN != loc) {
+ if (!quiet)
+ printf("Environment can be persisted\n");
+ eval_results |= ENV_INFO_IS_PERSISTED;
+ } else {
+ if (!quiet)
+ printf("Environment cannot be persisted\n");
+ }
#else
if (!quiet)
printf("Environment cannot be persisted\n");