From: Sascha Hauer <s.hauer@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Subject: [PATCH 2/3] environment: add global.env.path
Date: Tue, 28 Apr 2026 11:24:11 +0200 [thread overview]
Message-ID: <20260428-env-autoprobe-v1-2-9cdedfa0752e@pengutronix.de> (raw)
In-Reply-To: <20260428-env-autoprobe-v1-0-9cdedfa0752e@pengutronix.de>
barebox doesn't give an indication where the environment is stored without
actually doing a loadenv/saveenv. Add global.env.path which can be used to
show the path or even to set it.
A variable added with globalvar_add_simple_string() will be set to an empty
string whereas default_environment_path_get() used to return NULL when unset,
so we have to catch this explicitly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/environment.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/common/environment.c b/common/environment.c
index 207b58e743..f883a520c6 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -126,7 +126,7 @@ const char *default_environment_path_get(void)
{
struct cdev *cdev;
- if (default_environment_path)
+ if (default_environment_path && *default_environment_path)
return default_environment_path;
cdev = default_environment_path_search();
@@ -547,9 +547,13 @@ int envfs_load(const char *filename, const char *dir, unsigned flags)
static int register_env_vars(void)
{
globalvar_add_simple_bool("env.autoprobe", &global_env_autoprobe);
+ globalvar_add_simple_string("env.path", &default_environment_path);
+
return 0;
}
postcore_initcall(register_env_vars);
BAREBOX_MAGICVAR(global.env.autoprobe,
"Automatically probe known block devices for environment");
+BAREBOX_MAGICVAR(global.env.path,
+ "The path the environment is stored");
#endif
--
2.47.3
next prev parent reply other threads:[~2026-04-28 9:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 9:24 [PATCH 0/3] environment: Allow autoprobing env devices without CONFIG_INSECURE Sascha Hauer
2026-04-28 9:24 ` [PATCH 1/3] environment: Drop /dev/env0 default Sascha Hauer
2026-04-28 9:24 ` Sascha Hauer [this message]
2026-04-28 9:24 ` [PATCH 3/3] environment: add explicit option to allow searching for environment devices 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=20260428-env-autoprobe-v1-2-9cdedfa0752e@pengutronix.de \
--to=s.hauer@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