From fa5b6ff16f38db14116690fbbdf031613dcc2272 Mon Sep 17 00:00:00 2001 From: Albert Schwarzkopf Date: Mon, 9 Dec 2019 11:49:28 +0100 Subject: 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 Signed-off-by: Sascha Hauer --- commands/nv.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'commands') diff --git a/commands/nv.c b/commands/nv.c index 01c25a108f..315019345c 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(); } -- cgit v1.2.3