Re: [PATCH v1 13/14] arm64: qcom: fix TME IMGAUTH 4K-alignment failure on u-boot.elf

Tom Rini <[email protected]>
Newsgroups gmane.comp.boot-loaders.u-boot.general,gmane.comp.boot-loaders.u-boot
Message-ID <20260817190011.GR3297518@bill-the-cat>
On Mon, Aug 17, 2026 at 03:04:30PM +0530, Aswin Murugan wrote:
> CONFIG_REMAKE_ELF's u-boot.elf link step used the toolchain's
> default page-size flags, and its .lds carried no 4K alignment
> padding, so TME's IMGAUTH rejected the image for misaligned
> segments.
> 
> Add a REMAKE_ELF_LDSCRIPT default for ARCH_SNAPDRAGON pointing at a
> Snapdragon-specific .lds that pads .data to a 4K boundary, so this
> applies to any Snapdragon board using CONFIG_REMAKE_ELF, not just
> nord.
> 
> Signed-off-by: Aswin Murugan <[email protected]>
> ---
>  Kconfig                                         |  8 ++++++++
>  Makefile                                        |  5 +++++
>  arch/arm/mach-snapdragon/Kconfig                |  3 +++
>  .../mach-snapdragon/u-boot-elf-snapdragon.lds   | 17 +++++++++++++++++
>  4 files changed, 33 insertions(+)
>  create mode 100644 arch/arm/mach-snapdragon/u-boot-elf-snapdragon.lds
> 
> diff --git a/Kconfig b/Kconfig
> index c8cfbf5d5de..b169c83728a 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -559,6 +559,14 @@ config REMAKE_ELF
>  	  U-Boot binary (u-boot.bin), which may already have been statically
>  	  relocated and may already have a device-tree appended to it.
>  
> +config REMAKE_ELF_LDSCRIPT
> +	string "Linker script for u-boot.elf"
> +	depends on REMAKE_ELF
> +	default "arch/u-boot-elf.lds"
> +	help
> +	  This allows specifying a linker script that will be used to
> +	  re-wrap the U-Boot binary into an ELF.
> +
>  config BUILD_TARGET
>  	string "Build target special images"
>  	default "u-boot-elf.shdr" if RCAR_64 && RCAR_64_RSIP
> diff --git a/Makefile b/Makefile
> index c6709ff09bb..86a4176c5d7 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2026,6 +2026,11 @@ spl/u-boot-spl-elf.lds: $(SPL_REMAKE_ELF_LDSCRIPT) prepare FORCE
>  u-boot-elf.lds: arch/u-boot-elf.lds prepare FORCE
>  	$(call if_changed_dep,cpp_lds)
>  
> +REMAKE_ELF_LDSCRIPT := $(addprefix $(srctree)/,$(CONFIG_REMAKE_ELF_LDSCRIPT:"%"=%))
> +
> +u-boot-elf.lds: $(REMAKE_ELF_LDSCRIPT) prepare FORCE
> +	$(call if_changed_dep,cpp_lds)

Shouldn't we just adjust the current u-boot-elf.lds rule to use
REMAKE_ELF_LDSCRIPT?

[snip]
> diff --git a/arch/arm/mach-snapdragon/Kconfig b/arch/arm/mach-snapdragon/Kconfig
> index 98b6655385e..08c100d0b85 100644
> --- a/arch/arm/mach-snapdragon/Kconfig
> +++ b/arch/arm/mach-snapdragon/Kconfig
> @@ -26,6 +26,9 @@ config SYS_MALLOC_LEN
>  config LNX_KRNL_IMG_TEXT_OFFSET_BASE
>  	default 0x80000000
>  
> +config REMAKE_ELF_LDSCRIPT
> +	default "arch/arm/mach-snapdragon/u-boot-elf-snapdragon.lds"
> +

This should just go in the top-level Kconfig part as default ... if
ARCH_SNAPDRAGON.

-- 
Tom
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQTzzqh0PWDgGS+bTHor4qD1Cr/kCgUCaoNaMwAKCRAr4qD1Cr/k
CvkHAP4nzGO3/cAOO22ebjNyqMIoUbbL+o9k0JEehUYUrqi4DQEAyVUQxKoNQrUX
Vn1tNH3Sk18vp7j8FE63AxJyBBiIAgs=
=xde6
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.