summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorAlbert Schwarzkopf <a.schwarzkopf@phytec.de>2019-12-09 11:49:28 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-12-11 09:47:29 +0100
commitfa5b6ff16f38db14116690fbbdf031613dcc2272 (patch)
tree04d833b3b061479b86abdb73faabbb339e5fd30b /commands
parent15e92d72c79da0453933f3d321c38697f089b32f (diff)
downloadbarebox-fa5b6ff16f38db14116690fbbdf031613dcc2272.tar.gz
Allow usage of default environment without environment file storage
Currently, the default environment is only used when the barebox environment on the persistent store is not valid or when ENVFS_FLAGS_FORCE_BUILT_IN is set in the super block. However, ENVFS_FLAGS_FORCE_BUILT_IN can be cleared and the environmnet variables in the persistent store will be used again. This may not be desirable. This patch allows building CONFIG_DEFAULT_ENVIRONMENT independent of CONFIG_ENV_HANDLING. This can be useful if you never want to load or write values from the persistent store and you only need to read environment variables from your default environment. If CONFIG_ENV_HANDLING is not set, a message will be printed to the user indicating that changes to non-volatile variables won't be persisted. Move envfs functions that are needed when CONFIG_DEFAULT_ENVIRONMENT and/or CONFIG_ENV_HANDLING is set to a new file common/envfs-core.c. Signed-off-by: Albert Schwarzkopf <a.schwarzkopf@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/nv.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/commands/nv.c b/commands/nv.c
index 01c25a1..3150193 100644
--- a/commands/nv.c
+++ b/commands/nv.c
@@ -50,6 +50,11 @@ static int do_nv(int argc, char *argv[])
}
if (do_save) {
+ if (!IS_ENABLED(CONFIG_ENV_HANDLING)) {
+ printf("Error: Current configuration does not support saving variables\n");
+ return COMMAND_ERROR;
+ }
+
return nvvar_save();
}