Skip to contentSkip to conversation

Simplify image size checks

PATCH Superseded Philip Oberfichtner 4 participants 22 messages Aug 7, 2025 – Sep 1, 2025

Subsystems (4)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Simplify image size checks

Depends on:
- https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
- https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

This patch series intends to simplify the image size checks, which currently exist in multiple flavours:

CONFIG_HAS_BOARD_SIZE_LIMIT
CONFIG_BOARD_SIZE_LIMIT
CONFIG_UBOOT_WITH_SPL_SIZE_LIMIT
CONFIG_SPL_SIZE_LIMIT
CONFIG_SPL_SIZE_LIMIT_SUBTRACT_GD
CONFIG_SPL_SIZE_LIMIT_SUBTRACT_MALLOC
CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK
CONFIG_TPL_SIZE_LIMIT
CONFIG_VPL_SIZE_LIMIT

After this series, we would have
- Less code duplication in the toplevel Makefile
- Consistent logic for all the different CONFIGS
- All related options in one place

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: Remove HAS_BOARD_SIZE_LIMIT Image size checks: Move all configs in one place Image size checks: Simplify help text

 Kconfig                                       | 80 ++++++++++++++++---
 cmd/Kconfig                                   |  2 +-
 common/spl/Kconfig                            | 45 -----------
 common/spl/Kconfig.tpl                        |  7 --
 common/spl/Kconfig.vpl                        |  7 --
 configs/bk4r1_defconfig                       |  1 -
 configs/chromebook_link_defconfig             |  1 -
 configs/colibri_vf_defconfig                  |  1 -
 configs/ea-lpc3250devkitv2_defconfig          |  1 -
 .../gardena-smart-gateway-mt7688_defconfig    |  1 -
 configs/guruplug_defconfig                    |  1 -
 configs/imx28_btt3_defconfig                  |  1 -
 configs/imx28_xea_defconfig                   |  1 -
 configs/legoev3_defconfig                     |  1 -
 configs/linkit-smart-7688_defconfig           |  1 -
 configs/lschlv2_defconfig                     |  1 -
 configs/lsxhl_defconfig                       |  1 -
 configs/lxr2_defconfig                        |  1 -
 configs/mx51evk_defconfig                     |  1 -
 configs/mx53loco_defconfig                    |  1 -
 configs/mx6sabresd_defconfig                  |  1 -
 configs/mx7ulp_com_defconfig                  |  1 -
 configs/openrd_base_defconfig                 |  1 -
 configs/openrd_client_defconfig               |  1 -
 configs/openrd_ultimate_defconfig             |  1 -
 configs/pcm052_defconfig                      |  1 -
 configs/pico-dwarf-imx6ul_defconfig           |  1 -
 configs/pico-dwarf-imx7d_defconfig            |  1 -
 configs/pico-hobbit-imx6ul_defconfig          |  1 -
 configs/pico-hobbit-imx7d_defconfig           |  1 -
 configs/pico-imx6_defconfig                   |  1 -
 configs/pico-imx6ul_defconfig                 |  1 -
 configs/pico-imx7d_bl33_defconfig             |  1 -
 configs/pico-imx7d_defconfig                  |  1 -
 configs/pico-nymph-imx7d_defconfig            |  1 -
 configs/pico-pi-imx6ul_defconfig              |  1 -
 configs/pico-pi-imx7d_defconfig               |  1 -
 configs/sheevaplug_defconfig                  |  1 -
 configs/stm32mp15_dhsom.config                |  1 -
 configs/tbs2910_defconfig                     |  1 -
 configs/turris_1x_nor_defconfig               |  1 -
 configs/turris_1x_sdcard_defconfig            |  1 -
 configs/turris_omnia_defconfig                |  1 -
 configs/udoo_neo_defconfig                    |  1 -
 configs/vf610twr_defconfig                    |  1 -
 configs/vf610twr_nand_defconfig               |  1 -
 configs/warp7_bl33_defconfig                  |  1 -
 configs/warp7_defconfig                       |  1 -
 lib/efi_loader/Kconfig                        |  6 +-
 49 files changed, 72 insertions(+), 118 deletions(-)
Signature · 1 line
2.39.5
#1 lore raw

PATCH v2 1/3 Image size checks: Remove HAS_BOARD_SIZE_LIMIT

CONFIG_HAS_BOARD_SIZE_LIMIT is obsolete, if we interpret the value "zero" as "unlimited". This is exactly how all the other CONFIG_XXX_SIZE_LIMITs work.

Note that we drop the "depends on !COMPILE_TEST" without replacement. The rationale is explained here:
7adb9b03a64 (Kconfig: Test for !COMPILE_TEST in some locations).

---

Notes:
Changes in v2:
- Move "default 0" to the very end
- Rebase on current master

 Kconfig                                        | 10 +---------
 cmd/Kconfig                                    |  2 +-
 configs/bk4r1_defconfig                        |  1 -
 configs/chromebook_link_defconfig              |  1 -
 configs/colibri_vf_defconfig                   |  1 -
 configs/ea-lpc3250devkitv2_defconfig           |  1 -
 configs/gardena-smart-gateway-mt7688_defconfig |  1 -
 configs/guruplug_defconfig                     |  1 -
 configs/imx28_btt3_defconfig                   |  1 -
 configs/imx28_xea_defconfig                    |  1 -
 configs/legoev3_defconfig                      |  1 -
 configs/linkit-smart-7688_defconfig            |  1 -
 configs/lschlv2_defconfig                      |  1 -
 configs/lsxhl_defconfig                        |  1 -
 configs/lxr2_defconfig                         |  1 -
 configs/mx51evk_defconfig                      |  1 -
 configs/mx53loco_defconfig                     |  1 -
 configs/mx6sabresd_defconfig                   |  1 -
 configs/mx7ulp_com_defconfig                   |  1 -
 configs/openrd_base_defconfig                  |  1 -
 configs/openrd_client_defconfig                |  1 -
 configs/openrd_ultimate_defconfig              |  1 -
 configs/pcm052_defconfig                       |  1 -
 configs/pico-dwarf-imx6ul_defconfig            |  1 -
 configs/pico-dwarf-imx7d_defconfig             |  1 -
 configs/pico-hobbit-imx6ul_defconfig           |  1 -
 configs/pico-hobbit-imx7d_defconfig            |  1 -
 configs/pico-imx6_defconfig                    |  1 -
 configs/pico-imx6ul_defconfig                  |  1 -
 configs/pico-imx7d_bl33_defconfig              |  1 -
 configs/pico-imx7d_defconfig                   |  1 -
 configs/pico-nymph-imx7d_defconfig             |  1 -
 configs/pico-pi-imx6ul_defconfig               |  1 -
 configs/pico-pi-imx7d_defconfig                |  1 -
 configs/sheevaplug_defconfig                   |  1 -
 configs/stm32mp15_dhsom.config                 |  1 -
 configs/tbs2910_defconfig                      |  1 -
 configs/turris_1x_nor_defconfig                |  1 -
 configs/turris_1x_sdcard_defconfig             |  1 -
 configs/turris_omnia_defconfig                 |  1 -
 configs/udoo_neo_defconfig                     |  1 -
 configs/vf610twr_defconfig                     |  1 -
 configs/vf610twr_nand_defconfig                |  1 -
 configs/warp7_bl33_defconfig                   |  1 -
 configs/warp7_defconfig                        |  1 -
 lib/efi_loader/Kconfig                         |  6 +++---
 46 files changed, 5 insertions(+), 56 deletions(-)
Kconfig +1 -9
index 70125c4e5a6..99f7bb563df 100644
@@ -535,19 +535,11 @@ config BUILD_TARGET
 	  special image will be automatically built upon calling
 	  make / buildman.
 
-config HAS_BOARD_SIZE_LIMIT
-	bool "Define a maximum size for the U-Boot image"
-	depends on !COMPILE_TEST
-	default y if RCAR_32 || RCAR_64
-	help
-	  In some cases, we need to enforce a hard limit on how big the U-Boot
-	  image itself can be.
-
 config BOARD_SIZE_LIMIT
 	int "Maximum size of the U-Boot image in bytes"
 	default 524288 if RCAR_32
 	default 1048576 if RCAR_64
-	depends on HAS_BOARD_SIZE_LIMIT
+	default 0
 	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
cmd/Kconfig +1 -1
index 1a7dba2a27d..052ae619f72 100644
@@ -2338,7 +2338,7 @@ config CMD_EFIDEBUG
 
 config CMD_EFICONFIG
 	bool "eficonfig - provide menu-driven uefi variables maintenance interface"
-	default y if !HAS_BOARD_SIZE_LIMIT
+	default y if BOARD_SIZE_LIMIT = 0
 	depends on EFI_BOOTMGR
 	select MENU
 	help
configs/bk4r1_defconfig +0 -1
index fd3b6188776..ca63cf71db8 100644
@@ -18,7 +18,6 @@ CONFIG_TARGET_BK4R1=y
 CONFIG_SYS_MEMTEST_START=0x80010000
 CONFIG_SYS_MEMTEST_END=0x87c00000
 CONFIG_LTO=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=520192
 # CONFIG_EFI_LOADER is not set
 CONFIG_FIT=y
configs/chromebook_link_defconfig +0 -1
index b5b3851a010..9bdeb604292 100644
@@ -15,7 +15,6 @@ CONFIG_DEBUG_UART=y
 CONFIG_HAVE_MRC=y
 CONFIG_SMP=y
 CONFIG_HAVE_VGA_BIOS=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=630000
 # CONFIG_EFI_LOADER is not set
 CONFIG_FIT=y
configs/colibri_vf_defconfig +0 -1
index 1364fe45291..9c3077cc16f 100644
@@ -15,7 +15,6 @@ CONFIG_TARGET_COLIBRI_VF=y
 CONFIG_SYS_MEMTEST_START=0x80010000
 CONFIG_SYS_MEMTEST_END=0x87c00000
 CONFIG_ENV_VARS_UBOOT_CONFIG=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=520192
 # CONFIG_EFI_LOADER is not set
 CONFIG_BOOTDELAY=1
configs/ea-lpc3250devkitv2_defconfig +0 -1
index c3af7afced1..5a3cdb45f7c 100644
@@ -12,7 +12,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80000f20
 CONFIG_TARGET_EA_LPC3250DEVKITV2=y
 CONFIG_DEFAULT_DEVICE_TREE="lpc3250-ea3250"
 CONFIG_SYS_LOAD_ADDR=0x80100000
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=1048575
 CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_AUTOBOOT is not set
configs/gardena-smart-gateway-mt7688_defconfig +0 -1
index 3c2bcc6a3c4..39e3cd04251 100644
@@ -27,7 +27,6 @@ CONFIG_RESTORE_EXCEPTION_VECTOR_BASE=y
 # CONFIG_MIPS_BOOT_ENV_LEGACY is not set
 CONFIG_MIPS_BOOT_FDT=y
 CONFIG_ENV_VARS_UBOOT_CONFIG=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=655360
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
configs/guruplug_defconfig +0 -1
index e046a5ee8b1..a8697113cd3 100644
@@ -13,7 +13,6 @@ CONFIG_ENV_OFFSET=0xE0000
 CONFIG_DEFAULT_DEVICE_TREE="marvell/kirkwood-guruplug-server-plus"
 CONFIG_SYS_LOAD_ADDR=0x800000
 CONFIG_IDENT_STRING="\nMarvell-GuruPlug"
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=917504
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
configs/imx28_btt3_defconfig +0 -1
index 07c805faa2f..0efbea20109 100644
@@ -31,7 +31,6 @@ CONFIG_ENV_OFFSET_REDUND=0x90000
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI=y
 CONFIG_SPL_PAYLOAD="u-boot.img"
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=458752
 CONFIG_TIMESTAMP=y
 CONFIG_FIT=y
configs/imx28_xea_defconfig +0 -1
index 8715893bbcc..9a54efdb8da 100644
@@ -29,7 +29,6 @@ CONFIG_ENV_OFFSET_REDUND=0x90000
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI=y
 CONFIG_SPL_PAYLOAD="u-boot.img"
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=458752
 CONFIG_TIMESTAMP=y
 CONFIG_FIT=y
configs/legoev3_defconfig +0 -1
index dee19a95d55..571ff928029 100644
@@ -14,7 +14,6 @@ CONFIG_ENV_SIZE=0x4000
 CONFIG_DEFAULT_DEVICE_TREE="da850-lego-ev3"
 CONFIG_SYS_LOAD_ADDR=0xc0700000
 CONFIG_LTO=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=262144
 CONFIG_DYNAMIC_SYS_CLK_FREQ=y
 CONFIG_BOOTDELAY=0
configs/linkit-smart-7688_defconfig +0 -1
index 1602ff5b73a..e2f232d549b 100644
@@ -23,7 +23,6 @@ CONFIG_MIPS_CACHE_DISABLE=y
 CONFIG_RESTORE_EXCEPTION_VECTOR_BASE=y
 # CONFIG_MIPS_BOOT_ENV_LEGACY is not set
 CONFIG_MIPS_BOOT_FDT=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=524288
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
configs/lschlv2_defconfig +0 -1
index 3a53d49ba83..b296feeec1b 100644
@@ -18,7 +18,6 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="marvell/kirkwood-lschlv2"
 CONFIG_SYS_LOAD_ADDR=0x800000
 CONFIG_IDENT_STRING=" LS-CHLv2"
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=393216
 # CONFIG_BOOTSTD is not set
 CONFIG_DISTRO_DEFAULTS=y
configs/lsxhl_defconfig +0 -1
index 83a0a6f5415..ff1ce7a79cc 100644
@@ -19,7 +19,6 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="marvell/kirkwood-lsxhl"
 CONFIG_SYS_LOAD_ADDR=0x800000
 CONFIG_IDENT_STRING=" LS-XHL"
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=393216
 # CONFIG_BOOTSTD is not set
 CONFIG_DISTRO_DEFAULTS=y
configs/lxr2_defconfig +0 -1
index f2afed1c4ba..c9852fb6470 100644
@@ -26,7 +26,6 @@ CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI=y
 CONFIG_LTO=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715766
 CONFIG_FIT=y
 CONFIG_SPL_FIT_PRINT=y
configs/mx51evk_defconfig +0 -1
index bcbef81d1d4..14b7e80c86b 100644
@@ -10,7 +10,6 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx51-babbage"
 CONFIG_SYS_LOAD_ADDR=0x92000000
 # CONFIG_CMD_BMODE is not set
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=785408
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi"
configs/mx53loco_defconfig +0 -1
index 1f7da84fbea..0413e2ee55a 100644
@@ -11,7 +11,6 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx53-qsb"
 CONFIG_SYS_LOAD_ADDR=0x72000000
 # CONFIG_CMD_BMODE is not set
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=785408
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_USE_BOOTCOMMAND=y
configs/mx6sabresd_defconfig +0 -1
index 75a655a0e0d..9c5105883a0 100644
@@ -20,7 +20,6 @@ CONFIG_SPL=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_PCI=y
 CONFIG_LTO=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715766
 CONFIG_FIT=y
 CONFIG_SPL_FIT_PRINT=y
configs/mx7ulp_com_defconfig +0 -1
index a49cb2a728f..22ceae1c0ba 100644
@@ -12,7 +12,6 @@ CONFIG_LDO_ENABLED_MODE=y
 CONFIG_TARGET_MX7ULP_COM=y
 CONFIG_SYS_BOOTM_LEN=0x1000000
 CONFIG_SYS_LOAD_ADDR=0x60800000
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=785408
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="if run loadimage; then run mmcboot; fi"
configs/openrd_base_defconfig +0 -1
index cfad5fb037b..6811c9a29da 100644
@@ -16,7 +16,6 @@ CONFIG_ENV_OFFSET=0x80000
 CONFIG_DEFAULT_DEVICE_TREE="marvell/kirkwood-openrd-base"
 CONFIG_SYS_LOAD_ADDR=0x800000
 CONFIG_IDENT_STRING="\nOpenRD-Base"
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=524288
 CONFIG_BOOTSTD_FULL=y
 CONFIG_BOOTDELAY=3
configs/openrd_client_defconfig +0 -1
index e0a393e478c..8b745c8d5e2 100644
@@ -17,7 +17,6 @@ CONFIG_ENV_OFFSET=0x80000
 CONFIG_DEFAULT_DEVICE_TREE="marvell/kirkwood-openrd-client"
 CONFIG_SYS_LOAD_ADDR=0x800000
 CONFIG_IDENT_STRING="\nOpenRD-Client"
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=524288
 CONFIG_BOOTSTD_FULL=y
 CONFIG_BOOTDELAY=3
configs/openrd_ultimate_defconfig +0 -1
index 23415ef12ee..a14fb130ffe 100644
@@ -17,7 +17,6 @@ CONFIG_ENV_OFFSET=0x80000
 CONFIG_DEFAULT_DEVICE_TREE="marvell/kirkwood-openrd-ultimate"
 CONFIG_SYS_LOAD_ADDR=0x800000
 CONFIG_IDENT_STRING="\nOpenRD-Ultimate"
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=524288
 CONFIG_BOOTSTD_FULL=y
 CONFIG_BOOTDELAY=3
configs/pcm052_defconfig +0 -1
index 64f5f777e5c..434495bf417 100644
@@ -14,7 +14,6 @@ CONFIG_ENV_OFFSET_REDUND=0xC0000
 CONFIG_TARGET_PCM052=y
 CONFIG_SYS_MEMTEST_START=0x80010000
 CONFIG_SYS_MEMTEST_END=0x87c00000
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=520192
 # CONFIG_EFI_LOADER is not set
 CONFIG_BOOTDELAY=3
configs/pico-dwarf-imx6ul_defconfig +0 -1
index e1f6e6f91f2..296095f0103 100644
@@ -19,7 +19,6 @@ CONFIG_SPL=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_SYS_MEMTEST_START=0x80000000
 CONFIG_SYS_MEMTEST_END=0x88000000
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715776
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
configs/pico-dwarf-imx7d_defconfig +0 -1
index c1389ac4066..cc9cead2e0e 100644
@@ -19,7 +19,6 @@ CONFIG_SPL=y
 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715776
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
configs/pico-hobbit-imx6ul_defconfig +0 -1
index 137541d373a..6ef97863ce9 100644
@@ -19,7 +19,6 @@ CONFIG_SPL=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_SYS_MEMTEST_START=0x80000000
 CONFIG_SYS_MEMTEST_END=0x88000000
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715776
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
configs/pico-hobbit-imx7d_defconfig +0 -1
index 72e1a3bccc1..34ad3627193 100644
@@ -19,7 +19,6 @@ CONFIG_SPL=y
 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715776
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
configs/pico-imx6_defconfig +0 -1
index 6f46d9bf8a1..139fa6e863c 100644
@@ -16,7 +16,6 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715776
 CONFIG_FIT=y
 CONFIG_SPL_FIT_PRINT=y
configs/pico-imx6ul_defconfig +0 -1
index 70b79622be1..2f9fa4911fc 100644
@@ -19,7 +19,6 @@ CONFIG_SPL=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_SYS_MEMTEST_START=0x80000000
 CONFIG_SYS_MEMTEST_END=0x88000000
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715776
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
configs/pico-imx7d_bl33_defconfig +0 -1
index b5485bf8d0b..ff9b9104f9b 100644
@@ -19,7 +19,6 @@ CONFIG_SPL=y
 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_SYS_MEMTEST_START=0x80000000
 CONFIG_SYS_MEMTEST_END=0xa0000000
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715776
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
configs/pico-imx7d_defconfig +0 -1
index 4707062053b..a55a293fda5 100644
@@ -19,7 +19,6 @@ CONFIG_SPL=y
 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715776
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
configs/pico-nymph-imx7d_defconfig +0 -1
index c1389ac4066..cc9cead2e0e 100644
@@ -19,7 +19,6 @@ CONFIG_SPL=y
 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715776
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
configs/pico-pi-imx6ul_defconfig +0 -1
index 40db7e23797..99abd245db7 100644
@@ -19,7 +19,6 @@ CONFIG_SPL=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_SYS_MEMTEST_START=0x80000000
 CONFIG_SYS_MEMTEST_END=0x88000000
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715776
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
configs/pico-pi-imx7d_defconfig +0 -1
index 26fccf90db7..1b68ba18463 100644
@@ -19,7 +19,6 @@ CONFIG_SPL=y
 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=715776
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
configs/sheevaplug_defconfig +0 -1
index a7f6c73ecba..a7bd54c37cd 100644
@@ -17,7 +17,6 @@ CONFIG_DEFAULT_DEVICE_TREE="marvell/kirkwood-sheevaplug"
 CONFIG_SYS_LOAD_ADDR=0x800000
 CONFIG_IDENT_STRING="\nMarvell-Sheevaplug"
 CONFIG_LTO=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=524288
 CONFIG_BOOTSTD_FULL=y
 CONFIG_BOOTDELAY=3
configs/stm32mp15_dhsom.config +0 -1
index 210ec201bf5..2c8a562556e 100644
@@ -16,7 +16,6 @@ CONFIG_CMD_STM32PROG_OTP=y
 CONFIG_CONSOLE_MUX=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc0100000
 CONFIG_DM_HWSPINLOCK=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_HWSPINLOCK_STM32=y
 CONFIG_KS8851_MLL=y
 CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-names interrupts-extended interrupt-controller \\\#interrupt-cells interrupt-parent dmas dma-names assigned-clocks assigned-clock-rates assigned-clock-parents hwlocks access-controllers"
