Skip to contentSkip to conversation

spl: remove usage of CMD_BOOT[IZ] from image parsing

PATCH Superseded Anshul Dalal 1 participant 2 messages Mar 12, 2025 Arm (32-bit)

v2 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spl: remove usage of CMD_BOOT[IZ] from image parsing

Using CMD_* configs from spl doesn't make logical sense. Therefore this patch replaces the checks for CMD_BOOT[IZ] with newly added configs SPL_HAS_BOOT[IZ].

More info:
https://lore.kernel.org/u-boot/20250310135544.GV2640854@bill-the-cat/

---
Changes in v2:
* Add SPL_HAS_BOOT[IZ] configs
v1: https://lore.kernel.org/u-boot/[email protected]/

---
 arch/arm/lib/Makefile |  4 ++--
 common/spl/Kconfig    | 13 +++++++++++++
 common/spl/spl.c      |  6 +++---
 3 files changed, 18 insertions(+), 5 deletions(-)
arch/arm/lib/Makefile +2 -2
index 1c95dd6fed2..e857adddd03 100644
@@ -36,8 +36,8 @@ obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o
 else
 obj-$(CONFIG_$(PHASE_)FRAMEWORK) += spl.o
 ifdef CONFIG_SPL_FRAMEWORK
-obj-$(CONFIG_CMD_BOOTI) += image.o
-obj-$(CONFIG_CMD_BOOTZ) += zimage.o
+obj-$(CONFIG_SPL_HAS_BOOTI) += image.o
+obj-$(CONFIG_SPL_HAS_BOOTZ) += zimage.o
 endif
 obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
 endif
common/spl/Kconfig +13 -0
index 21a5cefee7a..36c0fb063d0 100644
@@ -1153,6 +1153,19 @@ config SPL_OS_BOOT
 	  Enable booting directly to an OS from SPL.
 	  for more info read doc/README.falcon
 
+config SPL_HAS_BOOTZ
+	bool "Allow booting to kernel zimage from SPL"
+	depends on SPL_OS_BOOT
+	help
+	  Boot a linux zimage from memory in falcon boot.
+
+config SPL_HAS_BOOTI
+	bool "Allow booting to kernel image from SPL"
+	depends on SPL_OS_BOOT
+	default y if ARM64 || RISCV || SANDBOX
+	help
+	  Boot an AArch64 Linux Kernel image from memory in falcon boot.
+
 config SPL_PAYLOAD_ARGS_ADDR
 	hex "Address in memory to load 'args' file for Falcon Mode to"
 	depends on SPL_OS_BOOT || SPL_LOAD_FIT_OPENSBI_OS_BOOT
common/spl/spl.c +3 -3
index 76fd56dfe4b..8905c776ea5 100644
@@ -335,7 +335,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 		panic("** no mkimage signature but raw image not supported");
 	}
 
-	if (CONFIG_IS_ENABLED(OS_BOOT) && IS_ENABLED(CONFIG_CMD_BOOTI)) {
+	if (CONFIG_IS_ENABLED(OS_BOOT) && IS_ENABLED(CONFIG_SPL_HAS_BOOTI)) {
 		ulong start, size;
 
 		if (!booti_setup((ulong)header, &start, &size, 0)) {
@@ -349,9 +349,9 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 			      spl_image->load_addr, spl_image->size);
 			return 0;
 		}
-	} else if (CONFIG_IS_ENABLED(OS_BOOT) && IS_ENABLED(CONFIG_CMD_BOOTZ)) {
+	} else if (CONFIG_IS_ENABLED(OS_BOOT) &&
+		   IS_ENABLED(CONFIG_SPL_HAS_BOOTI)) {
 		ulong start, end;
-
 		if (!bootz_setup((ulong)header, &start, &end)) {
 			spl_image->name = "Linux";
 			spl_image->os = IH_OS_LINUX;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 72 lines · Anshul Dalal

Using CMD_* configs from spl doesn't make logical sense. Therefore this patch replaces the checks for CMD_BOOT[IZ] with newly added configs SPL_HAS_BOOT[IZ].

More info:
https://lore.kernel.org/u-boot/20250310135544.GV2640854@bill-the-cat/

---
Changes in v2:
* Add SPL_HAS_BOOT[IZ] configs
v1: https://lore.kernel.org/u-boot/[email protected]/

---
 arch/arm/lib/Makefile |  4 ++--
 common/spl/Kconfig    | 13 +++++++++++++
 common/spl/spl.c      |  6 +++---
 3 files changed, 18 insertions(+), 5 deletions(-)
arch/arm/lib/Makefile +2 -2
index 1c95dd6fed2..e857adddd03 100644
@@ -36,8 +36,8 @@ obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o
 else
 obj-$(CONFIG_$(PHASE_)FRAMEWORK) += spl.o
 ifdef CONFIG_SPL_FRAMEWORK
-obj-$(CONFIG_CMD_BOOTI) += image.o
-obj-$(CONFIG_CMD_BOOTZ) += zimage.o
+obj-$(CONFIG_SPL_HAS_BOOTI) += image.o
+obj-$(CONFIG_SPL_HAS_BOOTZ) += zimage.o
 endif
 obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
 endif
common/spl/Kconfig +13 -0
index 21a5cefee7a..36c0fb063d0 100644
@@ -1153,6 +1153,19 @@ config SPL_OS_BOOT
 	  Enable booting directly to an OS from SPL.
 	  for more info read doc/README.falcon
 
+config SPL_HAS_BOOTZ
+	bool "Allow booting to kernel zimage from SPL"
+	depends on SPL_OS_BOOT
+	help
+	  Boot a linux zimage from memory in falcon boot.
+
+config SPL_HAS_BOOTI
+	bool "Allow booting to kernel image from SPL"
+	depends on SPL_OS_BOOT
+	default y if ARM64 || RISCV || SANDBOX
+	help
+	  Boot an AArch64 Linux Kernel image from memory in falcon boot.
+
 config SPL_PAYLOAD_ARGS_ADDR
 	hex "Address in memory to load 'args' file for Falcon Mode to"
 	depends on SPL_OS_BOOT || SPL_LOAD_FIT_OPENSBI_OS_BOOT
common/spl/spl.c +1 -1
index 76fd56dfe4b..8905c776ea5 100644
@@ -335,7 +335,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 		panic("** no mkimage signature but raw image not supported");
 	}
 
-	if (CONFIG_IS_ENABLED(OS_BOOT) && IS_ENABLED(CONFIG_CMD_BOOTI)) {
+	if (CONFIG_IS_ENABLED(OS_BOOT) && IS_ENABLED(CONFIG_SPL_HAS_BOOTI)) {
 		ulong start, size;
 
 		if (!booti_setup((ulong)header, &start, &size, 0)) {
@@ -349,9 +349,9 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 			      spl_image->load_addr, spl_image->size);

common/spl/spl.c int spl_parse_image_header(struct spl_image_info *spl_image, · line 357

Quoted 10 lines
common/spl/spl.c +2 -2
 			return 0;
 		}
-	} else if (CONFIG_IS_ENABLED(OS_BOOT) && IS_ENABLED(CONFIG_CMD_BOOTZ)) {
+	} else if (CONFIG_IS_ENABLED(OS_BOOT) &&
+		   IS_ENABLED(CONFIG_SPL_HAS_BOOTI)) {
 		ulong start, end;
-
 		if (!bootz_setup((ulong)header, &start, &end)) {
 			spl_image->name = "Linux";
 			spl_image->os = IH_OS_LINUX;

Superseded by v3:
https://lore.kernel.org/u-boot/[email protected]/

Anshul