* [PATCH v4 0/3] Harmonize image size checks
@ 2025-10-15 1:23 Philip Oberfichtner
2025-10-15 1:23 ` [PATCH v4 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently Philip Oberfichtner
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Philip Oberfichtner @ 2025-10-15 1:23 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 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
Image size checks: Deduplicate Makefile
Kconfig | 6 ++--
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, 89 insertions(+), 65 deletions(-)
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v4 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently
2025-10-15 1:23 [PATCH v4 0/3] Harmonize image size checks Philip Oberfichtner
@ 2025-10-15 1:23 ` Philip Oberfichtner
2025-11-09 18:41 ` Marek Vasut
2025-10-15 1:23 ` [PATCH v4 2/3] Image size checks: Clarify help texts Philip Oberfichtner
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Philip Oberfichtner @ 2025-10-15 1:23 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 v4:
- Reduce defconfig changeset from 54 to 31 files
- Move "default" statements to main Kconfig (e.g. common/spl/Kconfig)
Makefile | 6 +++---
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, 67 insertions(+), 21 deletions(-)
diff --git a/Makefile b/Makefile
index 2402f9313d8..e68dce2c1d5 100644
--- a/Makefile
+++ b/Makefile
@@ -1109,19 +1109,19 @@ else
BOARD_SIZE_CHECK =
endif
-ifneq ($(CONFIG_SPL_SIZE_LIMIT),0x0)
+ifneq ($(CONFIG_SPL_SIZE_LIMIT),)
SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit))
else
SPL_SIZE_CHECK =
endif
-ifneq ($(CONFIG_TPL_SIZE_LIMIT),0x0)
+ifneq ($(CONFIG_TPL_SIZE_LIMIT),)
TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
else
TPL_SIZE_CHECK =
endif
-ifneq ($(CONFIG_VPL_SIZE_LIMIT),0x0)
+ifneq ($(CONFIG_VPL_SIZE_LIMIT),)
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 4ece5d168f9..1e3508b0cf4 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 491e0dd102e..b49370d2a34 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 07c805faa2f..87db48a2ac5 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 8715893bbcc..2ba2b7f72af 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 d1ac992dc7a..4bbe38536d1 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 6ea675fb83d..470dfe6062d 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] 10+ messages in thread
* [PATCH v4 2/3] Image size checks: Clarify help texts
2025-10-15 1:23 [PATCH v4 0/3] Harmonize image size checks Philip Oberfichtner
2025-10-15 1:23 ` [PATCH v4 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently Philip Oberfichtner
@ 2025-10-15 1:23 ` Philip Oberfichtner
2025-11-09 18:55 ` Marek Vasut
2025-10-15 1:23 ` [PATCH v4 3/3] Image size checks: Deduplicate Makefile Philip Oberfichtner
2025-11-04 11:28 ` [PATCH v4 0/3] Harmonize image size checks Philip Oberfichtner
3 siblings, 1 reply; 10+ messages in thread
From: Philip Oberfichtner @ 2025-10-15 1:23 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 v4:
- Slightly adapt help texts as discussed in v3
Kconfig | 6 +++---
common/spl/Kconfig | 6 +++---
common/spl/Kconfig.tpl | 6 +++---
common/spl/Kconfig.vpl | 6 +++---
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/Kconfig b/Kconfig
index 1d600342685..cb22d718e7c 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,8 +550,8 @@ 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
+ Maximum size of the U-Boot image. The build system will throw an
+ error if the actual image size exceeds this value. This does not
include SPL nor TPL, on platforms that use that functionality, they
have separate options to restrict size.
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 1e3508b0cf4..385a2614ddb 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 will throw an error if
+ the actual image size exceeds 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..cd026b4f576 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 will throw an error if
+ the actual image size exceeds 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..98dc035c7ca 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 will throw an error if
+ the actual image size exceeds this value.
config VPL_SPI
bool "Support SPI drivers"
--
2.39.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v4 3/3] Image size checks: Deduplicate Makefile
2025-10-15 1:23 [PATCH v4 0/3] Harmonize image size checks Philip Oberfichtner
2025-10-15 1:23 ` [PATCH v4 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently Philip Oberfichtner
2025-10-15 1:23 ` [PATCH v4 2/3] Image size checks: Clarify help texts Philip Oberfichtner
@ 2025-10-15 1:23 ` Philip Oberfichtner
2025-11-09 19:00 ` Marek Vasut
2025-11-04 11:28 ` [PATCH v4 0/3] Harmonize image size checks Philip Oberfichtner
3 siblings, 1 reply; 10+ messages in thread
From: Philip Oberfichtner @ 2025-10-15 1:23 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 v4:
- Pass CONFIG_HAS_XXX_SIZE_LIMIT as an argument to size_check()
Makefile | 48 +++++++++++++-----------------------------------
1 file changed, 13 insertions(+), 35 deletions(-)
diff --git a/Makefile b/Makefile
index e68dce2c1d5..7b19610335f 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; \
@@ -1103,30 +1105,6 @@ LDPPFLAGS += \
#########################################################################
#########################################################################
-ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
-BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
-else
-BOARD_SIZE_CHECK =
-endif
-
-ifneq ($(CONFIG_SPL_SIZE_LIMIT),)
-SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit))
-else
-SPL_SIZE_CHECK =
-endif
-
-ifneq ($(CONFIG_TPL_SIZE_LIMIT),)
-TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
-else
-TPL_SIZE_CHECK =
-endif
-
-ifneq ($(CONFIG_VPL_SIZE_LIMIT),)
-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
@@ -1470,7 +1448,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 $@
@@ -1571,11 +1549,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
# ---------------------------------------------------------------------------
@@ -1702,7 +1680,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 =
@@ -1717,12 +1695,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 $< > $@
@@ -2346,7 +2324,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
@:
@@ -2371,14 +2349,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] 10+ messages in thread
* Re: [PATCH v4 0/3] Harmonize image size checks
2025-10-15 1:23 [PATCH v4 0/3] Harmonize image size checks Philip Oberfichtner
` (2 preceding siblings ...)
2025-10-15 1:23 ` [PATCH v4 3/3] Image size checks: Deduplicate Makefile Philip Oberfichtner
@ 2025-11-04 11:28 ` Philip Oberfichtner
2025-11-04 11:56 ` Marek Vasut
3 siblings, 1 reply; 10+ messages in thread
From: Philip Oberfichtner @ 2025-11-04 11:28 UTC (permalink / raw)
To: u-boot, Marek Vasut, Tom Rini
Cc: Andre Przywara, Anshul Dalal, Dario Binacchi, Greg Malysa,
Heinrich Schuchardt, Ilias Apalodimas, Jerome Forissier,
Nathan Barrett-Morrison, Peng Fan, Simon Glass, Trevor Woerner,
Ye Li
On Wed, Oct 15, 2025 at 03:23:17AM +0200, Philip Oberfichtner wrote:
> This patch series aims at harmonizing image size checks, which are
> currently represented by the following Kconfig symbols:
Hi Tom, Marek,
I think I've addressed all the points discussed in V3. Do you have any
more comments?
Thanks,
Philip
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v4 0/3] Harmonize image size checks
2025-11-04 11:28 ` [PATCH v4 0/3] Harmonize image size checks Philip Oberfichtner
@ 2025-11-04 11:56 ` Marek Vasut
0 siblings, 0 replies; 10+ messages in thread
From: Marek Vasut @ 2025-11-04 11:56 UTC (permalink / raw)
To: Philip Oberfichtner, u-boot, Tom Rini
Cc: Andre Przywara, Anshul Dalal, Dario Binacchi, Greg Malysa,
Heinrich Schuchardt, Ilias Apalodimas, Jerome Forissier,
Nathan Barrett-Morrison, Peng Fan, Simon Glass, Trevor Woerner,
Ye Li
On 11/4/25 12:28 PM, Philip Oberfichtner wrote:
>
> On Wed, Oct 15, 2025 at 03:23:17AM +0200, Philip Oberfichtner wrote:
>> This patch series aims at harmonizing image size checks, which are
>> currently represented by the following Kconfig symbols:
>
> Hi Tom, Marek,
>
> I think I've addressed all the points discussed in V3. Do you have any
> more comments?
Your change is under review. Reviewers are busy. Please be patient.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v4 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently
2025-10-15 1:23 ` [PATCH v4 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently Philip Oberfichtner
@ 2025-11-09 18:41 ` Marek Vasut
2025-11-10 7:46 ` Philip Oberfichtner
0 siblings, 1 reply; 10+ messages in thread
From: Marek Vasut @ 2025-11-09 18:41 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 10/15/25 3:23 AM, Philip Oberfichtner wrote:
> 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.
[...]
> diff --git a/Makefile b/Makefile
> index 2402f9313d8..e68dce2c1d5 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1109,19 +1109,19 @@ else
> BOARD_SIZE_CHECK =
> endif
>
> -ifneq ($(CONFIG_SPL_SIZE_LIMIT),0x0)
> +ifneq ($(CONFIG_SPL_SIZE_LIMIT),)
Why does this check not use HAS_SPL_SIZE_LIMIT introduced below ?
> SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit))
> else
> SPL_SIZE_CHECK =
> endif
>
> -ifneq ($(CONFIG_TPL_SIZE_LIMIT),0x0)
> +ifneq ($(CONFIG_TPL_SIZE_LIMIT),)
DTTO
> TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
> else
> TPL_SIZE_CHECK =
> endif
>
> -ifneq ($(CONFIG_VPL_SIZE_LIMIT),0x0)
> +ifneq ($(CONFIG_VPL_SIZE_LIMIT),)
DTTO
[...]
> +++ 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
[...]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v4 2/3] Image size checks: Clarify help texts
2025-10-15 1:23 ` [PATCH v4 2/3] Image size checks: Clarify help texts Philip Oberfichtner
@ 2025-11-09 18:55 ` Marek Vasut
0 siblings, 0 replies; 10+ messages in thread
From: Marek Vasut @ 2025-11-09 18:55 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 10/15/25 3:23 AM, Philip Oberfichtner wrote:
[...]
> @@ -550,8 +550,8 @@ 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
> + Maximum size of the U-Boot image. The build system will throw an
> + error if the actual image size exceeds this value. This does not
Simply keep the original text with "check" keyword in it, and drop the
"When defined" part, since this is now gated by the HAS_... symbols,
then reuse the same for SPL/TPL/VPL :
"
The build system checks that the actual image size does not exceed this
value.
"
or this if you want the error out part in there:
"
The build system checks that the actual image size does not exceed this
value, and fails the build if it does.
"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v4 3/3] Image size checks: Deduplicate Makefile
2025-10-15 1:23 ` [PATCH v4 3/3] Image size checks: Deduplicate Makefile Philip Oberfichtner
@ 2025-11-09 19:00 ` Marek Vasut
0 siblings, 0 replies; 10+ messages in thread
From: Marek Vasut @ 2025-11-09 19:00 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 10/15/25 3:23 AM, Philip Oberfichtner wrote:
The subject tag is wrong, it should be "Makefile:" or "kbuild:" .
> Deduplicate some redundancies within the SIZE_CHECK code in the toplevel
> Makefile. No functional changes.
The rest is fine, thanks !
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v4 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently
2025-11-09 18:41 ` Marek Vasut
@ 2025-11-10 7:46 ` Philip Oberfichtner
0 siblings, 0 replies; 10+ messages in thread
From: Philip Oberfichtner @ 2025-11-10 7:46 UTC (permalink / raw)
To: Marek Vasut
Cc: u-boot, 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
Hi Marek,
Thank you for the feedback!
On Sun, Nov 09, 2025 at 07:41:13PM +0100, Marek Vasut wrote:
[...]
> > diff --git a/Makefile b/Makefile
> > index 2402f9313d8..e68dce2c1d5 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1109,19 +1109,19 @@ else
> > BOARD_SIZE_CHECK =
> > endif
> > -ifneq ($(CONFIG_SPL_SIZE_LIMIT),0x0)
> > +ifneq ($(CONFIG_SPL_SIZE_LIMIT),)
>
> Why does this check not use HAS_SPL_SIZE_LIMIT introduced below ?
You're right, that was nonesense. See v5.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-11-10 7:47 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15 1:23 [PATCH v4 0/3] Harmonize image size checks Philip Oberfichtner
2025-10-15 1:23 ` [PATCH v4 1/3] Image size checks: Use HAS_SIZE_LIMIT consistently Philip Oberfichtner
2025-11-09 18:41 ` Marek Vasut
2025-11-10 7:46 ` Philip Oberfichtner
2025-10-15 1:23 ` [PATCH v4 2/3] Image size checks: Clarify help texts Philip Oberfichtner
2025-11-09 18:55 ` Marek Vasut
2025-10-15 1:23 ` [PATCH v4 3/3] Image size checks: Deduplicate Makefile Philip Oberfichtner
2025-11-09 19:00 ` Marek Vasut
2025-11-04 11:28 ` [PATCH v4 0/3] Harmonize image size checks Philip Oberfichtner
2025-11-04 11:56 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox