[PATCH v5 2/4] Makefile: Add size check for u-boot-with-spl.bin

Philip Oberfichtner pro at denx.de
Wed Jul 30 14:38:31 CEST 2025


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

Note that we cannot reuse BOARD_SIZE_LIMIT here, as this also applies to
intermediate u-boot*bin images, which, before being compressed, may be
larger than the final combined image.

Also SPL_SIZE_LIMIT has to be a separate option, as some boards might
just want to restrict SPL size while still allowing u-boot-with-spl.bin
to be bigger.

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

Notes:
    Changes in v5:
    	- Fix for broken boards reported in v4
    	- See https://patchwork.ozlabs.org/project/uboot/patch/20250708103959.26129-2-pro@denx.de/
    
    Changes in v4: none
    
    Changes in v3:
    	Reuse existing SPL_SIZE_LIMIT instead of implementing a new option
    
    Changes in v2: none

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

diff --git a/Makefile b/Makefile
index aefa44c327f..e10d75384bf 100644
--- a/Makefile
+++ b/Makefile
@@ -1716,6 +1716,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)
+	@$(call size_check,$@,$(CONFIG_UBOOT_WITH_SPL_SIZE_LIMIT))
 
 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 ab05536bd02..b5c0c60ff6b 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