spl: remove usage of CMD_BOOT[IZ] from image parsing
PATCH v3 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].
An imply clause has been added for CMD_BOOTZ to avoid breaking configs that rely on CMD_BOOTZ in falcon boot. There is no such need for CMD_BOOTI since it's already enabled by default for the platforms that support the image format.
More info:
https://lore.kernel.org/u-boot/20250310135544.GV2640854@bill-the-cat/
---
Changes in v3:
* Add imply clause for CMD_BOOTZ to enable SPL_HAS_BOOTZ
* Fix broken check for bootz_setup
v2: https://lore.kernel.org/u-boot/[email protected]/
Changes in v2:
* Add SPL_HAS_BOOT[IZ] configs
v1: https://lore.kernel.org/u-boot/[email protected]/
--- arch/arm/lib/Makefile | 4 ++-- cmd/Kconfig | 1 + common/spl/Kconfig | 13 +++++++++++++ common/spl/spl.c | 5 +++-- 4 files changed, 19 insertions(+), 4 deletions(-)
arch/arm/lib/Makefile +2 -2
@@ -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
cmd/Kconfig +1 -0
@@ -352,6 +352,7 @@ config BOOTM_ELF config CMD_BOOTZ bool "bootz" + imply SPL_HAS_BOOTZ help Boot the Linux zImage
common/spl/Kconfig +13 -0
@@ -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 uncompressed 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 -2
@@ -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,7 +349,8 @@ 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_BOOTZ )) {ulong start, end;if (!bootz_setup ((ulong )header, &start, &end)) {
Signature · 1 line
2.43.0
Quoted 33 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].
An imply clause has been added for
CMD_BOOTZto avoid breaking configs that rely onCMD_BOOTZin falcon boot. There is no such need forCMD_BOOTIsince it's already enabled by default for the platforms that support the image format.More info:
https://lore.kernel.org/u-boot/20250310135544.GV2640854@bill-the-cat/Signed-off-by Anshul Dalal <[email protected]>---
Changes in v3:
* Add imply clause forCMD_BOOTZto enableSPL_HAS_BOOTZ
* Fix broken check forbootz_setup
v2: https://lore.kernel.org/u-boot/[email protected]/
Changes in v2:
* Add SPL_HAS_BOOT[IZ] configs
v1: https://lore.kernel.org/u-boot/[email protected]/--- arch/arm/lib/Makefile | 4 ++-- cmd/Kconfig | 1 + common/spl/Kconfig | 13 +++++++++++++ common/spl/spl.c | 5 +++-- 4 files changed, 19 insertions(+), 4 deletions(-)arch/arm/lib/Makefile +0
-0
arch/arm/lib/Makefile obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o · line 41
Quoted 8 lines
arch/arm/lib/Makefile +2
-2@@ -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
This Makefile hunk is weird and not quite correct today, and this change makes it more odd. We should drop the CONFIG_SPL_FRAMEWORK check because we're already in an CONFIG_XPL_BUILD check, and since we're making needing these objects explicit now the very rare case of ARM+SPL+!SPL_FRAMEWORK won't try and include these when not required.
cmd/Kconfig config BOOTM_ELF · line 358
Quoted 12 lines
cmd/Kconfig +1
-0@@ -352,6 +352,7 @@ config BOOTM_ELF config CMD_BOOTZ bool "bootz" + imply SPL_HAS_BOOTZ help Boot the Linux zImage
We don't need this hunk at all, we already (should) be getting the right file via the current logic in arch/arm/lib/Makefile
common/spl/Kconfig config SPL_OS_BOOT · line 1157
Quoted 10 lines
common/spl/Kconfig +2
-0@@ -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"
How about:
"Allow booting a zImage style Linux kernel from SPL"
common/spl/Kconfig config SPL_OS_BOOT · line 1163
Quoted 6 lines
common/spl/Kconfig +6
-0+ 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"
How about:
"Allow booting an Image style Linux kernel from SPL"
common/spl/Kconfig config SPL_OS_BOOT · line 1165
Quoted 2 lines
common/spl/Kconfig +2
-0+ depends on SPL_OS_BOOT + default y if ARM64 || RISCV || SANDBOX
Do we need SANDBOX here?
Signature · 1 line
Tom
Quoted 56 lines · Tom Rini
Quoted 33 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].
An imply clause has been added for
CMD_BOOTZto avoid breaking configs that rely onCMD_BOOTZin falcon boot. There is no such need forCMD_BOOTIsince it's already enabled by default for the platforms that support the image format.More info:
https://lore.kernel.org/u-boot/20250310135544.GV2640854@bill-the-cat/Signed-off-by Anshul Dalal <[email protected]>---
Changes in v3:
* Add imply clause forCMD_BOOTZto enableSPL_HAS_BOOTZ
* Fix broken check forbootz_setup
v2: https://lore.kernel.org/u-boot/[email protected]/
Changes in v2:
* Add SPL_HAS_BOOT[IZ] configs
v1: https://lore.kernel.org/u-boot/[email protected]/--- arch/arm/lib/Makefile | 4 ++-- cmd/Kconfig | 1 + common/spl/Kconfig | 13 +++++++++++++ common/spl/spl.c | 5 +++-- 4 files changed, 19 insertions(+), 4 deletions(-)arch/arm/lib/Makefile +0
-0arch/arm/lib/Makefile obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o · line 41
Quoted 8 lines
arch/arm/lib/Makefile +2
-2@@ -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 endifThis
Makefilehunk is weird and not quite correct today, and this change makes it more odd. We should drop theCONFIG_SPL_FRAMEWORKcheck because we're already in anCONFIG_XPL_BUILDcheck, and since we're making needing these objects explicit now the very rare case of ARM+SPL+!SPL_FRAMEWORK won't try and include these when not required.Quoted 6 lines
cmd/Kconfig +0
-0@@ -352,6 +352,7 @@ config BOOTM_ELF
Quoted 10 lines
cmd/Kconfig config BOOTM_ELF · line 358
Quoted 6 lines
cmd/Kconfig +1
-0config CMD_BOOTZ bool "bootz" + imply SPL_HAS_BOOTZ help Boot the Linux zImageWe don't need this hunk at all, we already (should) be getting the right file via the current logic in
arch/arm/lib/Makefile
That's correct but we also need to take into account the modified check in common/spl/spl.c, earlier it would pass on CMD_BOOTZ and allow booting a zImage, now it checks for SPL_HAS_BOOTZ instead.
This would fail for configs that relied on CMD_BOOTZ during falcon boot such as display5_defconfig. This imply ensures we enable SPL_HAS_BOOTZ in such cases.
Quoted 14 lines
common/spl/Kconfig config SPL_OS_BOOT · line 1157
Quoted 10 lines
common/spl/Kconfig +2
-0@@ -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"How about:
"Allow booting a zImage style Linux kernel from SPL"
Quoted 10 lines
common/spl/Kconfig config SPL_OS_BOOT · line 1163
Quoted 6 lines
common/spl/Kconfig +6
-0+ 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"How about:
"Allow booting an Image style Linux kernel from SPL"
Sounds good would be addressed in v4 :)
Quoted 4 lines
common/spl/Kconfig config SPL_OS_BOOT · line 1165
Quoted 2 lines
common/spl/Kconfig +2
-0+ depends on SPL_OS_BOOT + default y if ARM64 || RISCV || SANDBOXDo we need SANDBOX here?
No, having SPL_OS_BOOT on SANDBOX doesn't make sense anyway.
Anshul
Quoted 93 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].
An imply clause has been added for
CMD_BOOTZto avoid breaking configs that rely onCMD_BOOTZin falcon boot. There is no such need forCMD_BOOTIsince it's already enabled by default for the platforms that support the image format.More info:
https://lore.kernel.org/u-boot/20250310135544.GV2640854@bill-the-cat/Signed-off-by Anshul Dalal <[email protected]>---
Changes in v3:
* Add imply clause forCMD_BOOTZto enableSPL_HAS_BOOTZ
* Fix broken check forbootz_setup
v2: https://lore.kernel.org/u-boot/[email protected]/
Changes in v2:
* Add SPL_HAS_BOOT[IZ] configs
v1: https://lore.kernel.org/u-boot/[email protected]/--- arch/arm/lib/Makefile | 4 ++-- cmd/Kconfig | 1 + common/spl/Kconfig | 13 +++++++++++++ common/spl/spl.c | 5 +++-- 4 files changed, 19 insertions(+), 4 deletions(-)arch/arm/lib/Makefile +2
-2@@ -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 endifcmd/Kconfig +1
-0@@ -352,6 +352,7 @@ config BOOTM_ELF config CMD_BOOTZ bool "bootz" + imply SPL_HAS_BOOTZ help Boot the Linux zImagecommon/spl/Kconfig +13
-0@@ -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 uncompressed 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_BOOTcommon/spl/spl.c +1
-1@@ -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 )) {
common/spl/spl.c int spl_parse_image_header(struct spl_image_info *spl_image, · line 356
Quoted 9 lines
common/spl/spl.c +2
-1@@ -349,7 +349,8 @@ 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_BOOTZ )) {ulong start, end;if (!bootz_setup ((ulong )header, &start, &end)) {
Superseded by v4:
https://lore.kernel.org/u-boot/[email protected]/
Anshul