configs/tbs2910_defconfig +0 -1
index 070dce234d6..37532bf2686 100644
@@ -15,7 +15,6 @@ CONFIG_AHCI=y
 CONFIG_SYS_MEMTEST_START=0x10000000
 CONFIG_SYS_MEMTEST_END=0x2f400000
 CONFIG_LTO=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=392192
 # CONFIG_EFI_LOADER is not set
 # CONFIG_BOOTSTD is not set
configs/turris_1x_nor_defconfig +0 -1
index cc7d4a1e0d6..df2b781aa1a 100644
@@ -21,7 +21,6 @@ CONFIG_PCIE2=y
 CONFIG_PCIE3=y
 CONFIG_OPTIMIZE_INLINING=y
 CONFIG_ENV_VARS_UBOOT_CONFIG=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=786432
 CONFIG_MP=y
 CONFIG_FIT=y
configs/turris_1x_sdcard_defconfig +0 -1
index ee18cc21443..77bf6f5f065 100644
@@ -30,7 +30,6 @@ CONFIG_OF_BOARD_FIXUP=y
 CONFIG_PCIE1=y
 CONFIG_PCIE2=y
 CONFIG_PCIE3=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=1048576
 CONFIG_MP=y
 CONFIG_FIT=y
configs/turris_omnia_defconfig +0 -1
index de39e19ec6d..4461ceeaaf3 100644
@@ -36,7 +36,6 @@ CONFIG_OF_BOARD_FIXUP=y
 CONFIG_SYS_MEMTEST_START=0x00800000
 CONFIG_SYS_MEMTEST_END=0x00ffffff
 CONFIG_LTO=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=983040
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
configs/udoo_neo_defconfig +0 -1
index d4fb271e03a..ef5f6b207e6 100644
@@ -19,7 +19,6 @@ CONFIG_SPL=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 # CONFIG_CMD_BMODE is not set
 CONFIG_LTO=y
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=523264
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
configs/vf610twr_defconfig +0 -1
index 556190728e1..b16b1522d1a 100644
@@ -12,7 +12,6 @@ CONFIG_DEFAULT_DEVICE_TREE="vf610-twr"
 CONFIG_SYS_LOAD_ADDR=0x82000000
 CONFIG_SYS_MEMTEST_START=0x80010000
 CONFIG_SYS_MEMTEST_END=0x87c00000
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=520192
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
configs/vf610twr_nand_defconfig +0 -1
index 7fe9d822110..31b1468650e 100644
@@ -12,7 +12,6 @@ CONFIG_DEFAULT_DEVICE_TREE="vf610-twr"
 CONFIG_SYS_LOAD_ADDR=0x82000000
 CONFIG_SYS_MEMTEST_START=0x80010000
 CONFIG_SYS_MEMTEST_END=0x87c00000
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=520192
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTCOMMAND=y
configs/warp7_bl33_defconfig +0 -1
index 5a94062f5e2..eb047236f87 100644
@@ -11,7 +11,6 @@ CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_HAB=y
 CONFIG_SYS_MEMTEST_START=0x80000000
 CONFIG_SYS_MEMTEST_END=0xa0000000
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=785408
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
configs/warp7_defconfig +0 -1
index 03d68aa9a3f..22f611f4ccd 100644
@@ -14,7 +14,6 @@ CONFIG_IMX_BOOTAUX=y
 CONFIG_IMX_HAB=y
 CONFIG_SYS_MEMTEST_START=0x80000000
 CONFIG_SYS_MEMTEST_END=0xa0000000
-CONFIG_HAS_BOARD_SIZE_LIMIT=y
 CONFIG_BOARD_SIZE_LIMIT=785408
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
lib/efi_loader/Kconfig +3 -3
index c2aa88f59fb..36eed766d31 100644
@@ -74,7 +74,7 @@ config EFI_SIGNATURE_SUPPORT
 
 config EFI_DEBUG_SUPPORT
 	bool "EFI Debug Support"
-	default y if !HAS_BOARD_SIZE_LIMIT
+	default y if BOARD_SIZE_LIMIT = 0
 	help
 	  Select this option if you want to setup the EFI Debug Support
 	  Table and the EFI_SYSTEM_TABLE_POINTER which is used by the debug
@@ -396,7 +396,7 @@ config EFI_DT_FIXUP
 
 config EFI_LOADER_HII
 	bool "HII protocols"
-	default y if !HAS_BOARD_SIZE_LIMIT
+	default y if BOARD_SIZE_LIMIT = 0
 	help
 	  The Human Interface Infrastructure is a complicated framework that
 	  allows UEFI applications to draw fancy menus and hook strings using
@@ -416,7 +416,7 @@ if EFI_UNICODE_COLLATION_PROTOCOL2
 
 config EFI_UNICODE_CAPITALIZATION
 	bool "Support Unicode capitalization"
-	default y if !HAS_BOARD_SIZE_LIMIT
+	default y if BOARD_SIZE_LIMIT = 0
 	help
 	  Select this option to enable correct handling of the capitalization of
 	  Unicode codepoints in the range 0x0000-0xffff. If this option is not
Signature · 1 line
2.39.5
#2 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

Quoted 2 lines · Philip Oberfichtner

CONFIG_HAS_BOARD_SIZE_LIMIT is obsolete, if we interpret the value "zero" as "unlimited".

This sentence makes no sense. Is the variable not obsolete if its value is non-zero ?

[...]

lib/efi_loader/Kconfig config EFI_SIGNATURE_SUPPORT · line 77

Quoted 10 lines
lib/efi_loader/Kconfig +1 -1
index c2aa88f59fb..36eed766d31 100644
@@ -74,7 +74,7 @@ config EFI_SIGNATURE_SUPPORT
 
  config EFI_DEBUG_SUPPORT
  	bool "EFI Debug Support"
-	default y if !HAS_BOARD_SIZE_LIMIT
+	default y if BOARD_SIZE_LIMIT = 0

This looks wrong, no board size limit does not imply EFI anything.

And use some common sense and reduce the CC list.

#3 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

Quoted 6 lines · Marek Vasut
Quoted 2 lines · Philip Oberfichtner

CONFIG_HAS_BOARD_SIZE_LIMIT is obsolete, if we interpret the value "zero" as "unlimited".

This sentence makes no sense. Is the variable not obsolete if its value is non-zero ?

This is phrased oddly, yes. How about:
By making the code treat a size limit of 0 as unlimited we no longer need to guard asking about having a size limit on the platform.

Quoted 12 lines

[...]

lib/efi_loader/Kconfig config EFI_SIGNATURE_SUPPORT · line 76

Quoted 9 lines
lib/efi_loader/Kconfig +1 -1
index c2aa88f59fb..36eed766d31 100644
@@ -74,7 +74,7 @@ config EFI_SIGNATURE_SUPPORT
  config EFI_DEBUG_SUPPORT
  	bool "EFI Debug Support"
-	default y if !HAS_BOARD_SIZE_LIMIT
+	default y if BOARD_SIZE_LIMIT = 0

This looks wrong, no board size limit does not imply EFI anything.

This is however preserving the existing functionality. Saying that no, we shouldn't enable EFI debug support by default in any cases would be a stand alone patch.

Signature · 1 line
Tom
#4 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

Quoted 11 lines · Tom Rini
Quoted 6 lines · Marek Vasut
Quoted 2 lines · Philip Oberfichtner

CONFIG_HAS_BOARD_SIZE_LIMIT is obsolete, if we interpret the value "zero" as "unlimited".

This sentence makes no sense. Is the variable not obsolete if its value is non-zero ?

This is phrased oddly, yes. How about:
By making the code treat a size limit of 0 as unlimited we no longer need to guard asking about having a size limit on the platform.

0 shouldn't mean unlimited, that is just fragile ...

Quoted 13 lines
Quoted 12 lines

[...]

lib/efi_loader/Kconfig config EFI_SIGNATURE_SUPPORT · line 76

Quoted 9 lines
lib/efi_loader/Kconfig +1 -1
index c2aa88f59fb..36eed766d31 100644
@@ -74,7 +74,7 @@ config EFI_SIGNATURE_SUPPORT
   config EFI_DEBUG_SUPPORT
   	bool "EFI Debug Support"
-	default y if !HAS_BOARD_SIZE_LIMIT
+	default y if BOARD_SIZE_LIMIT = 0

This looks wrong, no board size limit does not imply EFI anything.

Quoted 3 lines

This is however preserving the existing functionality. Saying that no, we shouldn't enable EFI debug support by default in any cases would be a stand alone patch.

... fragile and confusing. HAS_BOARD_SIZE_LIMIT is at least clear about what it does.

#5 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

Quoted 6 lines · Marek Vasut
Quoted 5 lines · Tom Rini
Quoted 4 lines · Marek Vasut
Quoted 2 lines · Philip Oberfichtner

CONFIG_HAS_BOARD_SIZE_LIMIT is obsolete, if we interpret the value "zero" as "unlimited".

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

This sentence makes no sense. Is the variable not obsolete if its value is non-zero ?

This is phrased oddly, yes. How about:
By making the code treat a size limit of 0 as unlimited we no longer need to guard asking about having a size limit on the platform.

0 shouldn't mean unlimited, that is just fragile ...

That's a standard unix thing? ulimit -c 0 is unlimited.

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

[...]

lib/efi_loader/Kconfig config EFI_SIGNATURE_SUPPORT · line 76

Quoted 9 lines
lib/efi_loader/Kconfig +1 -1
index c2aa88f59fb..36eed766d31 100644
@@ -74,7 +74,7 @@ config EFI_SIGNATURE_SUPPORT
   config EFI_DEBUG_SUPPORT
   	bool "EFI Debug Support"
-	default y if !HAS_BOARD_SIZE_LIMIT
+	default y if BOARD_SIZE_LIMIT = 0

This looks wrong, no board size limit does not imply EFI anything.

Quoted 5 lines
Quoted 3 lines

This is however preserving the existing functionality. Saying that no, we shouldn't enable EFI debug support by default in any cases would be a stand alone patch.

... fragile and confusing. HAS_BOARD_SIZE_LIMIT is at least clear about what it does.

I don't know how one is more or less clear than the other, sorry.

Signature · 1 line
Tom
#6 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

Quoted 10 lines · Tom Rini
Quoted 9 lines · Marek Vasut
Quoted 8 lines · Tom Rini
Quoted 6 lines · Marek Vasut
Quoted 2 lines · Philip Oberfichtner

CONFIG_HAS_BOARD_SIZE_LIMIT is obsolete, if we interpret the value "zero" as "unlimited".

This sentence makes no sense. Is the variable not obsolete if its value is non-zero ?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

This is phrased oddly, yes. How about:
By making the code treat a size limit of 0 as unlimited we no longer need to guard asking about having a size limit on the platform.

0 shouldn't mean unlimited, that is just fragile ...

That's a standard unix thing? ulimit -c 0 is unlimited.

This is a really bad argument, because then the counter-argument is, that size = 0 is also a valid size and it shouldn't be conflated with SIZE_LIMIT validity.

My take on this is, don't conflate size-limit "enabled/disabled" with size-limit "value" , these are two separate config options. Mixing them is not helping.

#7 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

Quoted 19 lines · Marek Vasut
Quoted 10 lines · Tom Rini
Quoted 9 lines · Marek Vasut
Quoted 8 lines · Tom Rini
Quoted 6 lines · Marek Vasut
Quoted 2 lines · Philip Oberfichtner

CONFIG_HAS_BOARD_SIZE_LIMIT is obsolete, if we interpret the value "zero" as "unlimited".

This sentence makes no sense. Is the variable not obsolete if its value is non-zero ?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

This is phrased oddly, yes. How about:
By making the code treat a size limit of 0 as unlimited we no longer need to guard asking about having a size limit on the platform.

0 shouldn't mean unlimited, that is just fragile ...

That's a standard unix thing? ulimit -c 0 is unlimited.

Quoted 7 lines

This is a really bad argument, because then the counter-argument is, that size = 0 is also a valid size and it shouldn't be conflated with SIZE_LIMIT validity.

My take on this is, don't conflate size-limit "enabled/disabled" with size-limit "value" , these are two separate config options. Mixing them is not helping.

I still think it's fine, but it's not worth arguing further over, and we can just make sure to gate all of the symbols rather than 0-is-disabled.

Signature · 1 line
Tom
#8 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

Quoted 24 lines · Tom Rini
Quoted 23 lines · Marek Vasut
Quoted 10 lines · Tom Rini
Quoted 9 lines · Marek Vasut
Quoted 8 lines · Tom Rini
Quoted 6 lines · Marek Vasut
Quoted 2 lines · Philip Oberfichtner

CONFIG_HAS_BOARD_SIZE_LIMIT is obsolete, if we interpret the value "zero" as "unlimited".

This sentence makes no sense. Is the variable not obsolete if its value is non-zero ?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

This is phrased oddly, yes. How about:
By making the code treat a size limit of 0 as unlimited we no longer need to guard asking about having a size limit on the platform.

0 shouldn't mean unlimited, that is just fragile ...

That's a standard unix thing? ulimit -c 0 is unlimited.

This is a really bad argument, because then the counter-argument is, that size = 0 is also a valid size and it shouldn't be conflated with SIZE_LIMIT validity.

Quoted 6 lines
Quoted 3 lines

My take on this is, don't conflate size-limit "enabled/disabled" with size-limit "value" , these are two separate config options. Mixing them is not helping.

I still think it's fine, but it's not worth arguing further over, and we can just make sure to gate all of the symbols rather than 0-is-disabled.

The idea of treating a size limit of zero as unlimited has been common practice in mainline U-Boot since 2019, where CONFIG_SPL_SIZE_LIMIT has been introduced. The same logic has later been applied to TPL and VPL size limits.

If we want to consistently stick to the HAS_*_SIZE_LIMIT approach, we'd have to introduce four extra Kconfig options alongside HAS_BOARD_SIZE_LIMIT:

CONFIG_HAS_UBOOT_WITH_SPL_SIZE_LIMIT
CONFIG_HAS_SPL_SIZE_LIMIT
CONFIG_HAS_TPL_SIZE_LIMIT
CONFIG_HAS_VPL_SIZE_LIMIT

