From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] environment: add new global.env.noload parameter
Date: Fri, 28 Nov 2025 18:21:14 +0100 [thread overview]
Message-ID: <20251128172116.35544-1-a.fatoum@pengutronix.de> (raw)
It can be useful for board code to deny loading an environment without
disabling it altogether, e.g. to disable load of the environment when
entering a recovery mode. Add a global variable that allows for just
that.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/environment.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/common/environment.c b/common/environment.c
index d7f5f51cfc6d..d49f255ef007 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -54,6 +54,7 @@ struct action_data {
#define TMPDIR "/.defaultenv"
static int global_env_autoprobe = IS_ENABLED(CONFIG_INSECURE);
+static int global_env_noload = false;
static char *default_environment_path;
void default_environment_path_set(const char *path)
@@ -455,7 +456,7 @@ int envfs_load(const char *filename, const char *dir, unsigned flags)
size_t size, rsize;
#ifdef __BAREBOX__
- if (!IS_ALLOWED(SCONFIG_ENVIRONMENT_LOAD))
+ if (!IS_ALLOWED(SCONFIG_ENVIRONMENT_LOAD) || global_env_noload)
return -EPERM;
#endif
@@ -539,12 +540,17 @@ int envfs_load(const char *filename, const char *dir, unsigned flags)
}
#ifdef __BAREBOX__
+
static int register_env_vars(void)
{
globalvar_add_simple_bool("env.autoprobe", &global_env_autoprobe);
+ globalvar_add_simple_bool("env.noload", &global_env_noload);
+
return 0;
}
postcore_initcall(register_env_vars);
BAREBOX_MAGICVAR(global.env.autoprobe,
"Automatically probe known block devices for environment");
+BAREBOX_MAGICVAR(global.env.noload,
+ "Suppress loading of externally persisted environment");
#endif
--
2.47.3
next reply other threads:[~2025-11-28 17:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 17:21 Ahmad Fatoum [this message]
2025-12-01 9:37 ` Sascha Hauer
2025-12-01 9:42 ` Ahmad Fatoum
2025-12-01 9:46 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251128172116.35544-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox