[PATCH v2 1/2] spl: Add size check for u-boot-with-spl.bin

Philip Oberfichtner pro at denx.de
Tue May 27 14:10:48 CEST 2025


Introduce another SIZE_CHECK macro for u-boot-with-spl.bin.

Signed-off-by: Philip Oberfichtner <pro at denx.de>
---

Notes:
    Changes in v2: none

 Makefile           | 7 +++++++
 common/spl/Kconfig | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/Makefile b/Makefile
index f88684947ee..d117925a366 100644
--- a/Makefile
+++ b/Makefile
@@ -951,6 +951,12 @@ else
 SPL_SIZE_CHECK =
 endif
 
+ifneq ($(CONFIG_UBOOT_WITH_SPL_SIZE_LIMIT),0x0)
+UBOOT_WITH_SPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_UBOOT_WITH_SPL_SIZE_LIMIT))
+else
+UBOOT_WITH_SPL_SIZE_CHECK =
+endif
+
 ifneq ($(CONFIG_TPL_SIZE_LIMIT),0x0)
 TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
 else
@@ -1535,6 +1541,7 @@ OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
 				   --pad-to=$(CONFIG_SPL_PAD_TO)
 u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE
 	$(call if_changed,pad_cat)
+	$(UBOOT_WITH_SPL_SIZE_CHECK)
 
 ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy)
 MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE)
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 77cf04d38ed..ace2002023a 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -36,6 +36,13 @@ config SPL_FRAMEWORK_BOARD_INIT_F
 	  - initialize the serial (preloader_console_init)
 	  Unless you want to provide your own board_init_f, you should say Y.
 
+config UBOOT_WITH_SPL_SIZE_LIMIT
+	hex "Maximum size of u-boot-with-spl.bin"
+	default 0x0
+	help
+	  Specifies the maximum length of the u-boot-with-spl.bin image.
+	  If this value is zero, it is ignored.
+
 config SPL_SIZE_LIMIT
 	hex "Maximum size of SPL image"
 	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
-- 
2.39.5



More information about the U-Boot mailing list