Furthermore, the extra lines of code in the toplevel Makefile, which could otherwise be removed:

	ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
	BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
	else
	BOARD_SIZE_CHECK =
	endif

	ifneq ($(CONFIG_HAS_UBOOT_WITH_SPL_SIZE_LIMIT),0x0)
	UBOOT_WITH_SPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_UBOOT_WITH_SPL_SIZE_LIMIT)
	else
	UBOOT_WITH_SPL_SIZE_CHECK =
	endif

	ifneq ($(CONFIG_SPL_SIZE_LIMIT),0x0)
	SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit))
	else
	SPL_SIZE_CHECK =
	endif

	ifneq ($(CONFIG_TPL_SIZE_LIMIT),0x0)
	TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
	else
	TPL_SIZE_CHECK =
	endif

	ifneq ($(CONFIG_VPL_SIZE_LIMIT),0x0)
	VPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_VPL_SIZE_LIMIT))
	else
	VPL_SIZE_CHECK =
	endif

Is it really worth adding this much of extra code?

Best regards,
Philip

Quoted 3 lines
Signature · 2 lines
-- 
Tom
Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,
Managing Director: Johanna Denk, Tabea Lutz
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
=====================================================================
#9 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

Quoted 49 lines · Philip Oberfichtner

The idea of treating a size limit of zero as unlimited has been common practice in mainline U-Boot since 2019, where CONFIG_SPL_SIZE_LIMIT has been introduced. The same logic has later been applied to TPL and VPL size limits.

If we want to consistently stick to the HAS_*_SIZE_LIMIT approach, we'd have to introduce four extra Kconfig options alongside HAS_BOARD_SIZE_LIMIT:

CONFIG_HAS_UBOOT_WITH_SPL_SIZE_LIMIT
CONFIG_HAS_SPL_SIZE_LIMIT
CONFIG_HAS_TPL_SIZE_LIMIT
CONFIG_HAS_VPL_SIZE_LIMIT

Furthermore, the extra lines of code in the toplevel Makefile, which could otherwise be removed:

	ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
	BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
	else
	BOARD_SIZE_CHECK =
	endif

	ifneq ($(CONFIG_HAS_UBOOT_WITH_SPL_SIZE_LIMIT),0x0)
	UBOOT_WITH_SPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_UBOOT_WITH_SPL_SIZE_LIMIT)
	else
	UBOOT_WITH_SPL_SIZE_CHECK =
	endif

	ifneq ($(CONFIG_SPL_SIZE_LIMIT),0x0)
	SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit))
	else
	SPL_SIZE_CHECK =
	endif

	ifneq ($(CONFIG_TPL_SIZE_LIMIT),0x0)
	TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
	else
	TPL_SIZE_CHECK =
	endif

	ifneq ($(CONFIG_VPL_SIZE_LIMIT),0x0)
	VPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_VPL_SIZE_LIMIT))
	else
	VPL_SIZE_CHECK =
	endif
Quoted 1 line

Is it really worth adding this much of extra code?

Ping @Marek: So are you in favor of this surplus of code?

#10 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

Quoted 1 line · Philip Oberfichtner

On Mon, Aug 11, 2025 at 10:50:17AM +0200, Philip Oberfichtner wrote:

<...>

Quoted 4 lines
Quoted 2 lines

Is it really worth adding this much of extra code?

Ping @Marek: So are you in favor of this surplus of code?

Hi Marek,

You criticised the patch in its current form. Nevertheless, I'm left in the dark which outcome you would approve of.

If I'm not missing out on something, we have three options:

(a) Use the value zero to disable size limits, as this series proposes
(b) Use XXX_HAS_SIZE_LIMIT consistently, implying a lot of extra code
(c) Maintain the status quo, which is 80% of (a) and 20% of (b)

I'd like to bring this thing to an end, finally. So could you please position yourself?

Best regards,
Philip

#11 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

In reply to Philip Oberfichtner
Quoted 29 lines · Philip Oberfichtner
Quoted 28 lines · Tom Rini
Quoted 26 lines · Marek Vasut
Quoted 10 lines · Tom Rini
Quoted 9 lines · Marek Vasut
Quoted 8 lines · Tom Rini
Quoted 6 lines · Marek Vasut
Quoted 2 lines · Philip Oberfichtner

CONFIG_HAS_BOARD_SIZE_LIMIT is obsolete, if we interpret the value "zero" as "unlimited".

This sentence makes no sense. Is the variable not obsolete if its value is non-zero ?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

This is phrased oddly, yes. How about:
By making the code treat a size limit of 0 as unlimited we no longer need to guard asking about having a size limit on the platform.

0 shouldn't mean unlimited, that is just fragile ...

That's a standard unix thing? ulimit -c 0 is unlimited.

This is a really bad argument, because then the counter-argument is, that size = 0 is also a valid size and it shouldn't be conflated with SIZE_LIMIT validity.

My take on this is, don't conflate size-limit "enabled/disabled" with size-limit "value" , these are two separate config options. Mixing them is not helping.

Quoted 7 lines
Quoted 2 lines

I still think it's fine, but it's not worth arguing further over, and we can just make sure to gate all of the symbols rather than 0-is-disabled.

The idea of treating a size limit of zero as unlimited has been common practice in mainline U-Boot since 2019, where CONFIG_SPL_SIZE_LIMIT has been introduced. The same logic has later been applied to TPL and VPL size limits.

That still does not make it the correct approach.

Quoted 5 lines

If we want to consistently stick to the HAS_*_SIZE_LIMIT approach, we'd have to introduce four extra Kconfig options alongside HAS_BOARD_SIZE_LIMIT:

CONFIG_HAS_UBOOT_WITH_SPL_SIZE_LIMIT

What does this one do ?

Quoted 3 lines

CONFIG_HAS_SPL_SIZE_LIMIT
CONFIG_HAS_TPL_SIZE_LIMIT
CONFIG_HAS_VPL_SIZE_LIMIT

This is fine by me.

Quoted 24 lines

Furthermore, the extra lines of code in the toplevel Makefile, which could otherwise be removed:

	ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
	BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
	else
	BOARD_SIZE_CHECK =
	endif

	ifneq ($(CONFIG_HAS_UBOOT_WITH_SPL_SIZE_LIMIT),0x0)
	UBOOT_WITH_SPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_UBOOT_WITH_SPL_SIZE_LIMIT)
	else
	UBOOT_WITH_SPL_SIZE_CHECK =
	endif

	ifneq ($(CONFIG_SPL_SIZE_LIMIT),0x0)
	SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit))
	else
	SPL_SIZE_CHECK =
	endif

	ifneq ($(CONFIG_TPL_SIZE_LIMIT),0x0)
	TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
	else
Quoted 8 lines
	TPL_SIZE_CHECK =
	endif

	ifneq ($(CONFIG_VPL_SIZE_LIMIT),0x0)
	VPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_VPL_SIZE_LIMIT))
	else
	VPL_SIZE_CHECK =
	endif

This code is already in the U-Boot Makefile .

Maybe tools/spl_size_limit.c could be somehow extended to deduplicate the above ?

Quoted 1 line

Is it really worth adding this much of extra code?

Yes, because 0 does not mean unlimited .

#12 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

Quoted 1 line · Marek Vasut

On 8/11/25 10:50 AM, Philip Oberfichtner wrote:

[...]

Quoted 3 lines
Quoted 1 line

CONFIG_HAS_UBOOT_WITH_SPL_SIZE_LIMIT

What does this one do ?

UBOOT_WITH_SPL_SIZE_LIMIT will be required for my currently pending mips board support, see here:
https://patchwork.ozlabs.org/project/uboot/list/?series=468232.

In the next version, I'll include all size limit related patches in THIS series. Sorry for the confusion.

Best regards,
Philip

#13 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

Quoted 5 lines · Philip Oberfichtner
Quoted 1 line · Marek Vasut

On 8/11/25 10:50 AM, Philip Oberfichtner wrote:

[...]

Quoted 2 lines
Quoted 1 line

CONFIG_HAS_UBOOT_WITH_SPL_SIZE_LIMIT

Quoted 8 lines
Quoted 1 line

What does this one do ?

UBOOT_WITH_SPL_SIZE_LIMIT will be required for my currently pending mips board support, see here:
https://patchwork.ozlabs.org/project/uboot/list/?series=468232.

In the next version, I'll include all size limit related patches in THIS series. Sorry for the confusion.

Do it the other way around, finalize this series as a clean up only, and do additional features in follow up patches .

#14 lore raw

Re: [PATCH v2 1/3] Image size checks: Remove HAS_BOARD_SIZE_LIMIT

In reply to Marek Vasut
Quoted 20 lines · Marek Vasut
Quoted 2 lines · Philip Oberfichtner

CONFIG_HAS_BOARD_SIZE_LIMIT is obsolete, if we interpret the value "zero" as "unlimited".

This sentence makes no sense. Is the variable not obsolete if its value is non-zero ?

[...]

lib/efi_loader/Kconfig config EFI_SIGNATURE_SUPPORT · line 76

Quoted 9 lines
lib/efi_loader/Kconfig +1 -1
index c2aa88f59fb..36eed766d31 100644
@@ -74,7 +74,7 @@ config EFI_SIGNATURE_SUPPORT
  config EFI_DEBUG_SUPPORT
  	bool "EFI Debug Support"
-	default y if !HAS_BOARD_SIZE_LIMIT
+	default y if BOARD_SIZE_LIMIT = 0

This looks wrong, no board size limit does not imply EFI anything.

Quoted 1 line

And use some common sense and reduce the CC list.

Wouldn't the CC list naturally be large for a patch changing 43 defconfigs?

#15 lore raw

PATCH v2 2/3 Image size checks: Move all configs in one place

In reply to Philip Oberfichtner

How image size limiting works in U-Boot should be easier to grasp if we have all related options in one place.

---

Notes:
Changes in v2:
- Rebase on current master
- Rebase on my pending mips patch series:
https://patchwork.ozlabs.org/project/uboot/list/?series=468232

 Kconfig                | 66 ++++++++++++++++++++++++++++++++++++++++++
 common/spl/Kconfig     | 45 ----------------------------
 common/spl/Kconfig.tpl |  7 -----
 common/spl/Kconfig.vpl |  7 -----
 4 files changed, 66 insertions(+), 59 deletions(-)
Kconfig +66 -0
index 99f7bb563df..ec20603883b 100644
@@ -535,6 +535,8 @@ config BUILD_TARGET
 	  special image will be automatically built upon calling
 	  make / buildman.
 
+menu "Image size limits"
+
 config BOARD_SIZE_LIMIT
 	int "Maximum size of the U-Boot image in bytes"
 	default 524288 if RCAR_32
@@ -546,6 +548,70 @@ config BOARD_SIZE_LIMIT
 	  include SPL nor TPL, on platforms that use that functionality, they
 	  have separate options to restrict size.
 
+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
+	depends on SPL
+	hex "Maximum size of SPL image"
+	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
+	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
+	help
+	  If enabled, aligned size of global data is reserved in
+	  SPL_SIZE_LIMIT check to ensure such an image does not overflow SRAM
+	  if SPL_SIZE_LIMIT describes the size of SRAM available for SPL when
+	  pre-reloc global data is put into this SRAM, too.
+
+config SPL_SIZE_LIMIT_SUBTRACT_MALLOC
+	bool "SPL image size check: provide space for malloc() pool before relocation"
+	depends on SPL_SIZE_LIMIT > 0
+	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
+	  describes the size of SRAM available for SPL when pre-reloc malloc
+	  pool is put into this SRAM, too.
+
+config SPL_SIZE_LIMIT_PROVIDE_STACK
+	hex "SPL image size check: provide stack space before relocation"
+	depends on SPL_SIZE_LIMIT > 0
+	default 0x0
+	help
+	  If set, this size is reserved in SPL_SIZE_LIMIT check to ensure such
+	  an image does not overflow SRAM if SPL_SIZE_LIMIT describes the size
+	  of SRAM available for SPL when the stack required before reolcation
+	  uses this SRAM, too.
+
+config TPL_SIZE_LIMIT
+	depends on TPL
+	hex "Maximum size of TPL image"
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot TPL image.
+	  If this value is zero, it is ignored.
+
+config VPL_SIZE_LIMIT
+	depends on VPL
+	hex "Maximum size of VPL image"
+	default 0x0
+	help
+	  Specifies the maximum length of the U-Boot VPL image.
+	  If this value is zero, it is ignored.
+
+endmenu
+
 config SYS_CUSTOM_LDSCRIPT
 	bool "Use a custom location for the U-Boot linker script"
 	depends on !COMPILE_TEST
common/spl/Kconfig +0 -45

51 lines not on this page · raw message

common/spl/Kconfig.tpl +0 -7
index a535b61ecd3..515bbeec685 100644
@@ -1,13 +1,6 @@
 menu "TPL configuration options"
 	depends on TPL
 
-config TPL_SIZE_LIMIT
-	hex "Maximum size of TPL image"
-	default 0x0
-	help
-	  Specifies the maximum length of the U-Boot TPL image.
-	  If this value is zero, it is ignored.
-
 config TPL_BINMAN_SYMBOLS
 	bool "Support binman symbols in TPL"
 	depends on TPL_FRAMEWORK && BINMAN
common/spl/Kconfig.vpl +0 -7
index 434562443ac..739f2805315 100644
@@ -220,13 +220,6 @@ config VPL_SERIAL
 	  Enable support for serial in VPL. See SPL_SERIAL for
 	  details.
 
-config VPL_SIZE_LIMIT
-	hex "Maximum size of VPL image"
-	default 0x0
-	help
-	  Specifies the maximum length of the U-Boot VPL image.
-	  If this value is zero, it is ignored.
-
 config VPL_SPI
 	bool "Support SPI drivers"
 	help
Signature · 1 line
2.39.5
#16 lore raw

PATCH v2 3/3 Image size checks: Simplify help text

In reply to Philip Oberfichtner

For coherency, use the same help text for all related size checks options. Furthermore, simplify the depends-on logic.

---

Notes:
Changes in v2: new

 Kconfig | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
Kconfig +3 -5
index ec20603883b..490a706101a 100644
@@ -543,10 +543,8 @@ config BOARD_SIZE_LIMIT
 	default 1048576 if RCAR_64
 	default 0
 	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.
+	  Specifies the maximum length of the U-Boot image.
+	  If this value is zero, it is ignored.
 
 config UBOOT_WITH_SPL_SIZE_LIMIT
 	hex "Maximum size of u-boot-with-spl.bin"
