* [PATCH master] bootm: ignore global.bootm.initrd if unavailable
@ 2025-08-06 13:56 Ahmad Fatoum
2025-08-07 5:14 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-08-06 13:56 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-07 5:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-06 13:56 [PATCH master] bootm: ignore global.bootm.initrd if unavailable Ahmad Fatoum
2025-08-07 5:14 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox