From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH master] bootm: ignore global.bootm.initrd if unavailable
Date: Wed, 6 Aug 2025 15:56:42 +0200 [thread overview]
Message-ID: <20250806135642.2864366-1-a.fatoum@barebox.org> (raw)
The bootm.initrd* variables are only available if CONFIG_BOOTM_INITRD is
enabled, but we were saving and attempting to restore them
unconditionally.
Fix that to avoid confusing warnings on systems without initrd support
compiled in.
Fixes: 926985a74ee0 ("bootm: don't clobber global.bootm. variables after script boot fails")
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
common/bootm.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/common/bootm.c b/common/bootm.c
index 95211011fe8b..3a2eb262b26a 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -61,8 +61,10 @@ void bootm_data_init_defaults(struct bootm_data *data)
data->tee_file = getenv_nonempty("global.bootm.tee");
data->os_file = getenv_nonempty("global.bootm.image");
getenv_ul("global.bootm.image.loadaddr", &data->os_address);
- getenv_ul("global.bootm.initrd.loadaddr", &data->initrd_address);
- data->initrd_file = getenv_nonempty("global.bootm.initrd");
+ if (IS_ENABLED(CONFIG_BOOTM_INITRD)) {
+ getenv_ul("global.bootm.initrd.loadaddr", &data->initrd_address);
+ data->initrd_file = getenv_nonempty("global.bootm.initrd");
+ }
data->root_dev = getenv_nonempty("global.bootm.root_dev");
data->verify = bootm_get_verify_mode();
data->appendroot = bootm_appendroot;
@@ -78,8 +80,10 @@ void bootm_data_restore_defaults(const struct bootm_data *data)
globalvar_set("bootm.tee", data->tee_file);
globalvar_set("bootm.image", data->os_file);
pr_setenv("global.bootm.image.loadaddr", "0x%lx", data->os_address);
- pr_setenv("global.bootm.initrd.loadaddr", "0x%lx", data->initrd_address);
- globalvar_set("bootm.initrd", data->initrd_file);
+ if (IS_ENABLED(CONFIG_BOOTM_INITRD)) {
+ pr_setenv("global.bootm.initrd.loadaddr", "0x%lx", data->initrd_address);
+ globalvar_set("bootm.initrd", data->initrd_file);
+ }
globalvar_set("bootm.root_dev", data->root_dev);
bootm_set_verify_mode(data->verify);
bootm_appendroot = data->appendroot;
--
2.39.5
next reply other threads:[~2025-08-06 14:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 13:56 Ahmad Fatoum [this message]
2025-08-07 5:14 ` 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=20250806135642.2864366-1-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--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