@@ -558,8 +556,8 @@ config UBOOT_WITH_SPL_SIZE_LIMIT
 config SPL_SIZE_LIMIT
 	depends on SPL
 	hex "Maximum size of SPL image"
-	default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB
 	default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
+	default 0x11000 if ARCH_MX6
 	default 0x30000 if ARCH_MVEBU && ARMADA_32BIT
 	default 0x0
 	help
Signature · 1 line
2.39.5
#17 lore raw

Re: [PATCH v2 3/3] Image size checks: Simplify help text

Quoted 17 lines · Philip Oberfichtner

For coherency, use the same help text for all related size checks options. Furthermore, simplify the depends-on logic.

---

Notes:
Changes in v2: new

  Kconfig | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)
Kconfig +0 -0
index ec20603883b..490a706101a 100644

Kconfig config BOARD_SIZE_LIMIT · line 547

Quoted 9 lines
Kconfig +2 -4
@@ -543,10 +543,8 @@ config BOARD_SIZE_LIMIT
  	default 1048576 if RCAR_64
  	default 0
  	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.
+	  Specifies the maximum length of the U-Boot image.
+	  If this value is zero, it is ignored.

This makes the description less accurate, sorry, NAK.

#18 lore raw

Re: [PATCH v2 3/3] Image size checks: Simplify help text

Quoted 13 lines · Marek Vasut
Quoted 12 lines · Philip Oberfichtner

For coherency, use the same help text for all related size checks options. Furthermore, simplify the depends-on logic.

---

Notes:
Changes in v2: new

  Kconfig | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)
Quoted 16 lines
Quoted 5 lines
Kconfig +0 -0
index ec20603883b..490a706101a 100644

Kconfig config BOARD_SIZE_LIMIT · line 547

Quoted 9 lines
Kconfig +2 -4
@@ -543,10 +543,8 @@ config BOARD_SIZE_LIMIT
  	default 1048576 if RCAR_64
  	default 0
  	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.
+	  Specifies the maximum length of the U-Boot image.
+	  If this value is zero, it is ignored.

This makes the description less accurate, sorry, NAK.

What about using just the first half:

Maximum size of the U-Boot image. When defined, the build system checks that the actual size does not exceed it. [plus/minus treatment of the value zero]

And dropping the remainder "This does not include ..."?

I think the hint on the separate options would be unnecessary, if they are placed placed just below.

Best regards,
Philip

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,
Managing Director: Johanna Denk, Tabea Lutz
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
=====================================================================
#19 lore raw

Re: [PATCH v2 3/3] Image size checks: Simplify help text

Philip Oberfichtner <[email protected]> schrieb am Mo., 11. Aug. 2025, 10:57:

Quoted 5 lines · Marek Vasut
Quoted 3 lines · Philip Oberfichtner
Quoted 2 lines

For coherency, use the same help text for all related size checks options. Furthermore, simplify the depends-on logic.

If you want to make two unrelated changes, please, create two separate patches.

Best regards

Heinrich

Quoted 52 lines
Quoted 10 lines
Quoted 10 lines

---

Notes:
Changes in v2: new

  Kconfig | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)
Quoted 11 lines

Kconfig config BOARD_SIZE_LIMIT · line 548

Quoted 11 lines
Kconfig +0 -3
index ec20603883b..490a706101a 100644
@@ -543,10 +543,8 @@ config BOARD_SIZE_LIMIT
    default 1048576 if RCAR_64
    default 0
    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

Quoted 5 lines

Kconfig config BOARD_SIZE_LIMIT · line 547

Quoted 3 lines
Kconfig +2 -1
-     have separate options to restrict size.
+     Specifies the maximum length of the U-Boot image.
+     If this value is zero, it is ignored.

This makes the description less accurate, sorry, NAK.

What about using just the first half:

Maximum size of the U-Boot image. When defined, the build system checks that the actual size does not exceed it. [plus/minus treatment of the value zero]

And dropping the remainder "This does not include ..."?

I think the hint on the separate options would be unnecessary, if they are placed placed just below.

Best regards,
Philip

--
=====================================================================
DENX Software Engineering GmbH,
Managing Director: Johanna Denk, Tabea Lutz
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
=====================================================================

#20 lore raw

Re: [PATCH v2 3/3] Image size checks: Simplify help text

In reply to Philip Oberfichtner
Quoted 31 lines · Philip Oberfichtner
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Philip Oberfichtner

For coherency, use the same help text for all related size checks options. Furthermore, simplify the depends-on logic.

---

Notes:
Changes in v2: new

   Kconfig | 8 +++-----
   1 file changed, 3 insertions(+), 5 deletions(-)
Quoted 16 lines
Quoted 5 lines
Kconfig +0 -0
index ec20603883b..490a706101a 100644

Kconfig config BOARD_SIZE_LIMIT · line 547

Quoted 9 lines
Kconfig +2 -4
@@ -543,10 +543,8 @@ config BOARD_SIZE_LIMIT
   	default 1048576 if RCAR_64
   	default 0
   	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.
+	  Specifies the maximum length of the U-Boot image.
+	  If this value is zero, it is ignored.

This makes the description less accurate, sorry, NAK.

Quoted 7 lines

What about using just the first half:

Maximum size of the U-Boot image. When defined, the build system checks that the actual size does not exceed it. [plus/minus treatment of the value zero]

And dropping the remainder "This does not include ..."?

Why would removing the SPL/TPL clarification be any improvement ?

#21 lore raw

Re: [PATCH v2 3/3] Image size checks: Simplify help text

Quoted 32 lines · Marek Vasut
Quoted 31 lines · Philip Oberfichtner
Quoted 29 lines · Marek Vasut
Quoted 17 lines · Philip Oberfichtner

For coherency, use the same help text for all related size checks options. Furthermore, simplify the depends-on logic.

---

Notes:
Changes in v2: new

   Kconfig | 8 +++-----
   1 file changed, 3 insertions(+), 5 deletions(-)
Kconfig +0 -0
index ec20603883b..490a706101a 100644

Kconfig config BOARD_SIZE_LIMIT · line 547

Quoted 9 lines
Kconfig +2 -4
@@ -543,10 +543,8 @@ config BOARD_SIZE_LIMIT
   	default 1048576 if RCAR_64
   	default 0
   	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.
+	  Specifies the maximum length of the U-Boot image.
+	  If this value is zero, it is ignored.

This makes the description less accurate, sorry, NAK.

Quoted 8 lines
Quoted 7 lines

What about using just the first half:

Maximum size of the U-Boot image. When defined, the build system checks that the actual size does not exceed it. [plus/minus treatment of the value zero]

And dropping the remainder "This does not include ..."?

Why would removing the SPL/TPL clarification be any improvement ?

This statement used to be sensible, as long as all those size limit options were spread out over many different Kconfig files. Now having them all together in on place, I find it rather obvious.

Furthermore, if you want maximum accuracy, you'd have to extend the text to also include a reference to VPL and u-boot-with-spl config options. But even then, you still won't be able to fully grasp the functioning of BOARD_SIZE_LIMIT without consulting the Makefile.

Well, that's what I thought. If you don't agree, I'm also fine to just leave it as is.