Skip to contentSkip to conversation

bootm: ignore global.bootm.initrd if unavailable

PATCH Applied Ahmad Fatoum 2 participants 2 messages Aug 6, 2025 – Aug 7, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bootm: ignore global.bootm.initrd if unavailable

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")
---
 common/bootm.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
common/bootm.c +8 -4
index 95211011fe8b..3a2eb262b26a 100644
@@ -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;
Signature · 1 line
2.39.5
Applied
#1 lore raw
Quoted 8 lines · 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.

[...]

Applied, thanks!

[1/1] bootm: ignore global.bootm.initrd if unavailable
https://git.pengutronix.de/cgit/barebox/commit/?id=a353f75968e0 (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>