[PATCH v2] mx6sabresd: Reduce U-Boot proper size to fix boot regression

Jerome Forissier jerome.forissier at linaro.org
Fri Jul 4 17:33:59 CEST 2025


Hi Fabio,

On 7/4/25 16:40, Fabio Estevam wrote:
> The mx6sabresd U-Boot proper binary size has grown beyond the 
> CONFIG_BOARD_SIZE_LIMIT.
> 
> Reduce its size by removing the CONFIG_MULTI_DTB_FIT, BOOTM_PLAN9 and
> BOOTM_RTEMS options.

FWIW, I'm working on a better fix than commit 410d59095a9f ("arm: kirkwood:
fix freeze on boot") for the LTO link issue that appeared when I made the
static initcalls series. Instead of disabling LTO for common/board_{f,r}.c
I will instead move th e problematic inline assembly code to separate .S
files. The idea is to get rid of the selective LTO disabling (there are
others places which do that) and at the same time to not force -marm on
some C files that could totally be compiled in Thumb/Thumb2 mode if it
weren't for this inline assembly with mrc/mcr instructions. In other words,
let the compiler and linker do their job. While it could cost a few bytes
in some cases compared to inlining, I also expect meaningful reductions in
other cases. It will all depend on arm vs. thumb and LTO vs. no LTO.

Anyway, I looked at the impact of my series on the binary size for mx6sabresd.
Good news, it does save 1702 bytes:

$ git log --oneline -n 4
306a6f7adf8 (HEAD -> lto-fixes-tmp2) arm: do not force -marm on some C files and allow LTO everywhere
1680ed4cbb2 arm: move inline assembly CP15 instructions to separate .S files
018263f9278 Revert "arm: asm/system.h: mrc and mcr need .arm if __thumb2__ is not set"
7027b445cc0 Merge tag 'efi-2025-07-rc6' of https://source.denx.de/u-boot/custodians/u-boot-efi
$ tools/buildman/buildman -b lto-fixes-tmp2 -c 4 --step -0 mx6sabresd
$ tools/buildman/buildman -b lto-fixes-tmp2 -c 4 --step 0 -sSd mx6sabresd
Summary of 2 commits for 1 boards (1 thread, 24 jobs per thread)
01: Merge tag 'efi-2025-07-rc6' of https://source.denx.de/u-boot/custodians/u-boot-efi
04: arm: do not force -marm on some C files and allow LTO everywhere
       arm: (for 1/1 boards) all -1702.0 data -4.0 rodata -514.0 text -1184.0
            mx6sabresd     : all -1702 data -4 rodata -514 text -1184
(no errors to report)

So stay tuned for more on this. When the series is ready I will post it for
review with a link to the buildman size stats for all plaforms. It should
happen next week.

Regards,
-- 
Jerome

> According to doc/README.multi-dtb-fit:
> 
> "Usually the DTB is selected by the SPL and passed down to U-Boot. But some
> platforms don't use the SPL. In this case MULTI_DTB_FIT can used to provide
> U-Boot with a choice of DTBs"
> 
> mx6sabresd uses SPL, so MULTI_DTB_FIT can be safely dropped as the DTB
> selection in SPL is done by board_fit_config_name_match().
> 
> Tested boot on the imx6dl and imx6q variants.
> 
> Signed-off-by: Fabio Estevam <festevam at gmail.com>
> ---
>  configs/mx6sabresd_defconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig
> index f041f1fd1a3b..312af2f57fde 100644
> --- a/configs/mx6sabresd_defconfig
> +++ b/configs/mx6sabresd_defconfig
> @@ -40,6 +40,8 @@ CONFIG_SPL_WATCHDOG=y
>  CONFIG_HUSH_PARSER=y
>  CONFIG_SYS_MAXARGS=32
>  CONFIG_CMD_BOOTZ=y
> +# CONFIG_BOOTM_PLAN9 is not set
> +# CONFIG_BOOTM_RTEMS is not set
>  CONFIG_CMD_SPL=y
>  CONFIG_CMD_SPL_WRITE_SIZE=0x20000
>  CONFIG_CMD_GPIO=y
> @@ -65,7 +67,6 @@ CONFIG_EFI_PARTITION=y
>  # CONFIG_SPL_EFI_PARTITION is not set
>  CONFIG_OF_CONTROL=y
>  CONFIG_OF_LIST="imx6q-sabresd imx6qp-sabresd imx6dl-sabresd"
> -CONFIG_MULTI_DTB_FIT=y
>  CONFIG_ENV_OVERWRITE=y
>  CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y


More information about the U-Boot mailing list