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

Attachment: signature.asc
Description: PGP signature

Reply via email to