[PATCH 16/16] boot: make bootsource the default boot target if enabled

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 1 03:48:06 PDT 2025


bootsource now expands to the cdev that barebox booted from if
that could be determined.

This makes it a useful default for $global.boot.default.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 common/boot.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/common/boot.c b/common/boot.c
index cb16a9a2b508..6aa2b1394961 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -134,7 +134,12 @@ static char *global_user;
 
 static int init_boot(void)
 {
-	global_boot_default = global_boot_default ? : xstrdup("net");
+	if (!global_boot_default)
+		global_boot_default = xstrdup(
+			IF_ENABLED(CONFIG_BOOT_DEFAULTS, "bootsource ")
+			"net"
+		);
+
 	globalvar_add_simple_string("boot.default", &global_boot_default);
 	globalvar_add_simple_int("boot.watchdog_timeout",
 				 &boot_watchdog_timeout, "%u");
-- 
2.39.5




More information about the barebox mailing list