public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: Tom Rini <trini@konsulko.com>, u-boot@lists.denx.de
Cc: "Marek Vasut" <marek.vasut+renesas@mailbox.org>,
	"Beleswar Padhi" <b-padhi@ti.com>,
	"Marek Behún" <kabel@kernel.org>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Mario Six" <mario.six@gdsys.cc>,
	"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: [PATCH 07/10] powerpc: Update linker scripts to ensure appended device tree is aligned
Date: Fri, 6 Feb 2026 08:18:16 +0100	[thread overview]
Message-ID: <937f4082-985e-4f14-bd90-1bcddd62b8b0@kernel.org> (raw)
In-Reply-To: <20260115222828.3931345-8-trini@konsulko.com>



Le 15/01/2026 à 23:19, Tom Rini a écrit :
> With commit 0535e46d55d7 ("scripts/dtc: Update to upstream version
> v1.7.2-35-g52f07dcca47c") it is now a fatal error to U-Boot if our
> device tree is not 8-byte aligned. In commit f613a6e15ef7 ("ARM: OMAP2+:
> Pad SPL binary to 8-byte alignment before DTB") Beleswar Padhi explains
> that we must have ALIGN(x) statements inside of a section to ensure that
> padding is included and not simply that the linker address counter is
> incremented. To that end, this patch:
> - Aligns the final section before _end by 8-bytes by adding '. =
>    ALIGN(8);' or changing an existing ALIGN(4) statement.
> - Ensure that we do have alignment by adding an ASSERT so that when not
>    aligned we fail to link (and explain why).
> 
> Signed-off-by: Tom Rini <trini@konsulko.com>

Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>

> ---
> Cc: "Marek Behún" <kabel@kernel.org>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Cc: Mario Six <mario.six@gdsys.cc>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> ---
>   arch/powerpc/cpu/mpc83xx/u-boot.lds | 3 +++
>   arch/powerpc/cpu/mpc85xx/u-boot.lds | 4 +++-
>   board/cssi/cmpc885/u-boot.lds       | 3 +++
>   board/cssi/mcr3000/u-boot.lds       | 3 +++
>   4 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/cpu/mpc83xx/u-boot.lds b/arch/powerpc/cpu/mpc83xx/u-boot.lds
> index 1a1e537b2a76..5becc4d236ef 100644
> --- a/arch/powerpc/cpu/mpc83xx/u-boot.lds
> +++ b/arch/powerpc/cpu/mpc83xx/u-boot.lds
> @@ -56,6 +56,7 @@ SECTIONS
>      * _end - This is end of u-boot.bin image.
>      * dtb will be appended here to make u-boot-dtb.bin
>      */
> +  . = ALIGN(8);
>     _end = .;
>   
>     . = ALIGN(4096);
> @@ -77,3 +78,5 @@ SECTIONS
>     PROVIDE (end = .);
>   }
>   ENTRY(_start)
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
> diff --git a/arch/powerpc/cpu/mpc85xx/u-boot.lds b/arch/powerpc/cpu/mpc85xx/u-boot.lds
> index 3af0dfdf336b..3c9959bef097 100644
> --- a/arch/powerpc/cpu/mpc85xx/u-boot.lds
> +++ b/arch/powerpc/cpu/mpc85xx/u-boot.lds
> @@ -78,7 +78,7 @@ SECTIONS
>     __init_begin = .;
>     .text.init : { *(.text.init) }
>     .data.init : { *(.data.init) }
> -  . = ALIGN(4);
> +  . = ALIGN(8);
>     __init_end = .;
>     _end = .;
>   
> @@ -119,3 +119,5 @@ SECTIONS
>     __bss_end = . ;
>     PROVIDE (end = .);
>   }
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
> diff --git a/board/cssi/cmpc885/u-boot.lds b/board/cssi/cmpc885/u-boot.lds
> index 167606357e00..da9cff64d465 100644
> --- a/board/cssi/cmpc885/u-boot.lds
> +++ b/board/cssi/cmpc885/u-boot.lds
> @@ -72,6 +72,7 @@ SECTIONS
>   	 * _end - This is end of u-boot.bin image.
>   	 * dtb will be appended here to make u-boot-dtb.bin
>   	 */
> +	. = ALIGN(8);
>   	_end = .;
>   
>   	. = ALIGN(4096);
> @@ -93,3 +94,5 @@ SECTIONS
>   	PROVIDE (end = .);
>   }
>   ENTRY(_start)
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
> diff --git a/board/cssi/mcr3000/u-boot.lds b/board/cssi/mcr3000/u-boot.lds
> index 66afdebc0f77..1fd98726b2a8 100644
> --- a/board/cssi/mcr3000/u-boot.lds
> +++ b/board/cssi/mcr3000/u-boot.lds
> @@ -72,6 +72,7 @@ SECTIONS
>   	 * _end - This is end of u-boot.bin image.
>   	 * dtb will be appended here to make u-boot-dtb.bin
>   	 */
> +	. = ALIGN(8);
>   	_end = .;
>   
>   	. = ALIGN(4096);
> @@ -93,3 +94,5 @@ SECTIONS
>   	PROVIDE (end = .);
>   }
>   ENTRY(_start)
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");


  reply	other threads:[~2026-02-06 12:53 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15 22:19 [PATCH 00/10] Update linker scripts to ensure appended device tree is correctly aligned Tom Rini
2026-01-15 22:19 ` [PATCH 01/10] Makefile: Have binary_size_check report only first match of _image_binary_end Tom Rini
2026-01-22  9:07   ` Marek Vasut
2026-01-22 14:21     ` Tom Rini
2026-01-15 22:19 ` [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned Tom Rini
2026-01-16  9:59   ` Ilias Apalodimas
2026-01-16 14:40     ` Tom Rini
2026-01-20  8:38       ` Ilias Apalodimas
2026-01-20 14:27         ` Tom Rini
2026-01-16 10:00   ` Michal Simek
2026-01-22  3:08   ` Fabio Estevam
2026-01-22  3:33     ` Fabio Estevam
2026-01-22 11:22       ` Marek Vasut
2026-01-22 14:23         ` Tom Rini
2026-01-22 18:47           ` Fabio Estevam
2026-01-22 19:10             ` Tom Rini
2026-01-22 19:19               ` Fabio Estevam
2026-01-22 19:28                 ` Tom Rini
2026-01-22 19:32                   ` Fabio Estevam
2026-01-22 19:42                 ` Tom Rini
2026-01-22 22:56                   ` Fabio Estevam
2026-01-22 23:24                     ` Tom Rini
2026-01-23  0:25                       ` Fabio Estevam
2026-01-23  0:52                         ` Fabio Estevam
2026-01-23 14:27                           ` Tom Rini
2026-01-23 15:45                             ` Fabio Estevam
2026-01-23 15:50                               ` Tom Rini
2026-01-22 14:25     ` Tom Rini
2026-02-04 21:16   ` Phil Sutter
2026-02-04 21:20     ` Tom Rini
2026-02-04 21:27       ` Phil Sutter
2026-02-04 21:31         ` Tom Rini
2026-02-04 21:40           ` Phil Sutter
2026-02-04 21:50             ` Tom Rini
2026-02-04 23:00               ` Phil Sutter
2026-02-04 23:04                 ` Tom Rini
2026-02-04 23:29                   ` Phil Sutter
2026-02-04 23:35                     ` Tom Rini
2026-02-04 23:48                       ` Phil Sutter
2026-02-05 18:01                         ` Tom Rini
2026-01-15 22:19 ` [PATCH 03/10] m68k: " Tom Rini
2026-01-15 22:19 ` [PATCH 04/10] microblaze: " Tom Rini
2026-01-16  9:59   ` Michal Simek
2026-01-16 10:00   ` Ilias Apalodimas
2026-01-15 22:19 ` [PATCH 05/10] mips: " Tom Rini
2026-01-20 13:57   ` Daniel Schwierzeck
2026-01-15 22:19 ` [PATCH 06/10] nios2: " Tom Rini
2026-01-16 10:00   ` Ilias Apalodimas
2026-01-15 22:19 ` [PATCH 07/10] powerpc: " Tom Rini
2026-02-06  7:18   ` Christophe Leroy (CS GROUP) [this message]
2026-01-15 22:19 ` [PATCH 08/10] riscv: " Tom Rini
2026-01-16  1:27   ` Leo Liang
2026-01-16  9:49   ` Ilias Apalodimas
2026-01-15 22:19 ` [PATCH 09/10] sandbox: " Tom Rini
2026-01-15 22:19 ` [PATCH 10/10] x86: " Tom Rini
2026-01-20 18:08 ` [PATCH 00/10] Update linker scripts to ensure appended device tree is correctly aligned Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=937f4082-985e-4f14-bd90-1bcddd62b8b0@kernel.org \
    --to=chleroy@kernel.org \
    --cc=b-padhi@ti.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kabel@kernel.org \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=mario.six@gdsys.cc \
    --cc=richard.henderson@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox