All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/3] Harmonize image size checks
@ 2025-11-10  9:12 Philip Oberfichtner
  2025-11-10  9:12 ` [PATCH v5 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently Philip Oberfichtner
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Philip Oberfichtner @ 2025-11-10  9:12 UTC (permalink / raw)
  To: u-boot
  Cc: Philip Oberfichtner, Andre Przywara, Anshul Dalal, Dario Binacchi,
	Greg Malysa, Heinrich Schuchardt, Ilias Apalodimas,
	Jerome Forissier, Marek Vasut, Nathan Barrett-Morrison, Peng Fan,
	Simon Glass, Tom Rini, Trevor Woerner, Ye Li

This patch series aims at harmonizing image size checks, which are
currently represented by the following Kconfig symbols:

	CONFIG_HAS_BOARD_SIZE_LIMIT
	CONFIG_BOARD_SIZE_LIMIT
	CONFIG_SPL_SIZE_LIMIT
	CONFIG_TPL_SIZE_LIMIT
	CONFIG_VPL_SIZE_LIMIT

After this series, we would have
	- Consistent logic
	- Consistent help texts
	- Less code duplication in the toplevel Makefile

Changes in v5:
	- Minor style improvements

Changes in v4:
	- Minimize the number of defconfig changes
	- Drop patch "Simplify SPL_SIZE_LIMIT logic"
	- Drop patch "Move all configs in one place"
	- Improve help texts
	- Use XXX_HAS_SIZE_LIMIT in the Makefile code
	- Move "default y" statements to the respective main Kconfigs

Changes in v3:
	V3 is a complete remake of the series. In the discussions on V2 we
	decided to follow the approach of using CONFIG_HAS_XXX_SIZE_LIMIT
	instead of my initial proposal, which was to disable a size check
	by setting its limit to zero.

Changes in v2:
	- Rebase on current master
	- Rebase on my pending mips patch series (linked above)
	- Incorporated Heinrich's Review

Philip Oberfichtner (3):
  Image size checks: Use HAS_SIZE_LIMIT consistently
  Image size checks: Clarify help texts
  Makefile: Deduplicate image size checks

 Kconfig                               | 10 +++---
 Makefile                              | 48 ++++++++-------------------
 arch/arm/mach-socfpga/Kconfig         |  6 ----
 arch/mips/mach-mtmips/Kconfig         |  3 --
 arch/x86/cpu/apollolake/Kconfig       |  3 --
 common/spl/Kconfig                    | 29 ++++++++++++----
 common/spl/Kconfig.tpl                | 15 ++++++---
 common/spl/Kconfig.vpl                | 13 +++++---
 configs/am64x_evm_r5_defconfig        |  1 +
 configs/am65x_evm_r5_defconfig        |  1 +
 configs/am65x_evm_r5_usbmsc_defconfig |  1 +
 configs/brcp150_defconfig             |  1 +
 configs/brcp170_defconfig             |  1 +
 configs/brcp1_1r_defconfig            |  1 +
 configs/brcp1_1r_switch_defconfig     |  1 +
 configs/brcp1_2r_defconfig            |  1 +
 configs/brsmarc2_defconfig            |  1 +
 configs/evb-ast2600_defconfig         |  1 +
 configs/evb-rk3288_defconfig          |  1 +
 configs/firefly-rk3288_defconfig      |  1 +
 configs/ibex-ast2700_defconfig        |  1 +
 configs/ibm-sbp1_defconfig            |  1 +
 configs/imx28_btt3_defconfig          |  1 +
 configs/imx28_xea_defconfig           |  1 +
 configs/imxrt1020-evk_defconfig       |  1 +
 configs/imxrt1050-evk_defconfig       |  1 +
 configs/imxrt1050-evk_fspi_defconfig  |  1 +
 configs/imxrt1170-evk_defconfig       |  1 +
 configs/kontron_sl28_defconfig        |  1 +
 configs/phycore_am64x_r5_defconfig    |  1 +
 configs/stm32746g-eval_spl_defconfig  |  1 +
 configs/stm32f746-disco_spl_defconfig |  1 +
 configs/stm32f769-disco_spl_defconfig |  1 +
 configs/tinker-rk3288_defconfig       |  1 +
 configs/tinker-s-rk3288_defconfig     |  1 +
 configs/verdin-am62p_a53_defconfig    |  1 +
 configs/xilinx_mbv32_defconfig        |  1 +
 configs/xilinx_zynqmp_kria_defconfig  |  1 +
 configs/xilinx_zynqmp_virt_defconfig  |  1 +
 39 files changed, 91 insertions(+), 67 deletions(-)

-- 
2.39.5


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v5 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently
  2025-11-10  9:12 [PATCH v5 0/3] Harmonize image size checks Philip Oberfichtner
@ 2025-11-10  9:12 ` Philip Oberfichtner
  2025-12-31 21:27   ` Marek Vasut
  2025-11-10  9:12 ` [PATCH v5 2/3] Image size checks: Clarify help texts Philip Oberfichtner
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Philip Oberfichtner @ 2025-11-10  9:12 UTC (permalink / raw)
  To: u-boot
  Cc: Philip Oberfichtner, Andre Przywara, Anshul Dalal, Dario Binacchi,
	Greg Malysa, Heinrich Schuchardt, Ilias Apalodimas,
	Jerome Forissier, Marek Vasut, Nathan Barrett-Morrison, Peng Fan,
	Simon Glass, Tom Rini, Trevor Woerner, Ye Li

Use a consistent logic for image size checks. No functional change.

Before this commit, there were two concurrent approaches of how image
size checks are disabled: Whereas BOARD_SIZE_LIMIT was gated through a
dedicated Kconfig symbol to achieve this, all the other size checks were
disabled by assigning them a limit of zero bytes.

By this commit we achieve a consistent logic for size limiting, by
introducing CONFIG_HAS_XXX_SIZE_LIMIT for all those options that don't
have it yet.

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

Notes:
    Changes in v5: Use HAS_XXX_SIZE_LIMIT in the ifeq-statements of the Makefile

 Makefile                              |  8 ++++----
 arch/arm/mach-socfpga/Kconfig         |  6 ------
 arch/mips/mach-mtmips/Kconfig         |  3 ---
 arch/x86/cpu/apollolake/Kconfig       |  3 ---
 common/spl/Kconfig                    | 23 +++++++++++++++++++----
 common/spl/Kconfig.tpl                |  9 ++++++++-
 common/spl/Kconfig.vpl                |  7 ++++++-
 configs/am64x_evm_r5_defconfig        |  1 +
 configs/am65x_evm_r5_defconfig        |  1 +
 configs/am65x_evm_r5_usbmsc_defconfig |  1 +
 configs/brcp150_defconfig             |  1 +
 configs/brcp170_defconfig             |  1 +
 configs/brcp1_1r_defconfig            |  1 +
 configs/brcp1_1r_switch_defconfig     |  1 +
 configs/brcp1_2r_defconfig            |  1 +
 configs/brsmarc2_defconfig            |  1 +
 configs/evb-ast2600_defconfig         |  1 +
 configs/evb-rk3288_defconfig          |  1 +
 configs/firefly-rk3288_defconfig      |  1 +
 configs/ibex-ast2700_defconfig        |  1 +
 configs/ibm-sbp1_defconfig            |  1 +
 configs/imx28_btt3_defconfig          |  1 +
 configs/imx28_xea_defconfig           |  1 +
 configs/imxrt1020-evk_defconfig       |  1 +
 configs/imxrt1050-evk_defconfig       |  1 +
 configs/imxrt1050-evk_fspi_defconfig  |  1 +
 configs/imxrt1170-evk_defconfig       |  1 +
 configs/kontron_sl28_defconfig        |  1 +
 configs/phycore_am64x_r5_defconfig    |  1 +
 configs/stm32746g-eval_spl_defconfig  |  1 +
 configs/stm32f746-disco_spl_defconfig |  1 +
 configs/stm32f769-disco_spl_defconfig |  1 +
 configs/tinker-rk3288_defconfig       |  1 +
 configs/tinker-s-rk3288_defconfig     |  1 +
 configs/verdin-am62p_a53_defconfig    |  1 +
 configs/xilinx_mbv32_defconfig        |  1 +
 configs/xilinx_zynqmp_kria_defconfig  |  1 +
 configs/xilinx_zynqmp_virt_defconfig  |  1 +
 38 files changed, 68 insertions(+), 22 deletions(-)

diff --git a/Makefile b/Makefile
index 62a24e38283..617106ad79e 100644
--- a/Makefile
+++ b/Makefile
@@ -1104,25 +1104,25 @@ LDPPFLAGS += \
 #########################################################################
 #########################################################################
 
-ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
+ifeq ($(CONFIG_HAS_BOARD_SIZE_LIMIT),y)
 BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
 else
 BOARD_SIZE_CHECK =
 endif
 
-ifneq ($(CONFIG_SPL_SIZE_LIMIT),0x0)
+ifeq ($(CONFIG_HAS_SPL_SIZE_LIMIT),y)
 SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit))
 else
 SPL_SIZE_CHECK =
 endif
 
-ifneq ($(CONFIG_TPL_SIZE_LIMIT),0x0)
+ifeq ($(CONFIG_HAS_TPL_SIZE_LIMIT),y)
 TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
 else
 TPL_SIZE_CHECK =
 endif
 
-ifneq ($(CONFIG_VPL_SIZE_LIMIT),0x0)
+ifeq ($(CONFIG_HAS_VPL_SIZE_LIMIT),y)
 VPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_VPL_SIZE_LIMIT))
 else
 VPL_SIZE_CHECK =
diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig
index f2e959b5662..db00ada25ee 100644
--- a/arch/arm/mach-socfpga/Kconfig
+++ b/arch/arm/mach-socfpga/Kconfig
@@ -22,12 +22,6 @@ config SOCFPGA_SECURE_VAB_AUTH_ALLOW_NON_FIT_IMAGE
 	bool "Allow non-FIT VAB signed images"
 	depends on SOCFPGA_SECURE_VAB_AUTH
 
-config SPL_SIZE_LIMIT
-	default 0x10000 if TARGET_SOCFPGA_GEN5
-
-config SPL_SIZE_LIMIT_PROVIDE_STACK
-	default 0x200 if TARGET_SOCFPGA_GEN5
-
 config SPL_STACK_R_ADDR
 	default 0x00800000 if TARGET_SOCFPGA_GEN5
 
diff --git a/arch/mips/mach-mtmips/Kconfig b/arch/mips/mach-mtmips/Kconfig
index 3fcd0b8465b..49fc499e744 100644
--- a/arch/mips/mach-mtmips/Kconfig
+++ b/arch/mips/mach-mtmips/Kconfig
@@ -36,9 +36,6 @@ config SPL_TEXT_BASE
 	default 0x9c000000 if !SOC_MT7621
 	default 0x80100000 if SOC_MT7621
 
-config SPL_SIZE_LIMIT
-	default 0x30000 if SOC_MT7621
-
 config TPL_TEXT_BASE
 	default 0xbfc00000 if SOC_MT7621
 
diff --git a/arch/x86/cpu/apollolake/Kconfig b/arch/x86/cpu/apollolake/Kconfig
index 5dd866ffcfe..fe15353fca6 100644
--- a/arch/x86/cpu/apollolake/Kconfig
+++ b/arch/x86/cpu/apollolake/Kconfig
@@ -78,9 +78,6 @@ config MMCONF_BASE_ADDRESS
 	hex
 	default 0xe0000000
 
-config TPL_SIZE_LIMIT
-	default 0x7800
-
 config CPU_ADDR_BITS
 	default 39
 
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 8dade2b501e..97c7bfdad47 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -36,19 +36,33 @@ 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 HAS_SPL_SIZE_LIMIT
+	bool "Enable size limit check for the SPL image"
+	depends on !COMPILE_TEST
+	depends on SPL
+	default y if ARCH_MX6
+	default y if ARCH_MVEBU && ARMADA_32BIT
+	default y if ARMADA_38X
+	default y if K3_DM_FW
+	default y if SOC_K3_AM625
+	default y if SOC_MT7621
+	default y if TARGET_SOCFPGA_GEN5
+
 config SPL_SIZE_LIMIT
 	hex "Maximum size of SPL image"
+	depends on HAS_SPL_SIZE_LIMIT
 	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
 	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
 	default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
-	default 0x0
+	default 0x30000 if SOC_MT7621
+	default 0x10000 if TARGET_SOCFPGA_GEN5
 	help
 	  Specifies the maximum length of the U-Boot SPL image.
 	  If this value is zero, it is ignored.
 
 config SPL_SIZE_LIMIT_SUBTRACT_GD
 	bool "SPL image size check: provide space for global data"
-	depends on SPL_SIZE_LIMIT > 0
+	depends on HAS_SPL_SIZE_LIMIT
 	help
 	  If enabled, aligned size of global data is reserved in
 	  SPL_SIZE_LIMIT check to ensure such an image does not overflow SRAM
@@ -57,7 +71,7 @@ config SPL_SIZE_LIMIT_SUBTRACT_GD
 
 config SPL_SIZE_LIMIT_SUBTRACT_MALLOC
 	bool "SPL image size check: provide space for malloc() pool before relocation"
-	depends on SPL_SIZE_LIMIT > 0
+	depends on HAS_SPL_SIZE_LIMIT
 	help
 	  If enabled, SPL_SYS_MALLOC_F_LEN is reserved in SPL_SIZE_LIMIT check
 	  to ensure such an image does not overflow SRAM if SPL_SIZE_LIMIT
@@ -66,7 +80,8 @@ config SPL_SIZE_LIMIT_SUBTRACT_MALLOC
 
 config SPL_SIZE_LIMIT_PROVIDE_STACK
 	hex "SPL image size check: provide stack space before relocation"
-	depends on SPL_SIZE_LIMIT > 0
+	depends on HAS_SPL_SIZE_LIMIT
+	default 0x200 if TARGET_SOCFPGA_GEN5
 	default 0x0
 	help
 	  If set, this size is reserved in SPL_SIZE_LIMIT check to ensure such
diff --git a/common/spl/Kconfig.tpl b/common/spl/Kconfig.tpl
index a535b61ecd3..82ed0a06c89 100644
--- a/common/spl/Kconfig.tpl
+++ b/common/spl/Kconfig.tpl
@@ -1,9 +1,16 @@
 menu "TPL configuration options"
 	depends on TPL
 
+config HAS_TPL_SIZE_LIMIT
+	bool "Enable size limit check for the TPL image"
+	depends on !COMPILE_TEST
+	depends on TPL
+	default y if INTEL_APOLLOLAKE
+
 config TPL_SIZE_LIMIT
 	hex "Maximum size of TPL image"
-	default 0x0
+	depends on HAS_TPL_SIZE_LIMIT
+	default 0x7800 if INTEL_APOLLOLAKE
 	help
 	  Specifies the maximum length of the U-Boot TPL image.
 	  If this value is zero, it is ignored.
diff --git a/common/spl/Kconfig.vpl b/common/spl/Kconfig.vpl
index 434562443ac..1945fa22b6b 100644
--- a/common/spl/Kconfig.vpl
+++ b/common/spl/Kconfig.vpl
@@ -220,9 +220,14 @@ config VPL_SERIAL
 	  Enable support for serial in VPL. See SPL_SERIAL for
 	  details.
 
+config HAS_VPL_SIZE_LIMIT
+	bool "Enable size limit check for the VPL image"
+	depends on !COMPILE_TEST
+	depends on VPL
+
 config VPL_SIZE_LIMIT
 	hex "Maximum size of VPL image"
-	default 0x0
+	depends on HAS_VPL_SIZE_LIMIT
 	help
 	  Specifies the maximum length of the U-Boot VPL image.
 	  If this value is zero, it is ignored.
diff --git a/configs/am64x_evm_r5_defconfig b/configs/am64x_evm_r5_defconfig
index a675ea84fca..e060ba81147 100644
--- a/configs/am64x_evm_r5_defconfig
+++ b/configs/am64x_evm_r5_defconfig
@@ -24,6 +24,7 @@ CONFIG_SPL_BSS_START_ADDR=0x7019b800
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x400000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x190000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000
 CONFIG_SPL_FS_FAT=y
diff --git a/configs/am65x_evm_r5_defconfig b/configs/am65x_evm_r5_defconfig
index 6733dcfdd85..8d368ce9f19 100644
--- a/configs/am65x_evm_r5_defconfig
+++ b/configs/am65x_evm_r5_defconfig
@@ -23,6 +23,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x41c7effc
 CONFIG_SPL_BSS_MAX_SIZE=0xc00
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x7ec00
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x2000
 CONFIG_SPL_FS_FAT=y
diff --git a/configs/am65x_evm_r5_usbmsc_defconfig b/configs/am65x_evm_r5_usbmsc_defconfig
index 37b5c6a43e7..df4c1faae96 100644
--- a/configs/am65x_evm_r5_usbmsc_defconfig
+++ b/configs/am65x_evm_r5_usbmsc_defconfig
@@ -21,6 +21,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x41c7effc
 CONFIG_SPL_BSS_MAX_SIZE=0xc00
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x7ec00
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x2000
 CONFIG_SPL_FS_FAT=y
diff --git a/configs/brcp150_defconfig b/configs/brcp150_defconfig
index bae185e8126..82402f33bdf 100644
--- a/configs/brcp150_defconfig
+++ b/configs/brcp150_defconfig
@@ -25,6 +25,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x600000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x2000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x30000
diff --git a/configs/brcp170_defconfig b/configs/brcp170_defconfig
index f8e17ece276..e3a42aeb1cb 100644
--- a/configs/brcp170_defconfig
+++ b/configs/brcp170_defconfig
@@ -25,6 +25,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x600000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x2000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x30000
diff --git a/configs/brcp1_1r_defconfig b/configs/brcp1_1r_defconfig
index 568313d4860..77f5866b53f 100644
--- a/configs/brcp1_1r_defconfig
+++ b/configs/brcp1_1r_defconfig
@@ -25,6 +25,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x600000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x2000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x30000
diff --git a/configs/brcp1_1r_switch_defconfig b/configs/brcp1_1r_switch_defconfig
index 805de796df6..563df86d6b0 100644
--- a/configs/brcp1_1r_switch_defconfig
+++ b/configs/brcp1_1r_switch_defconfig
@@ -25,6 +25,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x600000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x2000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x30000
diff --git a/configs/brcp1_2r_defconfig b/configs/brcp1_2r_defconfig
index e92d8381bbb..09255ab111a 100644
--- a/configs/brcp1_2r_defconfig
+++ b/configs/brcp1_2r_defconfig
@@ -25,6 +25,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x600000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x2000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x30000
diff --git a/configs/brsmarc2_defconfig b/configs/brsmarc2_defconfig
index 2ed54817af4..b460ee11ea6 100644
--- a/configs/brsmarc2_defconfig
+++ b/configs/brsmarc2_defconfig
@@ -27,6 +27,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x600000
 CONFIG_SYS_BOOTM_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x2000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x30000
diff --git a/configs/evb-ast2600_defconfig b/configs/evb-ast2600_defconfig
index 16e8a58ccc0..393ed3e1873 100644
--- a/configs/evb-ast2600_defconfig
+++ b/configs/evb-ast2600_defconfig
@@ -26,6 +26,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x1000000
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x83000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x10000
 CONFIG_SPL=y
 # CONFIG_ARMV7_NONSEC is not set
diff --git a/configs/evb-rk3288_defconfig b/configs/evb-rk3288_defconfig
index 02347b58c22..3f8bb365cde 100644
--- a/configs/evb-rk3288_defconfig
+++ b/configs/evb-rk3288_defconfig
@@ -20,6 +20,7 @@ CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x800800
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x4b000
 CONFIG_DEBUG_UART_BASE=0xff690000
 CONFIG_DEBUG_UART_CLOCK=24000000
diff --git a/configs/firefly-rk3288_defconfig b/configs/firefly-rk3288_defconfig
index d7b01e67db9..35ade7f99a3 100644
--- a/configs/firefly-rk3288_defconfig
+++ b/configs/firefly-rk3288_defconfig
@@ -13,6 +13,7 @@ CONFIG_ROCKCHIP_RK3288=y
 CONFIG_TARGET_FIREFLY_RK3288=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x800800
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x40000
 CONFIG_DEBUG_UART_BASE=0xff690000
 CONFIG_DEBUG_UART_CLOCK=24000000
diff --git a/configs/ibex-ast2700_defconfig b/configs/ibex-ast2700_defconfig
index 088eec1ec70..19aec40f4f6 100644
--- a/configs/ibex-ast2700_defconfig
+++ b/configs/ibex-ast2700_defconfig
@@ -16,6 +16,7 @@ CONFIG_SPL_TEXT_BASE=0x14bc0080
 CONFIG_SPL_BSS_START_ADDR=0x14bd7800
 CONFIG_SPL_BSS_MAX_SIZE=0x800
 CONFIG_SYS_LOAD_ADDR=0x83000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x16000
 CONFIG_SPL=y
 CONFIG_SYS_MEM_TOP_HIDE=0x10000000
diff --git a/configs/ibm-sbp1_defconfig b/configs/ibm-sbp1_defconfig
index 5f16301e5b5..26420c6f831 100644
--- a/configs/ibm-sbp1_defconfig
+++ b/configs/ibm-sbp1_defconfig
@@ -24,6 +24,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x1000000
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000000
 CONFIG_SYS_LOAD_ADDR=0x83000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x10000
 CONFIG_SPL=y
 # CONFIG_ARMV7_NONSEC is not set
diff --git a/configs/imx28_btt3_defconfig b/configs/imx28_btt3_defconfig
index 6516350e4c3..02c2e28ef26 100644
--- a/configs/imx28_btt3_defconfig
+++ b/configs/imx28_btt3_defconfig
@@ -25,6 +25,7 @@ CONFIG_SPL_SYS_MALLOC_F_LEN=0x1000
 CONFIG_SPL_TEXT_BASE=0x1000
 CONFIG_SYS_LOAD_ADDR=0x42000000
 CONFIG_SF_DEFAULT_BUS=2
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0xa000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x90000
diff --git a/configs/imx28_xea_defconfig b/configs/imx28_xea_defconfig
index 7e4956090ea..160045c5e30 100644
--- a/configs/imx28_xea_defconfig
+++ b/configs/imx28_xea_defconfig
@@ -23,6 +23,7 @@ CONFIG_SPL_SYS_MALLOC_F_LEN=0x1000
 CONFIG_SPL_TEXT_BASE=0x1000
 CONFIG_SYS_LOAD_ADDR=0x42000000
 CONFIG_SF_DEFAULT_BUS=2
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0xa000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x90000
diff --git a/configs/imxrt1020-evk_defconfig b/configs/imxrt1020-evk_defconfig
index 17c650e6950..7fc6afafc1b 100644
--- a/configs/imxrt1020-evk_defconfig
+++ b/configs/imxrt1020-evk_defconfig
@@ -17,6 +17,7 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_TEXT_BASE=0x20209000
 CONFIG_SYS_LOAD_ADDR=0x20209000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_HAVE_SYS_UBOOT_START=y
diff --git a/configs/imxrt1050-evk_defconfig b/configs/imxrt1050-evk_defconfig
index 5faf964759d..6ba608f20a4 100644
--- a/configs/imxrt1050-evk_defconfig
+++ b/configs/imxrt1050-evk_defconfig
@@ -19,6 +19,7 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_TEXT_BASE=0x20002000
 CONFIG_SYS_LOAD_ADDR=0x20002000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_HAVE_SYS_UBOOT_START=y
diff --git a/configs/imxrt1050-evk_fspi_defconfig b/configs/imxrt1050-evk_fspi_defconfig
index cc7e8a3e10b..7d6a41403fc 100644
--- a/configs/imxrt1050-evk_fspi_defconfig
+++ b/configs/imxrt1050-evk_fspi_defconfig
@@ -21,6 +21,7 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_TEXT_BASE=0x20002000
 CONFIG_SYS_LOAD_ADDR=0x20002000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_HAVE_SYS_UBOOT_START=y
diff --git a/configs/imxrt1170-evk_defconfig b/configs/imxrt1170-evk_defconfig
index 9bd3874143c..4f7e6104c78 100644
--- a/configs/imxrt1170-evk_defconfig
+++ b/configs/imxrt1170-evk_defconfig
@@ -19,6 +19,7 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_TEXT_BASE=0x202C0000
 CONFIG_SYS_LOAD_ADDR=0x202C0000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_HAVE_SYS_UBOOT_START=y
diff --git a/configs/kontron_sl28_defconfig b/configs/kontron_sl28_defconfig
index e97534ecc0a..cb57538b597 100644
--- a/configs/kontron_sl28_defconfig
+++ b/configs/kontron_sl28_defconfig
@@ -24,6 +24,7 @@ CONFIG_SPL_BSS_START_ADDR=0x80100000
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 CONFIG_SYS_BOOTM_LEN=0x800000
 CONFIG_SYS_LOAD_ADDR=0x82000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x20000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x3f0000
diff --git a/configs/phycore_am64x_r5_defconfig b/configs/phycore_am64x_r5_defconfig
index d8117b1c1ae..8716b8f3cbd 100644
--- a/configs/phycore_am64x_r5_defconfig
+++ b/configs/phycore_am64x_r5_defconfig
@@ -26,6 +26,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_START_ADDR=0x7019b800
 CONFIG_SPL_BSS_MAX_SIZE=0x4000
 CONFIG_SPL_STACK_R=y
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x190000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000
 CONFIG_SPL_FS_FAT=y
diff --git a/configs/stm32746g-eval_spl_defconfig b/configs/stm32746g-eval_spl_defconfig
index 432d35d0d5a..5ce93a34b9e 100644
--- a/configs/stm32746g-eval_spl_defconfig
+++ b/configs/stm32746g-eval_spl_defconfig
@@ -16,6 +16,7 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_TEXT_BASE=0x8000000
 CONFIG_SYS_LOAD_ADDR=0x8009000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x9000
 CONFIG_STM32F7=y
 CONFIG_TARGET_STM32F746_DISCO=y
diff --git a/configs/stm32f746-disco_spl_defconfig b/configs/stm32f746-disco_spl_defconfig
index 699ae9d08fc..b629c5eeefd 100644
--- a/configs/stm32f746-disco_spl_defconfig
+++ b/configs/stm32f746-disco_spl_defconfig
@@ -16,6 +16,7 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_TEXT_BASE=0x8000000
 CONFIG_SYS_LOAD_ADDR=0x8009000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x9000
 CONFIG_STM32F7=y
 CONFIG_TARGET_STM32F746_DISCO=y
diff --git a/configs/stm32f769-disco_spl_defconfig b/configs/stm32f769-disco_spl_defconfig
index 74210fe8252..f82bcd9d937 100644
--- a/configs/stm32f769-disco_spl_defconfig
+++ b/configs/stm32f769-disco_spl_defconfig
@@ -16,6 +16,7 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_TEXT_BASE=0x8000000
 CONFIG_SYS_LOAD_ADDR=0x8009000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x9000
 CONFIG_STM32F7=y
 CONFIG_TARGET_STM32F746_DISCO=y
diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
index afbb394228f..9c56fe10bfd 100644
--- a/configs/tinker-rk3288_defconfig
+++ b/configs/tinker-rk3288_defconfig
@@ -12,6 +12,7 @@ CONFIG_ROCKCHIP_RK3288=y
 CONFIG_TARGET_TINKER_RK3288=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x800800
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x4b000
 CONFIG_DEBUG_UART_BASE=0xff690000
 CONFIG_DEBUG_UART_CLOCK=24000000
diff --git a/configs/tinker-s-rk3288_defconfig b/configs/tinker-s-rk3288_defconfig
index 876086573d3..2f830eb8c88 100644
--- a/configs/tinker-s-rk3288_defconfig
+++ b/configs/tinker-s-rk3288_defconfig
@@ -12,6 +12,7 @@ CONFIG_ROCKCHIP_RK3288=y
 CONFIG_TARGET_TINKER_RK3288=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x800800
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x4b000
 CONFIG_DEBUG_UART_BASE=0xff690000
 CONFIG_DEBUG_UART_CLOCK=24000000
diff --git a/configs/verdin-am62p_a53_defconfig b/configs/verdin-am62p_a53_defconfig
index dd032427987..6c3ef4a8762 100644
--- a/configs/verdin-am62p_a53_defconfig
+++ b/configs/verdin-am62p_a53_defconfig
@@ -24,6 +24,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_STACK_R=y
 CONFIG_SYS_BOOTM_LEN=0x40000000
 CONFIG_SYS_LOAD_ADDR=0x88200000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x80000
 CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x800
 CONFIG_SYS_MEMTEST_START=0x80000000
diff --git a/configs/xilinx_mbv32_defconfig b/configs/xilinx_mbv32_defconfig
index 88d9e5ce6b2..46d5a2eae0e 100644
--- a/configs/xilinx_mbv32_defconfig
+++ b/configs/xilinx_mbv32_defconfig
@@ -10,6 +10,7 @@ CONFIG_SPL_BSS_START_ADDR=0x84000000
 CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SYS_BOOTM_LEN=0x800000
 CONFIG_SYS_LOAD_ADDR=0x80200000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x40000
 CONFIG_SPL=y
 CONFIG_DEBUG_UART_BASE=0x40600000
diff --git a/configs/xilinx_zynqmp_kria_defconfig b/configs/xilinx_zynqmp_kria_defconfig
index 8ad05e37189..95c2eb07fef 100644
--- a/configs/xilinx_zynqmp_kria_defconfig
+++ b/configs/xilinx_zynqmp_kria_defconfig
@@ -19,6 +19,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_STACK_R=y
 CONFIG_SYS_BOOTM_LEN=0x6400000
 CONFIG_SYS_LOAD_ADDR=0x8000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x2a000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x2220000
diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig
index 525744b0f61..584cbf52281 100644
--- a/configs/xilinx_zynqmp_virt_defconfig
+++ b/configs/xilinx_zynqmp_virt_defconfig
@@ -14,6 +14,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x80000
 CONFIG_SPL_STACK_R=y
 CONFIG_SYS_BOOTM_LEN=0x6400000
 CONFIG_SYS_LOAD_ADDR=0x8000000
+CONFIG_HAS_SPL_SIZE_LIMIT=y
 CONFIG_SPL_SIZE_LIMIT=0x2a000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x1E80000
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v5 2/3] Image size checks: Clarify help texts
  2025-11-10  9:12 [PATCH v5 0/3] Harmonize image size checks Philip Oberfichtner
  2025-11-10  9:12 ` [PATCH v5 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently Philip Oberfichtner
@ 2025-11-10  9:12 ` Philip Oberfichtner
  2025-12-31 21:20   ` Marek Vasut
  2025-11-10  9:12 ` [PATCH v5 3/3] Makefile: Deduplicate image size checks Philip Oberfichtner
  2025-12-01 18:30 ` [PATCH v5 0/3] Harmonize " Philip Oberfichtner
  3 siblings, 1 reply; 11+ messages in thread
From: Philip Oberfichtner @ 2025-11-10  9:12 UTC (permalink / raw)
  To: u-boot
  Cc: Philip Oberfichtner, Andre Przywara, Anshul Dalal, Dario Binacchi,
	Greg Malysa, Heinrich Schuchardt, Ilias Apalodimas,
	Jerome Forissier, Marek Vasut, Nathan Barrett-Morrison, Peng Fan,
	Simon Glass, Tom Rini, Trevor Woerner, Ye Li

Adapt help texts for CONFIG_XXX_SIZE_LIMITs to their new logic.

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

Notes:
    Changes in v5: Polish help texts

 Kconfig                | 10 +++++-----
 common/spl/Kconfig     |  6 +++---
 common/spl/Kconfig.tpl |  6 +++---
 common/spl/Kconfig.vpl |  6 +++---
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/Kconfig b/Kconfig
index 1d600342685..10c3e49de0e 100644
--- a/Kconfig
+++ b/Kconfig
@@ -537,7 +537,7 @@ config BUILD_TARGET
 	  make / buildman.
 
 config HAS_BOARD_SIZE_LIMIT
-	bool "Define a maximum size for the U-Boot image"
+	bool "Enable size limit check for the U-Boot image"
 	depends on !COMPILE_TEST
 	default y if RCAR_32 || RCAR_64
 	help
@@ -550,10 +550,10 @@ config BOARD_SIZE_LIMIT
 	default 1048576 if RCAR_64
 	depends on HAS_BOARD_SIZE_LIMIT
 	help
-	  Maximum size of the U-Boot image. When defined, the build system
-	  checks that the actual size does not exceed it.  This does not
-	  include SPL nor TPL, on platforms that use that functionality, they
-	  have separate options to restrict size.
+	  Maximum size of the U-Boot image. The build system checks that the
+	  actual image size does not exceed this value. This does not include
+	  SPL nor TPL, on platforms that use that functionality, they have
+	  separate options to restrict size.
 
 config SYS_CUSTOM_LDSCRIPT
 	bool "Use a custom location for the U-Boot linker script"
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 97c7bfdad47..0cabc4e8019 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -49,7 +49,7 @@ config HAS_SPL_SIZE_LIMIT
 	default y if TARGET_SOCFPGA_GEN5
 
 config SPL_SIZE_LIMIT
-	hex "Maximum size of SPL image"
+	hex "Maximum size of SPL image in bytes"
 	depends on HAS_SPL_SIZE_LIMIT
 	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
 	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
@@ -57,8 +57,8 @@ config SPL_SIZE_LIMIT
 	default 0x30000 if SOC_MT7621
 	default 0x10000 if TARGET_SOCFPGA_GEN5
 	help
-	  Specifies the maximum length of the U-Boot SPL image.
-	  If this value is zero, it is ignored.
+	  Maximum size of the SPL image. The build system checks that the
+	  actual image size does not exceed this value.
 
 config SPL_SIZE_LIMIT_SUBTRACT_GD
 	bool "SPL image size check: provide space for global data"
diff --git a/common/spl/Kconfig.tpl b/common/spl/Kconfig.tpl
index 82ed0a06c89..87aaf1132e6 100644
--- a/common/spl/Kconfig.tpl
+++ b/common/spl/Kconfig.tpl
@@ -8,12 +8,12 @@ config HAS_TPL_SIZE_LIMIT
 	default y if INTEL_APOLLOLAKE
 
 config TPL_SIZE_LIMIT
-	hex "Maximum size of TPL image"
+	hex "Maximum size of TPL image in bytes"
 	depends on HAS_TPL_SIZE_LIMIT
 	default 0x7800 if INTEL_APOLLOLAKE
 	help
-	  Specifies the maximum length of the U-Boot TPL image.
-	  If this value is zero, it is ignored.
+	  Maximum size of the TPL image. The build system checks that the
+	  actual image size does not exceed this value.
 
 config TPL_BINMAN_SYMBOLS
 	bool "Support binman symbols in TPL"
diff --git a/common/spl/Kconfig.vpl b/common/spl/Kconfig.vpl
index 1945fa22b6b..67ecd78a225 100644
--- a/common/spl/Kconfig.vpl
+++ b/common/spl/Kconfig.vpl
@@ -226,11 +226,11 @@ config HAS_VPL_SIZE_LIMIT
 	depends on VPL
 
 config VPL_SIZE_LIMIT
-	hex "Maximum size of VPL image"
+	hex "Maximum size of VPL image in bytes"
 	depends on HAS_VPL_SIZE_LIMIT
 	help
-	  Specifies the maximum length of the U-Boot VPL image.
-	  If this value is zero, it is ignored.
+	  Maximum size of the VPL image. The build system checks that the
+	  actual image size does not exceed this value.
 
 config VPL_SPI
 	bool "Support SPI drivers"
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v5 3/3] Makefile: Deduplicate image size checks
  2025-11-10  9:12 [PATCH v5 0/3] Harmonize image size checks Philip Oberfichtner
  2025-11-10  9:12 ` [PATCH v5 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently Philip Oberfichtner
  2025-11-10  9:12 ` [PATCH v5 2/3] Image size checks: Clarify help texts Philip Oberfichtner
@ 2025-11-10  9:12 ` Philip Oberfichtner
  2025-12-31 21:25   ` Marek Vasut
  2025-12-01 18:30 ` [PATCH v5 0/3] Harmonize " Philip Oberfichtner
  3 siblings, 1 reply; 11+ messages in thread
From: Philip Oberfichtner @ 2025-11-10  9:12 UTC (permalink / raw)
  To: u-boot
  Cc: Philip Oberfichtner, Andre Przywara, Anshul Dalal, Dario Binacchi,
	Greg Malysa, Heinrich Schuchardt, Ilias Apalodimas,
	Jerome Forissier, Marek Vasut, Nathan Barrett-Morrison, Peng Fan,
	Simon Glass, Tom Rini, Trevor Woerner, Ye Li

Deduplicate some redundancies within the SIZE_CHECK code in the toplevel
Makefile. No functional changes.

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

Notes:
    Changes in v5: Improve commit message

 Makefile | 48 +++++++++++++-----------------------------------
 1 file changed, 13 insertions(+), 35 deletions(-)

diff --git a/Makefile b/Makefile
index 617106ad79e..423a86ff4e8 100644
--- a/Makefile
+++ b/Makefile
@@ -428,10 +428,12 @@ KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
 # Check ths size of a binary:
 # Args:
 #   $1: File to check
-#   #2: Size limit in bytes (decimal or 0xhex)
+#   $2: Always return OK if this is not "y".
+#   $3: Size limit in bytes (decimal or 0xhex)
 define size_check
+	test "$2" = "y" || exit 0; \
 	actual=$$( wc -c $1 | awk '{print $$1}'); \
-	limit=$$( printf "%d" $2 ); \
+	limit=$$( printf "%d" $3 ); \
 	if test $$actual -gt $$limit; then \
 		echo "$1 exceeds file size limit:" >&2; \
 		echo "  limit:  $$(printf %#x $$limit) bytes" >&2; \
@@ -1104,30 +1106,6 @@ LDPPFLAGS += \
 #########################################################################
 #########################################################################
 
-ifeq ($(CONFIG_HAS_BOARD_SIZE_LIMIT),y)
-BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
-else
-BOARD_SIZE_CHECK =
-endif
-
-ifeq ($(CONFIG_HAS_SPL_SIZE_LIMIT),y)
-SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit))
-else
-SPL_SIZE_CHECK =
-endif
-
-ifeq ($(CONFIG_HAS_TPL_SIZE_LIMIT),y)
-TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
-else
-TPL_SIZE_CHECK =
-endif
-
-ifeq ($(CONFIG_HAS_VPL_SIZE_LIMIT),y)
-VPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_VPL_SIZE_LIMIT))
-else
-VPL_SIZE_CHECK =
-endif
-
 # Statically apply RELA-style relocations (currently arm64 only)
 # This is useful for arm64 where static relocation needs to be performed on
 # the raw binary, but certain simulators only accept an ELF file (but don't
@@ -1471,7 +1449,7 @@ endif
 
 %.imx: $(IMX_DEPS) %.bin
 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
-	$(BOARD_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_HAS_BOARD_SIZE_LIMIT),$(CONFIG_BOARD_SIZE_LIMIT))
 
 %.vyb: %.imx
 	$(Q)$(MAKE) $(build)=arch/arm/cpu/armv7/vf610 $@
@@ -1572,11 +1550,11 @@ endif
 
 u-boot-nodtb.bin: u-boot FORCE
 	$(call if_changed,objcopy_uboot)
-	$(BOARD_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_HAS_BOARD_SIZE_LIMIT),$(CONFIG_BOARD_SIZE_LIMIT))
 
 u-boot.ldr:	u-boot
 		$(LDR) -T $(CONFIG_LDR_CPU) -c $@ $< $(LDR_FLAGS)
-		$(BOARD_SIZE_CHECK)
+		@$(call size_check,$@,$(CONFIG_HAS_BOARD_SIZE_LIMIT),$(CONFIG_BOARD_SIZE_LIMIT))
 
 # binman
 # ---------------------------------------------------------------------------
@@ -1703,7 +1681,7 @@ u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \
 			$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX),dts/dt.dtb) \
 		,$(UBOOT_BIN)) FORCE
 	$(call if_changed,mkimage)
-	$(BOARD_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_HAS_BOARD_SIZE_LIMIT),$(CONFIG_BOARD_SIZE_LIMIT))
 
 ifeq ($(CONFIG_SPL_LOAD_FIT_FULL),y)
 MKIMAGEFLAGS_u-boot.itb =
@@ -1718,12 +1696,12 @@ u-boot.itb: u-boot-nodtb.bin \
 		$(if $(CONFIG_MULTI_DTB_FIT),$(FINAL_DTB_CONTAINER)) \
 		$(U_BOOT_ITS) FORCE
 	$(call if_changed,mkfitimage)
-	$(BOARD_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_HAS_BOARD_SIZE_LIMIT),$(CONFIG_BOARD_SIZE_LIMIT))
 endif
 
 u-boot-with-spl.kwb: u-boot.bin spl/u-boot-spl.bin FORCE
 	$(call if_changed,mkimage)
-	$(BOARD_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_HAS_BOARD_SIZE_LIMIT),$(CONFIG_BOARD_SIZE_LIMIT))
 
 u-boot.dis:	u-boot
 		$(OBJDUMP) -d $< > $@
@@ -2347,7 +2325,7 @@ u-boot.lds: $(LDSCRIPT) prepare FORCE
 
 spl/u-boot-spl.bin: spl/u-boot-spl
 	@:
-	$(SPL_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_HAS_SPL_SIZE_LIMIT),$$(tools/spl_size_limit))
 
 spl/u-boot-spl-dtb.bin: spl/u-boot-spl
 	@:
@@ -2372,14 +2350,14 @@ spl/boot.bin: spl/u-boot-spl
 
 tpl/u-boot-tpl.bin: tpl/u-boot-tpl
 	@:
-	$(TPL_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_HAS_TPL_SIZE_LIMIT),$(CONFIG_TPL_SIZE_LIMIT))
 
 tpl/u-boot-tpl: tools prepare $(if $(CONFIG_TPL_OF_CONTROL),dts/dt.dtb)
 	$(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.xpl all
 
 vpl/u-boot-vpl.bin: vpl/u-boot-vpl
 	@:
-	$(VPL_SIZE_CHECK)
+	@$(call size_check,$@,$(CONFIG_HAS_VPL_SIZE_LIMIT),$(CONFIG_VPL_SIZE_LIMIT))
 
 vpl/u-boot-vpl: tools prepare $(if $(CONFIG_TPL_OF_CONTROL),dts/dt.dtb)
 	$(Q)$(MAKE) obj=vpl -f $(srctree)/scripts/Makefile.xpl all
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 0/3] Harmonize image size checks
  2025-11-10  9:12 [PATCH v5 0/3] Harmonize image size checks Philip Oberfichtner
                   ` (2 preceding siblings ...)
  2025-11-10  9:12 ` [PATCH v5 3/3] Makefile: Deduplicate image size checks Philip Oberfichtner
@ 2025-12-01 18:30 ` Philip Oberfichtner
  2025-12-01 18:37   ` Tom Rini
  3 siblings, 1 reply; 11+ messages in thread
From: Philip Oberfichtner @ 2025-12-01 18:30 UTC (permalink / raw)
  To: u-boot, Tom Rini
  Cc: Andre Przywara, Anshul Dalal, Dario Binacchi, Greg Malysa,
	Heinrich Schuchardt, Ilias Apalodimas, Jerome Forissier,
	Marek Vasut, Nathan Barrett-Morrison, Peng Fan, Simon Glass,
	Trevor Woerner, Ye Li

On Mon, Nov 10, 2025 at 10:12:53AM +0100, Philip Oberfichtner wrote:
> This patch series aims at harmonizing image size checks, 

Hi Tom,

I don't want to be impatient, just to make sure this one won't slip
through the cracks: What's the current status? Do we still have another
reviewer we're currently waiting for?

Thanks,
Philip

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 0/3] Harmonize image size checks
  2025-12-01 18:30 ` [PATCH v5 0/3] Harmonize " Philip Oberfichtner
@ 2025-12-01 18:37   ` Tom Rini
  2025-12-01 18:38     ` Philip Oberfichtner
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Rini @ 2025-12-01 18:37 UTC (permalink / raw)
  To: Philip Oberfichtner
  Cc: u-boot, Andre Przywara, Anshul Dalal, Dario Binacchi, Greg Malysa,
	Heinrich Schuchardt, Ilias Apalodimas, Jerome Forissier,
	Marek Vasut, Nathan Barrett-Morrison, Peng Fan, Simon Glass,
	Trevor Woerner, Ye Li

[-- Attachment #1: Type: text/plain, Size: 562 bytes --]

On Mon, Dec 01, 2025 at 07:30:20PM +0100, Philip Oberfichtner wrote:
> On Mon, Nov 10, 2025 at 10:12:53AM +0100, Philip Oberfichtner wrote:
> > This patch series aims at harmonizing image size checks, 
> 
> Hi Tom,
> 
> I don't want to be impatient, just to make sure this one won't slip
> through the cracks: What's the current status? Do we still have another
> reviewer we're currently waiting for?

Yes, Marek has said he'll review this when he has time, and I know he's
going to do so as soon as he's able. Thanks for your patience.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 0/3] Harmonize image size checks
  2025-12-01 18:37   ` Tom Rini
@ 2025-12-01 18:38     ` Philip Oberfichtner
  0 siblings, 0 replies; 11+ messages in thread
From: Philip Oberfichtner @ 2025-12-01 18:38 UTC (permalink / raw)
  To: Tom Rini
  Cc: u-boot, Andre Przywara, Anshul Dalal, Dario Binacchi, Greg Malysa,
	Heinrich Schuchardt, Ilias Apalodimas, Jerome Forissier,
	Marek Vasut, Nathan Barrett-Morrison, Peng Fan, Simon Glass,
	Trevor Woerner, Ye Li

On Mon, Dec 01, 2025 at 12:37:20PM -0600, Tom Rini wrote:
> On Mon, Dec 01, 2025 at 07:30:20PM +0100, Philip Oberfichtner wrote:
> > On Mon, Nov 10, 2025 at 10:12:53AM +0100, Philip Oberfichtner wrote:
> > > This patch series aims at harmonizing image size checks, 
> > 
> > Hi Tom,
> > 
> > I don't want to be impatient, just to make sure this one won't slip
> > through the cracks: What's the current status? Do we still have another
> > reviewer we're currently waiting for?
> 
> Yes, Marek has said he'll review this when he has time, and I know he's
> going to do so as soon as he's able. Thanks for your patience.

Sure. Thanks for the update!

Best regards,
Philip


> 
> -- 
> Tom



-- 
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-22  Fax: +49-8142-66989-80   Email: pro@denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 2/3] Image size checks: Clarify help texts
  2025-11-10  9:12 ` [PATCH v5 2/3] Image size checks: Clarify help texts Philip Oberfichtner
@ 2025-12-31 21:20   ` Marek Vasut
  0 siblings, 0 replies; 11+ messages in thread
From: Marek Vasut @ 2025-12-31 21:20 UTC (permalink / raw)
  To: Philip Oberfichtner, u-boot
  Cc: Andre Przywara, Anshul Dalal, Dario Binacchi, Greg Malysa,
	Heinrich Schuchardt, Ilias Apalodimas, Jerome Forissier,
	Nathan Barrett-Morrison, Peng Fan, Simon Glass, Tom Rini,
	Trevor Woerner, Ye Li

On 11/10/25 10:12 AM, Philip Oberfichtner wrote:
> Adapt help texts for CONFIG_XXX_SIZE_LIMITs to their new logic.
> 
> Signed-off-by: Philip Oberfichtner <pro@denx.de>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 3/3] Makefile: Deduplicate image size checks
  2025-11-10  9:12 ` [PATCH v5 3/3] Makefile: Deduplicate image size checks Philip Oberfichtner
@ 2025-12-31 21:25   ` Marek Vasut
  0 siblings, 0 replies; 11+ messages in thread
From: Marek Vasut @ 2025-12-31 21:25 UTC (permalink / raw)
  To: Philip Oberfichtner, u-boot
  Cc: Andre Przywara, Anshul Dalal, Dario Binacchi, Greg Malysa,
	Heinrich Schuchardt, Ilias Apalodimas, Jerome Forissier,
	Nathan Barrett-Morrison, Peng Fan, Simon Glass, Tom Rini,
	Trevor Woerner, Ye Li

On 11/10/25 10:12 AM, Philip Oberfichtner wrote:
> Deduplicate some redundancies within the SIZE_CHECK code in the toplevel

top level (space between the two)

> Makefile. No functional changes.
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently
  2025-11-10  9:12 ` [PATCH v5 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently Philip Oberfichtner
@ 2025-12-31 21:27   ` Marek Vasut
  2026-01-07 17:34     ` Philip Oberfichtner
  0 siblings, 1 reply; 11+ messages in thread
From: Marek Vasut @ 2025-12-31 21:27 UTC (permalink / raw)
  To: Philip Oberfichtner, u-boot
  Cc: Andre Przywara, Anshul Dalal, Dario Binacchi, Greg Malysa,
	Heinrich Schuchardt, Ilias Apalodimas, Jerome Forissier,
	Nathan Barrett-Morrison, Peng Fan, Simon Glass, Tom Rini,
	Trevor Woerner, Ye Li

On 11/10/25 10:12 AM, Philip Oberfichtner wrote:

[...]

> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 8dade2b501e..97c7bfdad47 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -36,19 +36,33 @@ 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 HAS_SPL_SIZE_LIMIT
> +	bool "Enable size limit check for the SPL image"
> +	depends on !COMPILE_TEST
> +	depends on SPL
> +	default y if ARCH_MX6
> +	default y if ARCH_MVEBU && ARMADA_32BIT
> +	default y if ARMADA_38X
> +	default y if K3_DM_FW

K3_DM_FW is some driver, what you likely want here is:

default y if ARCH_K3 && CPU_V7R && !SOC_K3_AM642 && !SOC_K3_AM654 && 
!CLK_TI_SCI && !TI_SCI_POWER_DOMAIN

But it seems am64x_evm_r5_defconfig below enables HAS_SPL_SIZE_LIMIT too 
, so likely remove !SOC_K3_AM642 from the above, which will allow you to 
reduce the amount of configs/ file changes.

> +	default y if SOC_K3_AM625
> +	default y if SOC_MT7621
> +	default y if TARGET_SOCFPGA_GEN5

You could also add Xilinx Zynq/ZynqMP into the defaults here, which will 
further reduce the configs/ file changes.

The rest looks fine, thanks !

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v5 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently
  2025-12-31 21:27   ` Marek Vasut
@ 2026-01-07 17:34     ` Philip Oberfichtner
  0 siblings, 0 replies; 11+ messages in thread
From: Philip Oberfichtner @ 2026-01-07 17:34 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Tom Rini

Hi Marek,

Thanks for the review, I'll get back to it asap. In the meantime please
take note of my new e-mail address.

Best regards,
Philip Oberfichtner

On Wed, Dec 31, 2025 at 10:27:44PM +0100, Marek Vasut wrote:
> On 11/10/25 10:12 AM, Philip Oberfichtner wrote:
> 
> [...]
> 
> > diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> > index 8dade2b501e..97c7bfdad47 100644
> > --- a/common/spl/Kconfig
> > +++ b/common/spl/Kconfig
> > @@ -36,19 +36,33 @@ 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 HAS_SPL_SIZE_LIMIT
> > +	bool "Enable size limit check for the SPL image"
> > +	depends on !COMPILE_TEST
> > +	depends on SPL
> > +	default y if ARCH_MX6
> > +	default y if ARCH_MVEBU && ARMADA_32BIT
> > +	default y if ARMADA_38X
> > +	default y if K3_DM_FW
> 
> K3_DM_FW is some driver, what you likely want here is:
> 
> default y if ARCH_K3 && CPU_V7R && !SOC_K3_AM642 && !SOC_K3_AM654 &&
> !CLK_TI_SCI && !TI_SCI_POWER_DOMAIN
> 
> But it seems am64x_evm_r5_defconfig below enables HAS_SPL_SIZE_LIMIT too ,
> so likely remove !SOC_K3_AM642 from the above, which will allow you to
> reduce the amount of configs/ file changes.
> 
> > +	default y if SOC_K3_AM625
> > +	default y if SOC_MT7621
> > +	default y if TARGET_SOCFPGA_GEN5
> 
> You could also add Xilinx Zynq/ZynqMP into the defaults here, which will
> further reduce the configs/ file changes.
> 
> The rest looks fine, thanks !

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-01-07 18:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10  9:12 [PATCH v5 0/3] Harmonize image size checks Philip Oberfichtner
2025-11-10  9:12 ` [PATCH v5 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently Philip Oberfichtner
2025-12-31 21:27   ` Marek Vasut
2026-01-07 17:34     ` Philip Oberfichtner
2025-11-10  9:12 ` [PATCH v5 2/3] Image size checks: Clarify help texts Philip Oberfichtner
2025-12-31 21:20   ` Marek Vasut
2025-11-10  9:12 ` [PATCH v5 3/3] Makefile: Deduplicate image size checks Philip Oberfichtner
2025-12-31 21:25   ` Marek Vasut
2025-12-01 18:30 ` [PATCH v5 0/3] Harmonize " Philip Oberfichtner
2025-12-01 18:37   ` Tom Rini
2025-12-01 18:38     ` Philip Oberfichtner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.