* [PATCH 01/10] Makefile: Have binary_size_check report only first match of _image_binary_end
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 ` Tom Rini
2026-01-22 9:07 ` Marek Vasut
2026-01-15 22:19 ` [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned Tom Rini
` (9 subsequent siblings)
10 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-01-15 22:19 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Beleswar Padhi
If we have ASSERT macros that validate the position of
_image_binary_end, our awk expression will report a string that causes
the rest of our check to fail with garbage values. Have it exit after
the first match to fix this.
Signed-off-by: Tom Rini <trini@konsulko.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 50737f938503..37cebd4f8edd 100644
--- a/Makefile
+++ b/Makefile
@@ -1583,7 +1583,7 @@ binary_size_check: u-boot-nodtb.bin FORCE
map_size=$(shell cat u-boot.map | \
awk ' \
/_image_copy_start/ { start = $$1 } \
- /_image_binary_end/ { end = $$1 } \
+ /_image_binary_end/ { end = $$1;exit } \
END { \
if (start != "" && end != "") \
print end " " start; \
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 01/10] Makefile: Have binary_size_check report only first match of _image_binary_end
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
0 siblings, 1 reply; 56+ messages in thread
From: Marek Vasut @ 2026-01-22 9:07 UTC (permalink / raw)
To: Tom Rini, u-boot; +Cc: Marek Vasut, Beleswar Padhi
On 1/15/26 11:19 PM, Tom Rini wrote:
> If we have ASSERT macros that validate the position of
> _image_binary_end, our awk expression will report a string that causes
> the rest of our check to fail with garbage values. Have it exit after
> the first match to fix this.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 50737f938503..37cebd4f8edd 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1583,7 +1583,7 @@ binary_size_check: u-boot-nodtb.bin FORCE
> map_size=$(shell cat u-boot.map | \
> awk ' \
> /_image_copy_start/ { start = $$1 } \
> - /_image_binary_end/ { end = $$1 } \
> + /_image_binary_end/ { end = $$1;exit } \
Can this same check also confirm that _image_binary_end or __bss_end is
at 8 byte aligned offset ? That would allow us to trap all the built-in
DT alignment errors.
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 01/10] Makefile: Have binary_size_check report only first match of _image_binary_end
2026-01-22 9:07 ` Marek Vasut
@ 2026-01-22 14:21 ` Tom Rini
0 siblings, 0 replies; 56+ messages in thread
From: Tom Rini @ 2026-01-22 14:21 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Marek Vasut, Beleswar Padhi
[-- Attachment #1: Type: text/plain, Size: 1175 bytes --]
On Thu, Jan 22, 2026 at 10:07:56AM +0100, Marek Vasut wrote:
> On 1/15/26 11:19 PM, Tom Rini wrote:
> > If we have ASSERT macros that validate the position of
> > _image_binary_end, our awk expression will report a string that causes
> > the rest of our check to fail with garbage values. Have it exit after
> > the first match to fix this.
> >
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> > ---
> > Makefile | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 50737f938503..37cebd4f8edd 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1583,7 +1583,7 @@ binary_size_check: u-boot-nodtb.bin FORCE
> > map_size=$(shell cat u-boot.map | \
> > awk ' \
> > /_image_copy_start/ { start = $$1 } \
> > - /_image_binary_end/ { end = $$1 } \
> > + /_image_binary_end/ { end = $$1;exit } \
> Can this same check also confirm that _image_binary_end or __bss_end is at 8
> byte aligned offset ? That would allow us to trap all the built-in DT
> alignment errors.
We should have that now via the linker scripts. Also note that this call
here isn't universal.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
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-15 22:19 ` Tom Rini
2026-01-16 9:59 ` Ilias Apalodimas
` (3 more replies)
2026-01-15 22:19 ` [PATCH 03/10] m68k: " Tom Rini
` (8 subsequent siblings)
10 siblings, 4 replies; 56+ messages in thread
From: Tom Rini @ 2026-01-15 22:19 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team, Adam Ford,
Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Fabio Estevam, Ilias Apalodimas, Jagan Teki, Joel Stanley,
Kever Yang, Michal Simek, Philipp Tomsich, Richard Henderson,
Ryan Chen, Stefano Babic
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:
- Expands some linker sections to be more readable when adding a second
statement to the section.
- Aligns the final section before _end (for U-Boot) or
_image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
'. = ALIGN(8);' to the final section before the symbol.
- Ensure that we do have alignment by adding an ASSERT so that when not
aligned we fail to link (and explain why).
- Remove now-spurious '. = ALIGN(x);' statements that were intended to
provide the above alignments.
Signed-off-by: Tom Rini <trini@konsulko.com>
---
The only part of this I am only mostly rather than fully confident in is
having caught all cases of having SPL_SEPARATE_BSS being false. I
believe I have as the generic ARM SPL linker script enforces the BSS
ending with 8-byte alignment, and the point of the ASSERTs here is to
catch the case where the section we're adding the ALIGN to ends up being
empty and so that ALIGN would become useless.
Cc: "NXP i.MX U-Boot Team" <uboot-imx@nxp.com>
Cc: Adam Ford <aford173@gmail.com>
Cc: Andre Przywara <andre.przywara@arm.com>
Cc: Aspeed BMC SW team <BMC-SW@aspeedtech.com>
Cc: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Cc: Eugen Hristev <eugen.hristev@linaro.org>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Philipp Tomsich <philipp.tomsich@vrull.eu>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Ryan Chen <ryan_chen@aspeedtech.com>
Cc: Stefano Babic <sbabic@nabladev.com>
---
arch/arm/cpu/arm1136/u-boot-spl.lds | 8 ++++++--
arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds | 5 ++++-
arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds | 5 ++++-
arch/arm/cpu/armv7/sunxi/u-boot-spl.lds | 5 ++++-
arch/arm/cpu/armv8/u-boot-spl.lds | 4 +++-
arch/arm/cpu/armv8/u-boot.lds | 2 ++
arch/arm/cpu/u-boot-spl.lds | 5 ++++-
arch/arm/cpu/u-boot.lds | 4 ++++
arch/arm/mach-aspeed/ast2600/u-boot-spl.lds | 4 ++++
arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 9 +++++++--
arch/arm/mach-at91/armv7/u-boot-spl.lds | 9 +++++++--
arch/arm/mach-omap2/u-boot-spl.lds | 3 +++
arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 5 ++++-
arch/arm/mach-zynq/u-boot-spl.lds | 6 ++++--
arch/arm/mach-zynq/u-boot.lds | 3 +++
board/davinci/da8xxevm/u-boot-spl-da850evm.lds | 4 ++++
board/samsung/common/exynos-uboot-spl.lds | 5 ++++-
17 files changed, 71 insertions(+), 15 deletions(-)
diff --git a/arch/arm/cpu/arm1136/u-boot-spl.lds b/arch/arm/cpu/arm1136/u-boot-spl.lds
index b7af29183a97..22a9302275ae 100644
--- a/arch/arm/cpu/arm1136/u-boot-spl.lds
+++ b/arch/arm/cpu/arm1136/u-boot-spl.lds
@@ -30,8 +30,10 @@ SECTIONS
.rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram
. = ALIGN(4);
- .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
- . = ALIGN(4);
+ .data : {
+ *(SORT_BY_ALIGNMENT(.data*))
+ . = ALIGN(8);
+ } >.sram
__image_copy_end = .;
_end = .;
@@ -44,3 +46,5 @@ SECTIONS
__bss_end = .;
} >.sdram
}
+
+ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
diff --git a/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
index 7c6309246f8b..b4adae272eba 100644
--- a/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
+++ b/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
@@ -45,7 +45,7 @@ SECTIONS
. = ALIGN(4);
__bss_start = .;
*(.bss*)
- . = ALIGN(4);
+ . = ALIGN(8);
__bss_end = .;
}
@@ -62,3 +62,6 @@ SECTIONS
.gnu : { *(.gnu*) }
.ARM.exidx : { *(.ARM.exidx*) }
}
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
diff --git a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
index cf65e8c46281..2225985c79c0 100644
--- a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
+++ b/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
@@ -31,9 +31,9 @@ SECTIONS
. = ALIGN(4);
__u_boot_list : {
KEEP(*(SORT(__u_boot_list*)));
+ . = ALIGN(8);
} > .sram
- . = ALIGN(4);
__image_copy_end = .;
_end = .;
_image_binary_end = .;
@@ -47,3 +47,6 @@ SECTIONS
__bss_end = .;
} > .sdram
}
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
index fb7a789b28b8..e69291d8be6d 100644
--- a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
+++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
@@ -40,9 +40,9 @@ SECTIONS
. = ALIGN(4);
__u_boot_list : {
KEEP(*(SORT(__u_boot_list*)));
+ . = ALIGN(8);
} > .sram
- . = ALIGN(4);
__image_copy_end = .;
_end = .;
_image_binary_end = .;
@@ -56,3 +56,6 @@ SECTIONS
__bss_end = .;
} > .sdram
}
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
diff --git a/arch/arm/cpu/armv8/u-boot-spl.lds b/arch/arm/cpu/armv8/u-boot-spl.lds
index c4f83ec9cfc4..d9963846c4f4 100644
--- a/arch/arm/cpu/armv8/u-boot-spl.lds
+++ b/arch/arm/cpu/armv8/u-boot-spl.lds
@@ -52,9 +52,9 @@ SECTIONS
__u_boot_list : {
. = ALIGN(8);
KEEP(*(SORT(__u_boot_list*)));
+ . = ALIGN(8);
} >.sram
- . = ALIGN(8);
__image_copy_end = .;
_end = .;
_image_binary_end = .;
@@ -89,5 +89,7 @@ SECTIONS
#endif
}
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
ASSERT(ADDR(.bss) % 8 == 0, \
".bss must be 8-byte aligned");
diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds
index f4ce98c82c8d..704e0bf9468d 100644
--- a/arch/arm/cpu/armv8/u-boot.lds
+++ b/arch/arm/cpu/armv8/u-boot.lds
@@ -175,3 +175,5 @@ SECTIONS
#include "linux-kernel-image-header-vars.h"
#endif
}
+
+ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds
index 5aecb61ce902..d780a5060774 100644
--- a/arch/arm/cpu/u-boot-spl.lds
+++ b/arch/arm/cpu/u-boot-spl.lds
@@ -51,9 +51,9 @@ SECTIONS
__rel_dyn_start = .;
*(.rel*)
__rel_dyn_end = .;
+ . = ALIGN(8);
}
- . = ALIGN(8);
_image_binary_end = .;
_end = .;
@@ -80,6 +80,9 @@ ASSERT(__image_copy_end - __image_copy_start <= (IMAGE_MAX_SIZE), \
"SPL image too big");
#endif
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
+
#if defined(CONFIG_SPL_BSS_MAX_SIZE)
ASSERT(__bss_end - __bss_start <= (CONFIG_SPL_BSS_MAX_SIZE), \
"SPL image BSS too big");
diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index 78aad093d3b2..8e2266a90fe2 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -164,6 +164,7 @@ SECTIONS
__rel_dyn_start = .;
*(.rel*)
__rel_dyn_end = .;
+ . = ALIGN(8);
}
_end = .;
@@ -192,3 +193,6 @@ SECTIONS
/DISCARD/ : { *(.ARM.exidx*) }
/DISCARD/ : { *(.gnu.linkonce.armexidx.*) }
}
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
diff --git a/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds b/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds
index 9502a7384b53..c9664a6ce566 100644
--- a/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds
+++ b/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds
@@ -59,6 +59,7 @@ SECTIONS
__rel_dyn_start = .;
*(.rel*)
__rel_dyn_end = .;
+ . = ALIGN(8);
} > .nor
_end = .;
@@ -79,6 +80,9 @@ ASSERT(__image_copy_end - __image_copy_start <= (IMAGE_MAX_SIZE), \
"SPL image too big");
#endif
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
+
#if defined(CONFIG_SPL_BSS_MAX_SIZE)
ASSERT(__bss_end - __bss_start <= (CONFIG_SPL_BSS_MAX_SIZE), \
"SPL image BSS too big");
diff --git a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds
index 09cf838cf96e..1af4f7b6524c 100644
--- a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds
+++ b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds
@@ -29,9 +29,11 @@ SECTIONS
.data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
. = ALIGN(4);
- __u_boot_list : { KEEP(*(SORT(__u_boot_list*))) } > .sram
+ __u_boot_list : {
+ KEEP(*(SORT(__u_boot_list*)))
+ . = ALIGN(8);
+ } > .sram
- . = ALIGN(4);
__image_copy_end = .;
_end = .;
_image_binary_end = .;
@@ -51,6 +53,9 @@ ASSERT(__image_copy_end - __start <= (IMAGE_MAX_SIZE), \
"SPL image too big");
#endif
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
+
#if defined(CONFIG_SPL_BSS_MAX_SIZE)
ASSERT(__bss_end - __bss_start <= (CONFIG_SPL_BSS_MAX_SIZE), \
"SPL image BSS too big");
diff --git a/arch/arm/mach-at91/armv7/u-boot-spl.lds b/arch/arm/mach-at91/armv7/u-boot-spl.lds
index 460a91d93ec4..287764df48ff 100644
--- a/arch/arm/mach-at91/armv7/u-boot-spl.lds
+++ b/arch/arm/mach-at91/armv7/u-boot-spl.lds
@@ -36,9 +36,11 @@ SECTIONS
.data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
. = ALIGN(4);
- __u_boot_list : { KEEP(*(SORT(__u_boot_list*))) } > .sram
+ __u_boot_list : {
+ KEEP(*(SORT(__u_boot_list*)))
+ . = ALIGN(8);
+ } > .sram
- . = ALIGN(4);
__image_copy_end = .;
_end = .;
_image_binary_end = .;
@@ -52,3 +54,6 @@ SECTIONS
__bss_end = .;
} >.sdram
}
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
diff --git a/arch/arm/mach-omap2/u-boot-spl.lds b/arch/arm/mach-omap2/u-boot-spl.lds
index 5ad169a37b73..86ab692ae390 100644
--- a/arch/arm/mach-omap2/u-boot-spl.lds
+++ b/arch/arm/mach-omap2/u-boot-spl.lds
@@ -55,3 +55,6 @@ SECTIONS
__bss_end = .;
} >.sdram
}
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
diff --git a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
index 958a1b70aefe..2c0f5c3e5f32 100644
--- a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
+++ b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
@@ -42,9 +42,9 @@ SECTIONS
__u_boot_list : {
. = ALIGN(8);
KEEP(*(SORT(__u_boot_list*)));
+ . = ALIGN(8);
}
- . = ALIGN(8);
__image_copy_end = .;
_end = .;
_image_binary_end = .;
@@ -69,6 +69,9 @@ ASSERT(__image_copy_end - __image_copy_start < (CONFIG_TPL_MAX_SIZE), \
"TPL image too big");
#endif
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
+
#if defined(CONFIG_TPL_BSS_MAX_SIZE)
ASSERT(__bss_end - __bss_start < (CONFIG_TPL_BSS_MAX_SIZE), \
"TPL image BSS too big");
diff --git a/arch/arm/mach-zynq/u-boot-spl.lds b/arch/arm/mach-zynq/u-boot-spl.lds
index d96a57702886..17f0d7c9b72f 100644
--- a/arch/arm/mach-zynq/u-boot-spl.lds
+++ b/arch/arm/mach-zynq/u-boot-spl.lds
@@ -39,10 +39,9 @@ SECTIONS
. = ALIGN(4);
__u_boot_list : {
KEEP(*(SORT(__u_boot_list*)));
+ . = ALIGN(8);
} > .sram
- . = ALIGN(4);
-
_image_binary_end = .;
_end = .;
@@ -62,3 +61,6 @@ SECTIONS
/DISCARD/ : { *(.interp*) }
/DISCARD/ : { *(.gnu*) }
}
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds
index f52523edf490..2a8e3399e0bf 100644
--- a/arch/arm/mach-zynq/u-boot.lds
+++ b/arch/arm/mach-zynq/u-boot.lds
@@ -66,6 +66,7 @@ SECTIONS
__rel_dyn_start = .;
*(.rel*)
__rel_dyn_end = .;
+ . = ALIGN(8);
}
_end = .;
@@ -98,3 +99,5 @@ SECTIONS
/DISCARD/ : { *(.ARM.exidx*) }
/DISCARD/ : { *(.gnu.linkonce.armexidx.*) }
}
+
+ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
diff --git a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
index 56d6f4f114b9..d1a82e118af1 100644
--- a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
+++ b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
@@ -43,6 +43,7 @@ SECTIONS
__rel_dyn_start = .;
*(.rel*)
__rel_dyn_end = .;
+ . = ALIGN(8);
} >.sram
__image_copy_end = .;
@@ -58,3 +59,6 @@ SECTIONS
__bss_end = .;
} >.sdram
}
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
diff --git a/board/samsung/common/exynos-uboot-spl.lds b/board/samsung/common/exynos-uboot-spl.lds
index 9d3b57e98dbb..62e150bcf335 100644
--- a/board/samsung/common/exynos-uboot-spl.lds
+++ b/board/samsung/common/exynos-uboot-spl.lds
@@ -48,7 +48,10 @@ SECTIONS
. = ALIGN(4);
__bss_start = .;
*(.bss*)
- . = ALIGN(4);
+ . = ALIGN(8);
__bss_end = .;
} >.sram
}
+
+ASSERT(__bss_end % 8 == 0, \
+ "__bss_end must be 8-byte aligned for device tree");
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
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-16 10:00 ` Michal Simek
` (2 subsequent siblings)
3 siblings, 1 reply; 56+ messages in thread
From: Ilias Apalodimas @ 2026-01-16 9:59 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Fabio Estevam, Jagan Teki, Joel Stanley,
Kever Yang, Michal Simek, Philipp Tomsich, Richard Henderson,
Ryan Chen, Stefano Babic
Hi Tom,
arch/arm/cpu/armv8/u-boot.lds and arch/arm/mach-omap2/u-boot-spl.lds
can use the same alignment. Is the omap2 case covered by the TI
patches? I think it's better if you bundle this up in this series
Cheers
/Ilias
On Fri, 16 Jan 2026 at 00:28, Tom Rini <trini@konsulko.com> wrote:
>
> 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:
> - Expands some linker sections to be more readable when adding a second
> statement to the section.
> - Aligns the final section before _end (for U-Boot) or
> _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> '. = ALIGN(8);' to the final section before the symbol.
> - Ensure that we do have alignment by adding an ASSERT so that when not
> aligned we fail to link (and explain why).
> - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> provide the above alignments.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> The only part of this I am only mostly rather than fully confident in is
> having caught all cases of having SPL_SEPARATE_BSS being false. I
> believe I have as the generic ARM SPL linker script enforces the BSS
> ending with 8-byte alignment, and the point of the ASSERTs here is to
> catch the case where the section we're adding the ALIGN to ends up being
> empty and so that ALIGN would become useless.
>
> Cc: "NXP i.MX U-Boot Team" <uboot-imx@nxp.com>
> Cc: Adam Ford <aford173@gmail.com>
> Cc: Andre Przywara <andre.przywara@arm.com>
> Cc: Aspeed BMC SW team <BMC-SW@aspeedtech.com>
> Cc: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
> Cc: Eugen Hristev <eugen.hristev@linaro.org>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Joel Stanley <joel@jms.id.au>
> Cc: Kever Yang <kever.yang@rock-chips.com>
> Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Philipp Tomsich <philipp.tomsich@vrull.eu>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Ryan Chen <ryan_chen@aspeedtech.com>
> Cc: Stefano Babic <sbabic@nabladev.com>
> ---
> arch/arm/cpu/arm1136/u-boot-spl.lds | 8 ++++++--
> arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds | 5 ++++-
> arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds | 5 ++++-
> arch/arm/cpu/armv7/sunxi/u-boot-spl.lds | 5 ++++-
> arch/arm/cpu/armv8/u-boot-spl.lds | 4 +++-
> arch/arm/cpu/armv8/u-boot.lds | 2 ++
> arch/arm/cpu/u-boot-spl.lds | 5 ++++-
> arch/arm/cpu/u-boot.lds | 4 ++++
> arch/arm/mach-aspeed/ast2600/u-boot-spl.lds | 4 ++++
> arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 9 +++++++--
> arch/arm/mach-at91/armv7/u-boot-spl.lds | 9 +++++++--
> arch/arm/mach-omap2/u-boot-spl.lds | 3 +++
> arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 5 ++++-
> arch/arm/mach-zynq/u-boot-spl.lds | 6 ++++--
> arch/arm/mach-zynq/u-boot.lds | 3 +++
> board/davinci/da8xxevm/u-boot-spl-da850evm.lds | 4 ++++
> board/samsung/common/exynos-uboot-spl.lds | 5 ++++-
> 17 files changed, 71 insertions(+), 15 deletions(-)
>
> diff --git a/arch/arm/cpu/arm1136/u-boot-spl.lds b/arch/arm/cpu/arm1136/u-boot-spl.lds
> index b7af29183a97..22a9302275ae 100644
> --- a/arch/arm/cpu/arm1136/u-boot-spl.lds
> +++ b/arch/arm/cpu/arm1136/u-boot-spl.lds
> @@ -30,8 +30,10 @@ SECTIONS
> .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram
>
> . = ALIGN(4);
> - .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
> - . = ALIGN(4);
> + .data : {
> + *(SORT_BY_ALIGNMENT(.data*))
> + . = ALIGN(8);
> + } >.sram
> __image_copy_end = .;
> _end = .;
>
> @@ -44,3 +46,5 @@ SECTIONS
> __bss_end = .;
> } >.sdram
> }
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
> index 7c6309246f8b..b4adae272eba 100644
> --- a/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
> +++ b/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
> @@ -45,7 +45,7 @@ SECTIONS
> . = ALIGN(4);
> __bss_start = .;
> *(.bss*)
> - . = ALIGN(4);
> + . = ALIGN(8);
> __bss_end = .;
> }
>
> @@ -62,3 +62,6 @@ SECTIONS
> .gnu : { *(.gnu*) }
> .ARM.exidx : { *(.ARM.exidx*) }
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
> index cf65e8c46281..2225985c79c0 100644
> --- a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
> +++ b/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
> @@ -31,9 +31,9 @@ SECTIONS
> . = ALIGN(4);
> __u_boot_list : {
> KEEP(*(SORT(__u_boot_list*)));
> + . = ALIGN(8);
> } > .sram
>
> - . = ALIGN(4);
> __image_copy_end = .;
> _end = .;
> _image_binary_end = .;
> @@ -47,3 +47,6 @@ SECTIONS
> __bss_end = .;
> } > .sdram
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> index fb7a789b28b8..e69291d8be6d 100644
> --- a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> +++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> @@ -40,9 +40,9 @@ SECTIONS
> . = ALIGN(4);
> __u_boot_list : {
> KEEP(*(SORT(__u_boot_list*)));
> + . = ALIGN(8);
> } > .sram
>
> - . = ALIGN(4);
> __image_copy_end = .;
> _end = .;
> _image_binary_end = .;
> @@ -56,3 +56,6 @@ SECTIONS
> __bss_end = .;
> } > .sdram
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/cpu/armv8/u-boot-spl.lds b/arch/arm/cpu/armv8/u-boot-spl.lds
> index c4f83ec9cfc4..d9963846c4f4 100644
> --- a/arch/arm/cpu/armv8/u-boot-spl.lds
> +++ b/arch/arm/cpu/armv8/u-boot-spl.lds
> @@ -52,9 +52,9 @@ SECTIONS
> __u_boot_list : {
> . = ALIGN(8);
> KEEP(*(SORT(__u_boot_list*)));
> + . = ALIGN(8);
> } >.sram
>
> - . = ALIGN(8);
> __image_copy_end = .;
> _end = .;
> _image_binary_end = .;
> @@ -89,5 +89,7 @@ SECTIONS
> #endif
> }
>
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> ASSERT(ADDR(.bss) % 8 == 0, \
> ".bss must be 8-byte aligned");
> diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds
> index f4ce98c82c8d..704e0bf9468d 100644
> --- a/arch/arm/cpu/armv8/u-boot.lds
> +++ b/arch/arm/cpu/armv8/u-boot.lds
> @@ -175,3 +175,5 @@ SECTIONS
> #include "linux-kernel-image-header-vars.h"
> #endif
> }
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds
> index 5aecb61ce902..d780a5060774 100644
> --- a/arch/arm/cpu/u-boot-spl.lds
> +++ b/arch/arm/cpu/u-boot-spl.lds
> @@ -51,9 +51,9 @@ SECTIONS
> __rel_dyn_start = .;
> *(.rel*)
> __rel_dyn_end = .;
> + . = ALIGN(8);
> }
>
> - . = ALIGN(8);
> _image_binary_end = .;
> _end = .;
>
> @@ -80,6 +80,9 @@ ASSERT(__image_copy_end - __image_copy_start <= (IMAGE_MAX_SIZE), \
> "SPL image too big");
> #endif
>
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> +
> #if defined(CONFIG_SPL_BSS_MAX_SIZE)
> ASSERT(__bss_end - __bss_start <= (CONFIG_SPL_BSS_MAX_SIZE), \
> "SPL image BSS too big");
> diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
> index 78aad093d3b2..8e2266a90fe2 100644
> --- a/arch/arm/cpu/u-boot.lds
> +++ b/arch/arm/cpu/u-boot.lds
> @@ -164,6 +164,7 @@ SECTIONS
> __rel_dyn_start = .;
> *(.rel*)
> __rel_dyn_end = .;
> + . = ALIGN(8);
> }
>
> _end = .;
> @@ -192,3 +193,6 @@ SECTIONS
> /DISCARD/ : { *(.ARM.exidx*) }
> /DISCARD/ : { *(.gnu.linkonce.armexidx.*) }
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds b/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds
> index 9502a7384b53..c9664a6ce566 100644
> --- a/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds
> +++ b/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds
> @@ -59,6 +59,7 @@ SECTIONS
> __rel_dyn_start = .;
> *(.rel*)
> __rel_dyn_end = .;
> + . = ALIGN(8);
> } > .nor
>
> _end = .;
> @@ -79,6 +80,9 @@ ASSERT(__image_copy_end - __image_copy_start <= (IMAGE_MAX_SIZE), \
> "SPL image too big");
> #endif
>
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> +
> #if defined(CONFIG_SPL_BSS_MAX_SIZE)
> ASSERT(__bss_end - __bss_start <= (CONFIG_SPL_BSS_MAX_SIZE), \
> "SPL image BSS too big");
> diff --git a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds
> index 09cf838cf96e..1af4f7b6524c 100644
> --- a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds
> +++ b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds
> @@ -29,9 +29,11 @@ SECTIONS
> .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
>
> . = ALIGN(4);
> - __u_boot_list : { KEEP(*(SORT(__u_boot_list*))) } > .sram
> + __u_boot_list : {
> + KEEP(*(SORT(__u_boot_list*)))
> + . = ALIGN(8);
> + } > .sram
>
> - . = ALIGN(4);
> __image_copy_end = .;
> _end = .;
> _image_binary_end = .;
> @@ -51,6 +53,9 @@ ASSERT(__image_copy_end - __start <= (IMAGE_MAX_SIZE), \
> "SPL image too big");
> #endif
>
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> +
> #if defined(CONFIG_SPL_BSS_MAX_SIZE)
> ASSERT(__bss_end - __bss_start <= (CONFIG_SPL_BSS_MAX_SIZE), \
> "SPL image BSS too big");
> diff --git a/arch/arm/mach-at91/armv7/u-boot-spl.lds b/arch/arm/mach-at91/armv7/u-boot-spl.lds
> index 460a91d93ec4..287764df48ff 100644
> --- a/arch/arm/mach-at91/armv7/u-boot-spl.lds
> +++ b/arch/arm/mach-at91/armv7/u-boot-spl.lds
> @@ -36,9 +36,11 @@ SECTIONS
> .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
>
> . = ALIGN(4);
> - __u_boot_list : { KEEP(*(SORT(__u_boot_list*))) } > .sram
> + __u_boot_list : {
> + KEEP(*(SORT(__u_boot_list*)))
> + . = ALIGN(8);
> + } > .sram
>
> - . = ALIGN(4);
> __image_copy_end = .;
> _end = .;
> _image_binary_end = .;
> @@ -52,3 +54,6 @@ SECTIONS
> __bss_end = .;
> } >.sdram
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/mach-omap2/u-boot-spl.lds b/arch/arm/mach-omap2/u-boot-spl.lds
> index 5ad169a37b73..86ab692ae390 100644
> --- a/arch/arm/mach-omap2/u-boot-spl.lds
> +++ b/arch/arm/mach-omap2/u-boot-spl.lds
> @@ -55,3 +55,6 @@ SECTIONS
> __bss_end = .;
> } >.sdram
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
> index 958a1b70aefe..2c0f5c3e5f32 100644
> --- a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
> +++ b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
> @@ -42,9 +42,9 @@ SECTIONS
> __u_boot_list : {
> . = ALIGN(8);
> KEEP(*(SORT(__u_boot_list*)));
> + . = ALIGN(8);
> }
>
> - . = ALIGN(8);
> __image_copy_end = .;
> _end = .;
> _image_binary_end = .;
> @@ -69,6 +69,9 @@ ASSERT(__image_copy_end - __image_copy_start < (CONFIG_TPL_MAX_SIZE), \
> "TPL image too big");
> #endif
>
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> +
> #if defined(CONFIG_TPL_BSS_MAX_SIZE)
> ASSERT(__bss_end - __bss_start < (CONFIG_TPL_BSS_MAX_SIZE), \
> "TPL image BSS too big");
> diff --git a/arch/arm/mach-zynq/u-boot-spl.lds b/arch/arm/mach-zynq/u-boot-spl.lds
> index d96a57702886..17f0d7c9b72f 100644
> --- a/arch/arm/mach-zynq/u-boot-spl.lds
> +++ b/arch/arm/mach-zynq/u-boot-spl.lds
> @@ -39,10 +39,9 @@ SECTIONS
> . = ALIGN(4);
> __u_boot_list : {
> KEEP(*(SORT(__u_boot_list*)));
> + . = ALIGN(8);
> } > .sram
>
> - . = ALIGN(4);
> -
> _image_binary_end = .;
>
> _end = .;
> @@ -62,3 +61,6 @@ SECTIONS
> /DISCARD/ : { *(.interp*) }
> /DISCARD/ : { *(.gnu*) }
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds
> index f52523edf490..2a8e3399e0bf 100644
> --- a/arch/arm/mach-zynq/u-boot.lds
> +++ b/arch/arm/mach-zynq/u-boot.lds
> @@ -66,6 +66,7 @@ SECTIONS
> __rel_dyn_start = .;
> *(.rel*)
> __rel_dyn_end = .;
> + . = ALIGN(8);
> }
>
> _end = .;
> @@ -98,3 +99,5 @@ SECTIONS
> /DISCARD/ : { *(.ARM.exidx*) }
> /DISCARD/ : { *(.gnu.linkonce.armexidx.*) }
> }
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
> diff --git a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
> index 56d6f4f114b9..d1a82e118af1 100644
> --- a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
> +++ b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
> @@ -43,6 +43,7 @@ SECTIONS
> __rel_dyn_start = .;
> *(.rel*)
> __rel_dyn_end = .;
> + . = ALIGN(8);
> } >.sram
>
> __image_copy_end = .;
> @@ -58,3 +59,6 @@ SECTIONS
> __bss_end = .;
> } >.sdram
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/board/samsung/common/exynos-uboot-spl.lds b/board/samsung/common/exynos-uboot-spl.lds
> index 9d3b57e98dbb..62e150bcf335 100644
> --- a/board/samsung/common/exynos-uboot-spl.lds
> +++ b/board/samsung/common/exynos-uboot-spl.lds
> @@ -48,7 +48,10 @@ SECTIONS
> . = ALIGN(4);
> __bss_start = .;
> *(.bss*)
> - . = ALIGN(4);
> + . = ALIGN(8);
> __bss_end = .;
> } >.sram
> }
> +
> +ASSERT(__bss_end % 8 == 0, \
> + "__bss_end must be 8-byte aligned for device tree");
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-16 9:59 ` Ilias Apalodimas
@ 2026-01-16 14:40 ` Tom Rini
2026-01-20 8:38 ` Ilias Apalodimas
0 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-01-16 14:40 UTC (permalink / raw)
To: Ilias Apalodimas
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Fabio Estevam, Jagan Teki, Joel Stanley,
Kever Yang, Michal Simek, Philipp Tomsich, Richard Henderson,
Ryan Chen, Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 506 bytes --]
On Fri, Jan 16, 2026 at 11:59:49AM +0200, Ilias Apalodimas wrote:
> Hi Tom,
>
> arch/arm/cpu/armv8/u-boot.lds and arch/arm/mach-omap2/u-boot-spl.lds
> can use the same alignment. Is the omap2 case covered by the TI
> patches? I think it's better if you bundle this up in this series
Correct, the TI patches fix omap2 (and a number of other platforms, that
linker script should be renamed, it's the sram+sdram SPL case)
platforms. I mentioned needing it in the cover letter btw :)
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-16 14:40 ` Tom Rini
@ 2026-01-20 8:38 ` Ilias Apalodimas
2026-01-20 14:27 ` Tom Rini
0 siblings, 1 reply; 56+ messages in thread
From: Ilias Apalodimas @ 2026-01-20 8:38 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Fabio Estevam, Jagan Teki, Joel Stanley,
Kever Yang, Michal Simek, Philipp Tomsich, Richard Henderson,
Ryan Chen, Stefano Babic
Hi Tom
On Fri, 16 Jan 2026 at 16:40, Tom Rini <trini@konsulko.com> wrote:
>
> On Fri, Jan 16, 2026 at 11:59:49AM +0200, Ilias Apalodimas wrote:
>
> > Hi Tom,
> >
> > arch/arm/cpu/armv8/u-boot.lds and arch/arm/mach-omap2/u-boot-spl.lds
> > can use the same alignment. Is the omap2 case covered by the TI
> > patches? I think it's better if you bundle this up in this series
>
> Correct, the TI patches fix omap2 (and a number of other platforms, that
> linker script should be renamed, it's the sram+sdram SPL case)
> platforms. I mentioned needing it in the cover letter btw :)
Ah, I wasn't in the cc list for the cover letter and missed it. I am
ok with the TI patches going on a different patchset. Can you amend
the arm64 .lds file?
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
>
> --
> Tom
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-20 8:38 ` Ilias Apalodimas
@ 2026-01-20 14:27 ` Tom Rini
0 siblings, 0 replies; 56+ messages in thread
From: Tom Rini @ 2026-01-20 14:27 UTC (permalink / raw)
To: Ilias Apalodimas
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Fabio Estevam, Jagan Teki, Joel Stanley,
Kever Yang, Michal Simek, Philipp Tomsich, Richard Henderson,
Ryan Chen, Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 939 bytes --]
On Tue, Jan 20, 2026 at 10:38:19AM +0200, Ilias Apalodimas wrote:
> Hi Tom
>
> On Fri, 16 Jan 2026 at 16:40, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Fri, Jan 16, 2026 at 11:59:49AM +0200, Ilias Apalodimas wrote:
> >
> > > Hi Tom,
> > >
> > > arch/arm/cpu/armv8/u-boot.lds and arch/arm/mach-omap2/u-boot-spl.lds
> > > can use the same alignment. Is the omap2 case covered by the TI
> > > patches? I think it's better if you bundle this up in this series
> >
> > Correct, the TI patches fix omap2 (and a number of other platforms, that
> > linker script should be renamed, it's the sram+sdram SPL case)
> > platforms. I mentioned needing it in the cover letter btw :)
>
> Ah, I wasn't in the cc list for the cover letter and missed it. I am
> ok with the TI patches going on a different patchset. Can you amend
> the arm64 .lds file?
Yes, I can amend the arm64 .lds file as well for consistency.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
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 10:00 ` Michal Simek
2026-01-22 3:08 ` Fabio Estevam
2026-02-04 21:16 ` Phil Sutter
3 siblings, 0 replies; 56+ messages in thread
From: Michal Simek @ 2026-01-16 10:00 UTC (permalink / raw)
To: Tom Rini, u-boot
Cc: Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team, Adam Ford,
Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Fabio Estevam, Ilias Apalodimas, Jagan Teki, Joel Stanley,
Kever Yang, Philipp Tomsich, Richard Henderson, Ryan Chen,
Stefano Babic
On 1/15/26 23:19, Tom Rini wrote:
> 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:
> - Expands some linker sections to be more readable when adding a second
> statement to the section.
> - Aligns the final section before _end (for U-Boot) or
> _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> '. = ALIGN(8);' to the final section before the symbol.
> - Ensure that we do have alignment by adding an ASSERT so that when not
> aligned we fail to link (and explain why).
> - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> provide the above alignments.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> The only part of this I am only mostly rather than fully confident in is
> having caught all cases of having SPL_SEPARATE_BSS being false. I
> believe I have as the generic ARM SPL linker script enforces the BSS
> ending with 8-byte alignment, and the point of the ASSERTs here is to
> catch the case where the section we're adding the ALIGN to ends up being
> empty and so that ALIGN would become useless.
>
> Cc: "NXP i.MX U-Boot Team" <uboot-imx@nxp.com>
> Cc: Adam Ford <aford173@gmail.com>
> Cc: Andre Przywara <andre.przywara@arm.com>
> Cc: Aspeed BMC SW team <BMC-SW@aspeedtech.com>
> Cc: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
> Cc: Eugen Hristev <eugen.hristev@linaro.org>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Joel Stanley <joel@jms.id.au>
> Cc: Kever Yang <kever.yang@rock-chips.com>
> Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Philipp Tomsich <philipp.tomsich@vrull.eu>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Ryan Chen <ryan_chen@aspeedtech.com>
> Cc: Stefano Babic <sbabic@nabladev.com>
> ---
> arch/arm/cpu/arm1136/u-boot-spl.lds | 8 ++++++--
> arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds | 5 ++++-
> arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds | 5 ++++-
> arch/arm/cpu/armv7/sunxi/u-boot-spl.lds | 5 ++++-
> arch/arm/cpu/armv8/u-boot-spl.lds | 4 +++-
> arch/arm/cpu/armv8/u-boot.lds | 2 ++
> arch/arm/cpu/u-boot-spl.lds | 5 ++++-
> arch/arm/cpu/u-boot.lds | 4 ++++
> arch/arm/mach-aspeed/ast2600/u-boot-spl.lds | 4 ++++
> arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 9 +++++++--
> arch/arm/mach-at91/armv7/u-boot-spl.lds | 9 +++++++--
> arch/arm/mach-omap2/u-boot-spl.lds | 3 +++
> arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 5 ++++-
> arch/arm/mach-zynq/u-boot-spl.lds | 6 ++++--
> arch/arm/mach-zynq/u-boot.lds | 3 +++
> board/davinci/da8xxevm/u-boot-spl-da850evm.lds | 4 ++++
> board/samsung/common/exynos-uboot-spl.lds | 5 ++++-
> 17 files changed, 71 insertions(+), 15 deletions(-)
>
> diff --git a/arch/arm/cpu/arm1136/u-boot-spl.lds b/arch/arm/cpu/arm1136/u-boot-spl.lds
> index b7af29183a97..22a9302275ae 100644
> --- a/arch/arm/cpu/arm1136/u-boot-spl.lds
> +++ b/arch/arm/cpu/arm1136/u-boot-spl.lds
> @@ -30,8 +30,10 @@ SECTIONS
> .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram
>
> . = ALIGN(4);
> - .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
> - . = ALIGN(4);
> + .data : {
> + *(SORT_BY_ALIGNMENT(.data*))
> + . = ALIGN(8);
> + } >.sram
> __image_copy_end = .;
> _end = .;
>
> @@ -44,3 +46,5 @@ SECTIONS
> __bss_end = .;
> } >.sdram
> }
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
> index 7c6309246f8b..b4adae272eba 100644
> --- a/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
> +++ b/arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds
> @@ -45,7 +45,7 @@ SECTIONS
> . = ALIGN(4);
> __bss_start = .;
> *(.bss*)
> - . = ALIGN(4);
> + . = ALIGN(8);
> __bss_end = .;
> }
>
> @@ -62,3 +62,6 @@ SECTIONS
> .gnu : { *(.gnu*) }
> .ARM.exidx : { *(.ARM.exidx*) }
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
> index cf65e8c46281..2225985c79c0 100644
> --- a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
> +++ b/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
> @@ -31,9 +31,9 @@ SECTIONS
> . = ALIGN(4);
> __u_boot_list : {
> KEEP(*(SORT(__u_boot_list*)));
> + . = ALIGN(8);
> } > .sram
>
> - . = ALIGN(4);
> __image_copy_end = .;
> _end = .;
> _image_binary_end = .;
> @@ -47,3 +47,6 @@ SECTIONS
> __bss_end = .;
> } > .sdram
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> index fb7a789b28b8..e69291d8be6d 100644
> --- a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> +++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> @@ -40,9 +40,9 @@ SECTIONS
> . = ALIGN(4);
> __u_boot_list : {
> KEEP(*(SORT(__u_boot_list*)));
> + . = ALIGN(8);
> } > .sram
>
> - . = ALIGN(4);
> __image_copy_end = .;
> _end = .;
> _image_binary_end = .;
> @@ -56,3 +56,6 @@ SECTIONS
> __bss_end = .;
> } > .sdram
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/cpu/armv8/u-boot-spl.lds b/arch/arm/cpu/armv8/u-boot-spl.lds
> index c4f83ec9cfc4..d9963846c4f4 100644
> --- a/arch/arm/cpu/armv8/u-boot-spl.lds
> +++ b/arch/arm/cpu/armv8/u-boot-spl.lds
> @@ -52,9 +52,9 @@ SECTIONS
> __u_boot_list : {
> . = ALIGN(8);
> KEEP(*(SORT(__u_boot_list*)));
> + . = ALIGN(8);
> } >.sram
>
> - . = ALIGN(8);
> __image_copy_end = .;
> _end = .;
> _image_binary_end = .;
> @@ -89,5 +89,7 @@ SECTIONS
> #endif
> }
>
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> ASSERT(ADDR(.bss) % 8 == 0, \
> ".bss must be 8-byte aligned");
> diff --git a/arch/arm/cpu/armv8/u-boot.lds b/arch/arm/cpu/armv8/u-boot.lds
> index f4ce98c82c8d..704e0bf9468d 100644
> --- a/arch/arm/cpu/armv8/u-boot.lds
> +++ b/arch/arm/cpu/armv8/u-boot.lds
> @@ -175,3 +175,5 @@ SECTIONS
> #include "linux-kernel-image-header-vars.h"
> #endif
> }
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds
> index 5aecb61ce902..d780a5060774 100644
> --- a/arch/arm/cpu/u-boot-spl.lds
> +++ b/arch/arm/cpu/u-boot-spl.lds
> @@ -51,9 +51,9 @@ SECTIONS
> __rel_dyn_start = .;
> *(.rel*)
> __rel_dyn_end = .;
> + . = ALIGN(8);
> }
>
> - . = ALIGN(8);
> _image_binary_end = .;
> _end = .;
>
> @@ -80,6 +80,9 @@ ASSERT(__image_copy_end - __image_copy_start <= (IMAGE_MAX_SIZE), \
> "SPL image too big");
> #endif
>
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> +
> #if defined(CONFIG_SPL_BSS_MAX_SIZE)
> ASSERT(__bss_end - __bss_start <= (CONFIG_SPL_BSS_MAX_SIZE), \
> "SPL image BSS too big");
> diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
> index 78aad093d3b2..8e2266a90fe2 100644
> --- a/arch/arm/cpu/u-boot.lds
> +++ b/arch/arm/cpu/u-boot.lds
> @@ -164,6 +164,7 @@ SECTIONS
> __rel_dyn_start = .;
> *(.rel*)
> __rel_dyn_end = .;
> + . = ALIGN(8);
> }
>
> _end = .;
> @@ -192,3 +193,6 @@ SECTIONS
> /DISCARD/ : { *(.ARM.exidx*) }
> /DISCARD/ : { *(.gnu.linkonce.armexidx.*) }
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds b/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds
> index 9502a7384b53..c9664a6ce566 100644
> --- a/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds
> +++ b/arch/arm/mach-aspeed/ast2600/u-boot-spl.lds
> @@ -59,6 +59,7 @@ SECTIONS
> __rel_dyn_start = .;
> *(.rel*)
> __rel_dyn_end = .;
> + . = ALIGN(8);
> } > .nor
>
> _end = .;
> @@ -79,6 +80,9 @@ ASSERT(__image_copy_end - __image_copy_start <= (IMAGE_MAX_SIZE), \
> "SPL image too big");
> #endif
>
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> +
> #if defined(CONFIG_SPL_BSS_MAX_SIZE)
> ASSERT(__bss_end - __bss_start <= (CONFIG_SPL_BSS_MAX_SIZE), \
> "SPL image BSS too big");
> diff --git a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds
> index 09cf838cf96e..1af4f7b6524c 100644
> --- a/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds
> +++ b/arch/arm/mach-at91/arm926ejs/u-boot-spl.lds
> @@ -29,9 +29,11 @@ SECTIONS
> .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
>
> . = ALIGN(4);
> - __u_boot_list : { KEEP(*(SORT(__u_boot_list*))) } > .sram
> + __u_boot_list : {
> + KEEP(*(SORT(__u_boot_list*)))
> + . = ALIGN(8);
> + } > .sram
>
> - . = ALIGN(4);
> __image_copy_end = .;
> _end = .;
> _image_binary_end = .;
> @@ -51,6 +53,9 @@ ASSERT(__image_copy_end - __start <= (IMAGE_MAX_SIZE), \
> "SPL image too big");
> #endif
>
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> +
> #if defined(CONFIG_SPL_BSS_MAX_SIZE)
> ASSERT(__bss_end - __bss_start <= (CONFIG_SPL_BSS_MAX_SIZE), \
> "SPL image BSS too big");
> diff --git a/arch/arm/mach-at91/armv7/u-boot-spl.lds b/arch/arm/mach-at91/armv7/u-boot-spl.lds
> index 460a91d93ec4..287764df48ff 100644
> --- a/arch/arm/mach-at91/armv7/u-boot-spl.lds
> +++ b/arch/arm/mach-at91/armv7/u-boot-spl.lds
> @@ -36,9 +36,11 @@ SECTIONS
> .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
>
> . = ALIGN(4);
> - __u_boot_list : { KEEP(*(SORT(__u_boot_list*))) } > .sram
> + __u_boot_list : {
> + KEEP(*(SORT(__u_boot_list*)))
> + . = ALIGN(8);
> + } > .sram
>
> - . = ALIGN(4);
> __image_copy_end = .;
> _end = .;
> _image_binary_end = .;
> @@ -52,3 +54,6 @@ SECTIONS
> __bss_end = .;
> } >.sdram
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/mach-omap2/u-boot-spl.lds b/arch/arm/mach-omap2/u-boot-spl.lds
> index 5ad169a37b73..86ab692ae390 100644
> --- a/arch/arm/mach-omap2/u-boot-spl.lds
> +++ b/arch/arm/mach-omap2/u-boot-spl.lds
> @@ -55,3 +55,6 @@ SECTIONS
> __bss_end = .;
> } >.sdram
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
> index 958a1b70aefe..2c0f5c3e5f32 100644
> --- a/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
> +++ b/arch/arm/mach-rockchip/u-boot-tpl-v8.lds
> @@ -42,9 +42,9 @@ SECTIONS
> __u_boot_list : {
> . = ALIGN(8);
> KEEP(*(SORT(__u_boot_list*)));
> + . = ALIGN(8);
> }
>
> - . = ALIGN(8);
> __image_copy_end = .;
> _end = .;
> _image_binary_end = .;
> @@ -69,6 +69,9 @@ ASSERT(__image_copy_end - __image_copy_start < (CONFIG_TPL_MAX_SIZE), \
> "TPL image too big");
> #endif
>
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> +
> #if defined(CONFIG_TPL_BSS_MAX_SIZE)
> ASSERT(__bss_end - __bss_start < (CONFIG_TPL_BSS_MAX_SIZE), \
> "TPL image BSS too big");
> diff --git a/arch/arm/mach-zynq/u-boot-spl.lds b/arch/arm/mach-zynq/u-boot-spl.lds
> index d96a57702886..17f0d7c9b72f 100644
> --- a/arch/arm/mach-zynq/u-boot-spl.lds
> +++ b/arch/arm/mach-zynq/u-boot-spl.lds
> @@ -39,10 +39,9 @@ SECTIONS
> . = ALIGN(4);
> __u_boot_list : {
> KEEP(*(SORT(__u_boot_list*)));
> + . = ALIGN(8);
> } > .sram
>
> - . = ALIGN(4);
> -
> _image_binary_end = .;
>
> _end = .;
> @@ -62,3 +61,6 @@ SECTIONS
> /DISCARD/ : { *(.interp*) }
> /DISCARD/ : { *(.gnu*) }
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/arm/mach-zynq/u-boot.lds b/arch/arm/mach-zynq/u-boot.lds
> index f52523edf490..2a8e3399e0bf 100644
> --- a/arch/arm/mach-zynq/u-boot.lds
> +++ b/arch/arm/mach-zynq/u-boot.lds
> @@ -66,6 +66,7 @@ SECTIONS
> __rel_dyn_start = .;
> *(.rel*)
> __rel_dyn_end = .;
> + . = ALIGN(8);
> }
>
> _end = .;
> @@ -98,3 +99,5 @@ SECTIONS
> /DISCARD/ : { *(.ARM.exidx*) }
> /DISCARD/ : { *(.gnu.linkonce.armexidx.*) }
> }
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
> diff --git a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
> index 56d6f4f114b9..d1a82e118af1 100644
> --- a/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
> +++ b/board/davinci/da8xxevm/u-boot-spl-da850evm.lds
> @@ -43,6 +43,7 @@ SECTIONS
> __rel_dyn_start = .;
> *(.rel*)
> __rel_dyn_end = .;
> + . = ALIGN(8);
> } >.sram
>
> __image_copy_end = .;
> @@ -58,3 +59,6 @@ SECTIONS
> __bss_end = .;
> } >.sdram
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/board/samsung/common/exynos-uboot-spl.lds b/board/samsung/common/exynos-uboot-spl.lds
> index 9d3b57e98dbb..62e150bcf335 100644
> --- a/board/samsung/common/exynos-uboot-spl.lds
> +++ b/board/samsung/common/exynos-uboot-spl.lds
> @@ -48,7 +48,10 @@ SECTIONS
> . = ALIGN(4);
> __bss_start = .;
> *(.bss*)
> - . = ALIGN(4);
> + . = ALIGN(8);
> __bss_end = .;
> } >.sram
> }
> +
> +ASSERT(__bss_end % 8 == 0, \
> + "__bss_end must be 8-byte aligned for device tree");
Tested-by: Michal Simek <michal.simek@amd.com> # Zynq
Thanks,
Michal
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
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 10:00 ` Michal Simek
@ 2026-01-22 3:08 ` Fabio Estevam
2026-01-22 3:33 ` Fabio Estevam
2026-01-22 14:25 ` Tom Rini
2026-02-04 21:16 ` Phil Sutter
3 siblings, 2 replies; 56+ messages in thread
From: Fabio Estevam @ 2026-01-22 3:08 UTC (permalink / raw)
To: Tom Rini, Kever Yang
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Ilias Apalodimas, Jagan Teki, Joel Stanley,
Michal Simek, Philipp Tomsich, Richard Henderson, Ryan Chen,
Stefano Babic
Hi Tom,
On Thu, Jan 15, 2026 at 7:28 PM Tom Rini <trini@konsulko.com> wrote:
>
> 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:
> - Expands some linker sections to be more readable when adding a second
> statement to the section.
> - Aligns the final section before _end (for U-Boot) or
> _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> '. = ALIGN(8);' to the final section before the symbol.
> - Ensure that we do have alignment by adding an ASSERT so that when not
> aligned we fail to link (and explain why).
> - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> provide the above alignments.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
> The only part of this I am only mostly rather than fully confident in is
> having caught all cases of having SPL_SEPARATE_BSS being false. I
> believe I have as the generic ARM SPL linker script enforces the BSS
> ending with 8-byte alignment, and the point of the ASSERTs here is to
> catch the case where the section we're adding the ALIGN to ends up being
> empty and so that ALIGN would become useless.
I'm working on bringing up Rockchip RV1103 (ARMv7 SoC, no custom .lds file)
After this patch is applied, the board does not boot anymore:
Missing DTB
spl_early_init() failed: -2
### ERROR ### Please RESET the board ###
If I force "imply SPL_SEPARATE_BSS" in the SoC Kconfig, the board boots again.
In this case, the build shows some warnings:
LD spl/u-boot-spl
/usr/bin/arm-linux-gnueabihf-ld: invalid length for memory region .sram
/usr/bin/arm-linux-gnueabihf-ld: invalid origin for memory region .sdram
/usr/bin/arm-linux-gnueabihf-ld: invalid length for memory region .sdram
OBJCOPY spl/u-boot-spl-nodtb.bin
SYM spl/u-boot-spl.sym
CAT spl/u-boot-spl-dtb.bin
COPY spl/u-boot-spl.bin
BINMAN .binman_stamp
OFCHK .config
RV1108 is also an ARMv7 without SPL_SEPARATE_BSS, so I believe it is
also affected by this change.
What do you suggest?
Thanks
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
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:25 ` Tom Rini
1 sibling, 1 reply; 56+ messages in thread
From: Fabio Estevam @ 2026-01-22 3:33 UTC (permalink / raw)
To: Tom Rini, Kever Yang
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Ilias Apalodimas, Jagan Teki, Joel Stanley,
Michal Simek, Philipp Tomsich, Richard Henderson, Ryan Chen,
Stefano Babic
On Thu, Jan 22, 2026 at 12:08 AM Fabio Estevam <festevam@gmail.com> wrote:
> RV1108 is also an ARMv7 without SPL_SEPARATE_BSS, so I believe it is
> also affected by this change.
The change below restores the boot:
diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds
index d780a5060774..fc2b7fcb969f 100644
--- a/arch/arm/cpu/u-boot-spl.lds
+++ b/arch/arm/cpu/u-boot-spl.lds
@@ -40,6 +40,7 @@ SECTIONS
.binman_sym_table : {
__binman_sym_start = .;
KEEP(*(SORT(.binman_sym*)));
+ . = ALIGN(8);
__binman_sym_end = .;
}
If you agree, I can send a formal patch.
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-22 3:33 ` Fabio Estevam
@ 2026-01-22 11:22 ` Marek Vasut
2026-01-22 14:23 ` Tom Rini
0 siblings, 1 reply; 56+ messages in thread
From: Marek Vasut @ 2026-01-22 11:22 UTC (permalink / raw)
To: Fabio Estevam, Tom Rini, Kever Yang
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Ilias Apalodimas, Jagan Teki, Joel Stanley,
Michal Simek, Philipp Tomsich, Richard Henderson, Ryan Chen,
Stefano Babic
On 1/22/26 4:33 AM, Fabio Estevam wrote:
> On Thu, Jan 22, 2026 at 12:08 AM Fabio Estevam <festevam@gmail.com> wrote:
>
>> RV1108 is also an ARMv7 without SPL_SEPARATE_BSS, so I believe it is
>> also affected by this change.
>
> The change below restores the boot:
>
> diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds
> index d780a5060774..fc2b7fcb969f 100644
> --- a/arch/arm/cpu/u-boot-spl.lds
> +++ b/arch/arm/cpu/u-boot-spl.lds
> @@ -40,6 +40,7 @@ SECTIONS
> .binman_sym_table : {
> __binman_sym_start = .;
> KEEP(*(SORT(.binman_sym*)));
> + . = ALIGN(8);
> __binman_sym_end = .;
> }
>
> If you agree, I can send a formal patch.
Shouldn't we instead find a way to surely align ONLY the
_image_binary_end or __bss_end symbols instead of adding random ALIGN(8)
into the linker scripts ?
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-22 11:22 ` Marek Vasut
@ 2026-01-22 14:23 ` Tom Rini
2026-01-22 18:47 ` Fabio Estevam
0 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-01-22 14:23 UTC (permalink / raw)
To: Marek Vasut
Cc: Fabio Estevam, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]
On Thu, Jan 22, 2026 at 12:22:01PM +0100, Marek Vasut wrote:
> On 1/22/26 4:33 AM, Fabio Estevam wrote:
> > On Thu, Jan 22, 2026 at 12:08 AM Fabio Estevam <festevam@gmail.com> wrote:
> >
> > > RV1108 is also an ARMv7 without SPL_SEPARATE_BSS, so I believe it is
> > > also affected by this change.
> >
> > The change below restores the boot:
> >
> > diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds
> > index d780a5060774..fc2b7fcb969f 100644
> > --- a/arch/arm/cpu/u-boot-spl.lds
> > +++ b/arch/arm/cpu/u-boot-spl.lds
> > @@ -40,6 +40,7 @@ SECTIONS
> > .binman_sym_table : {
> > __binman_sym_start = .;
> > KEEP(*(SORT(.binman_sym*)));
> > + . = ALIGN(8);
> > __binman_sym_end = .;
> > }
> >
> > If you agree, I can send a formal patch.
>
> Shouldn't we instead find a way to surely align ONLY the _image_binary_end
> or __bss_end symbols instead of adding random ALIGN(8) into the linker
> scripts ?
We did that, yes. I'm not sure what Fabio is running in to here..
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-22 14:23 ` Tom Rini
@ 2026-01-22 18:47 ` Fabio Estevam
2026-01-22 19:10 ` Tom Rini
0 siblings, 1 reply; 56+ messages in thread
From: Fabio Estevam @ 2026-01-22 18:47 UTC (permalink / raw)
To: Tom Rini
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
Hi Tom and Marek,
On Thu, Jan 22, 2026 at 11:23 AM Tom Rini <trini@konsulko.com> wrote:
> We did that, yes. I'm not sure what Fabio is running in to here..
Let me share more information with you.
The board I am working on is based on Rockchip RV1103 (ARMv7) and will
submit it upstream soon.
The board was booting fin last week. Yesterday, after rebasing it
against the top of the tree U-Boot, the board no longer boots.
The boot error is:
Missing DTB
spl_early_init() failed: -2
### ERROR ### Please RESET the board ###
After running "git bisect", I found Tom's commit 8b0ebe054bb3 ("arm:
Update linker scripts to ensure appended device tree is aligned") to
be the guilty one.
If I partially revert the arm/cpu/u-boot-spl.lds change, as shown
below, the board boots again:
--- a/arch/arm/cpu/u-boot-spl.lds
+++ b/arch/arm/cpu/u-boot-spl.lds
@@ -51,9 +51,9 @@ SECTIONS
__rel_dyn_start = .;
*(.rel*)
__rel_dyn_end = .;
- . = ALIGN(8);
}
+ . = ALIGN(8);
_image_binary_end = .;
_end = .;
With Tom's commit applied (failing case), the spl/u-boot-spl.map looks
like this:
.rel.dyn 0x0000000000015cac 0x4
0x0000000000015cac __rel_dyn_start = .
*(.rel*)
.rel.iplt 0x0000000000015cac 0x0 arch/arm/cpu/armv7/start.o
0x0000000000015cac __rel_dyn_end = .
0x0000000000015cb0 . = ALIGN (0x8)
*fill* 0x0000000000015cac 0x4
0x0000000000015cb0 _image_binary_end = .
0x0000000000015cb0 _end = .
With the partial revert above (booting case):
.rel.dyn 0x0000000000015cac 0x0
0x0000000000015cac __rel_dyn_start = .
*(.rel*)
.rel.iplt 0x0000000000015cac 0x0 arch/arm/cpu/armv7/start.o
0x0000000000015cac __rel_dyn_end = .
0x0000000000015cb0 . = ALIGN (0x8)
0x0000000000015cb0 _image_binary_end = .
0x0000000000015cb0 _end = .
Basically, in the good case, .rel.dyn is zero. In the failing case:
.rel.dyn is 0x4 and *fill* is 0x4 as well.
This change messes with dtb being found in SPL.
What would be a proper fix?
Thanks
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-22 18:47 ` Fabio Estevam
@ 2026-01-22 19:10 ` Tom Rini
2026-01-22 19:19 ` Fabio Estevam
0 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-01-22 19:10 UTC (permalink / raw)
To: Fabio Estevam
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 3311 bytes --]
On Thu, Jan 22, 2026 at 03:47:52PM -0300, Fabio Estevam wrote:
> Hi Tom and Marek,
>
> On Thu, Jan 22, 2026 at 11:23 AM Tom Rini <trini@konsulko.com> wrote:
>
> > We did that, yes. I'm not sure what Fabio is running in to here..
>
> Let me share more information with you.
>
> The board I am working on is based on Rockchip RV1103 (ARMv7) and will
> submit it upstream soon.
Can you please share it with my off-list maybe? I'm still confused as to
where the "sram" and "sdram" parts are coming from.
> The board was booting fin last week. Yesterday, after rebasing it
> against the top of the tree U-Boot, the board no longer boots.
>
> The boot error is:
>
> Missing DTB
> spl_early_init() failed: -2
> ### ERROR ### Please RESET the board ###
>
> After running "git bisect", I found Tom's commit 8b0ebe054bb3 ("arm:
> Update linker scripts to ensure appended device tree is aligned") to
> be the guilty one.
>
> If I partially revert the arm/cpu/u-boot-spl.lds change, as shown
> below, the board boots again:
>
> --- a/arch/arm/cpu/u-boot-spl.lds
> +++ b/arch/arm/cpu/u-boot-spl.lds
> @@ -51,9 +51,9 @@ SECTIONS
> __rel_dyn_start = .;
> *(.rel*)
> __rel_dyn_end = .;
> - . = ALIGN(8);
> }
>
> + . = ALIGN(8);
> _image_binary_end = .;
> _end = .;
>
> With Tom's commit applied (failing case), the spl/u-boot-spl.map looks
> like this:
>
> .rel.dyn 0x0000000000015cac 0x4
> 0x0000000000015cac __rel_dyn_start = .
> *(.rel*)
> .rel.iplt 0x0000000000015cac 0x0 arch/arm/cpu/armv7/start.o
> 0x0000000000015cac __rel_dyn_end = .
> 0x0000000000015cb0 . = ALIGN (0x8)
> *fill* 0x0000000000015cac 0x4
> 0x0000000000015cb0 _image_binary_end = .
> 0x0000000000015cb0 _end = .
>
> With the partial revert above (booting case):
>
> .rel.dyn 0x0000000000015cac 0x0
> 0x0000000000015cac __rel_dyn_start = .
> *(.rel*)
> .rel.iplt 0x0000000000015cac 0x0 arch/arm/cpu/armv7/start.o
> 0x0000000000015cac __rel_dyn_end = .
> 0x0000000000015cb0 . = ALIGN (0x8)
> 0x0000000000015cb0 _image_binary_end = .
> 0x0000000000015cb0 _end = .
>
> Basically, in the good case, .rel.dyn is zero. In the failing case:
> .rel.dyn is 0x4 and *fill* is 0x4 as well.
>
> This change messes with dtb being found in SPL.
>
> What would be a proper fix?
Well, where is the dtb ending up in the resulting binary? The addresses
are aligned correctly, but the dtb isn't where it's supposed to be,
where is it instead? A challenge here is that I could only check the
linker script used by about half of the 32bit ARM boards
(arch/arm/mach-omap2/u-boot-spl.lds) and not the one used by the other
half (arch/arm/cpu/u-boot-spl.lds). The initial error you reported makes
me wonder if we can somehow unify these two afterall, which would be
good in general to do.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
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:42 ` Tom Rini
0 siblings, 2 replies; 56+ messages in thread
From: Fabio Estevam @ 2026-01-22 19:19 UTC (permalink / raw)
To: Tom Rini
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
On Thu, Jan 22, 2026 at 4:10 PM Tom Rini <trini@konsulko.com> wrote:
> Can you please share it with my off-list maybe? I'm still confused as to
My work-in-progress tree is at:
https://github.com/fabioestevam/u-boot/commits/rv1103_prep/
This tree boots fine. After rebasing these patches to the top of the
tree, it fails to boot.
> Well, where is the dtb ending up in the resulting binary? The addresses
> are aligned correctly, but the dtb isn't where it's supposed to be,
> where is it instead? A challenge here is that I could only check the
> linker script used by about half of the 32bit ARM boards
> (arch/arm/mach-omap2/u-boot-spl.lds) and not the one used by the other
> half (arch/arm/cpu/u-boot-spl.lds). The initial error you reported makes
> me wonder if we can somehow unify these two afterall, which would be
> good in general to do.
The spl/u-boot-spl.bin file is 4 bytes longer in the failing case.
Let me know if you need any further clarification or if you'd like me
to test something.
Thanks
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
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
1 sibling, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-01-22 19:28 UTC (permalink / raw)
To: Fabio Estevam
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]
On Thu, Jan 22, 2026 at 04:19:55PM -0300, Fabio Estevam wrote:
> On Thu, Jan 22, 2026 at 4:10 PM Tom Rini <trini@konsulko.com> wrote:
>
> > Can you please share it with my off-list maybe? I'm still confused as to
>
> My work-in-progress tree is at:
>
> https://github.com/fabioestevam/u-boot/commits/rv1103_prep/
>
> This tree boots fine. After rebasing these patches to the top of the
> tree, it fails to boot.
>
> > Well, where is the dtb ending up in the resulting binary? The addresses
> > are aligned correctly, but the dtb isn't where it's supposed to be,
> > where is it instead? A challenge here is that I could only check the
> > linker script used by about half of the 32bit ARM boards
> > (arch/arm/mach-omap2/u-boot-spl.lds) and not the one used by the other
> > half (arch/arm/cpu/u-boot-spl.lds). The initial error you reported makes
> > me wonder if we can somehow unify these two afterall, which would be
> > good in general to do.
>
> The spl/u-boot-spl.bin file is 4 bytes longer in the failing case.
>
> Let me know if you need any further clarification or if you'd like me
> to test something.
Oh, does
https://patchwork.ozlabs.org/project/uboot/patch/20260122172247.2995437-1-b-padhi@ti.com/
also fix it for you, or no? Trying to figure out which case we're
hitting now..
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-22 19:28 ` Tom Rini
@ 2026-01-22 19:32 ` Fabio Estevam
0 siblings, 0 replies; 56+ messages in thread
From: Fabio Estevam @ 2026-01-22 19:32 UTC (permalink / raw)
To: Tom Rini
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
On Thu, Jan 22, 2026 at 4:28 PM Tom Rini <trini@konsulko.com> wrote:
> Oh, does
> https://patchwork.ozlabs.org/project/uboot/patch/20260122172247.2995437-1-b-padhi@ti.com/
> also fix it for you, or no? Trying to figure out which case we're
> hitting now..
Just tested, but it didn't help in my case.
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-22 19:19 ` Fabio Estevam
2026-01-22 19:28 ` Tom Rini
@ 2026-01-22 19:42 ` Tom Rini
2026-01-22 22:56 ` Fabio Estevam
1 sibling, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-01-22 19:42 UTC (permalink / raw)
To: Fabio Estevam
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 1879 bytes --]
On Thu, Jan 22, 2026 at 04:19:55PM -0300, Fabio Estevam wrote:
> On Thu, Jan 22, 2026 at 4:10 PM Tom Rini <trini@konsulko.com> wrote:
>
> > Can you please share it with my off-list maybe? I'm still confused as to
>
> My work-in-progress tree is at:
>
> https://github.com/fabioestevam/u-boot/commits/rv1103_prep/
>
> This tree boots fine. After rebasing these patches to the top of the
> tree, it fails to boot.
OK. FWIW, I can't reproduce those linker messages about ".sdram" and
".sram", even when I point ROCKCHIP_TPL at the right binary file (per
the docs).
> > Well, where is the dtb ending up in the resulting binary? The addresses
> > are aligned correctly, but the dtb isn't where it's supposed to be,
> > where is it instead? A challenge here is that I could only check the
> > linker script used by about half of the 32bit ARM boards
> > (arch/arm/mach-omap2/u-boot-spl.lds) and not the one used by the other
> > half (arch/arm/cpu/u-boot-spl.lds). The initial error you reported makes
> > me wonder if we can somehow unify these two afterall, which would be
> > good in general to do.
>
> The spl/u-boot-spl.bin file is 4 bytes longer in the failing case.
>
> Let me know if you need any further clarification or if you'd like me
> to test something.
I think you need to figure out where the mismatch is between where the
device tree is appended in the binary, and where it's expected to be, in
the binary, and then why something is writing it to the incorrect spot.
At run time, in xPL (and this is lib/fdtdec.c) we look at either
_image_binary_end if SEPARATE_BSS is enabled, or __bss_end if not.
Looking at the config, I see we are not SEPARATE_BSS here, so it needs
to be at __bss_end. And in both works and fails branches (my own quick
rebase -q origin/master), for me, __bss_end is the same location.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-22 19:42 ` Tom Rini
@ 2026-01-22 22:56 ` Fabio Estevam
2026-01-22 23:24 ` Tom Rini
0 siblings, 1 reply; 56+ messages in thread
From: Fabio Estevam @ 2026-01-22 22:56 UTC (permalink / raw)
To: Tom Rini
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
On Thu, Jan 22, 2026 at 4:42 PM Tom Rini <trini@konsulko.com> wrote:
> OK. FWIW, I can't reproduce those linker messages about ".sdram" and
> ".sram", even when I point ROCKCHIP_TPL at the right binary file (per
> the docs).
I only see these messages if I force SPL_SEPARATE_BSS.
The board boots despite these messages.
> I think you need to figure out where the mismatch is between where the
> device tree is appended in the binary, and where it's expected to be, in
> the binary, and then why something is writing it to the incorrect spot.
> At run time, in xPL (and this is lib/fdtdec.c) we look at either
> _image_binary_end if SEPARATE_BSS is enabled, or __bss_end if not.
> Looking at the config, I see we are not SEPARATE_BSS here, so it needs
> to be at __bss_end. And in both works and fails branches (my own quick
> rebase -q origin/master), for me, __bss_end is the same location.
The dtb is placed at shifted-by-4 offset after the commit in Subject line:
With 8b0ebe054bb3 ("arm: Update linker scripts to ensure appended
device tree is aligned"):
$ hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
000029f0 d0 0d fe ed 00 29 05 db 8a 18 03 d2 43 6a 1b ba |.....)......Cj..|
00015f10 00 00 00 00 d0 0d fe ed 00 00 0a 43 00 00 00 38 |...........C...8|
Because of this shift the dtb cannot be found and the boot fails.
With 8b0ebe054bb3 ("arm: Update linker scripts to ensure appended
device tree is aligned") reverted"
$ hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
000029f0 d0 0d fe ed 00 29 05 db 8a 18 03 d2 43 6a 1b ba |.....)......Cj..|
00015f10 d0 0d fe ed 00 00 0a 43 00 00 00 38 00 00 08 a8 |.......C...8....|
Here the dtb is found and boot proceeds.
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-22 22:56 ` Fabio Estevam
@ 2026-01-22 23:24 ` Tom Rini
2026-01-23 0:25 ` Fabio Estevam
0 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-01-22 23:24 UTC (permalink / raw)
To: Fabio Estevam
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 1370 bytes --]
On Thu, Jan 22, 2026 at 07:56:26PM -0300, Fabio Estevam wrote:
> On Thu, Jan 22, 2026 at 4:42 PM Tom Rini <trini@konsulko.com> wrote:
>
> > OK. FWIW, I can't reproduce those linker messages about ".sdram" and
> > ".sram", even when I point ROCKCHIP_TPL at the right binary file (per
> > the docs).
>
> I only see these messages if I force SPL_SEPARATE_BSS.
>
> The board boots despite these messages.
So with SEPARATE_BSS the dtb is found where it's expected to be? But
that then brings us back to what I'm saying..
> > I think you need to figure out where the mismatch is between where the
> > device tree is appended in the binary, and where it's expected to be, in
> > the binary, and then why something is writing it to the incorrect spot.
> > At run time, in xPL (and this is lib/fdtdec.c) we look at either
> > _image_binary_end if SEPARATE_BSS is enabled, or __bss_end if not.
> > Looking at the config, I see we are not SEPARATE_BSS here, so it needs
> > to be at __bss_end. And in both works and fails branches (my own quick
> > rebase -q origin/master), for me, __bss_end is the same location.
>
> The dtb is placed at shifted-by-4 offset after the commit in Subject line:
What's appending the dtb there? With SPL_SEPARATE_BSS off it needs to be
at __bss_end, and that's the same location for me, in both cases.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-22 23:24 ` Tom Rini
@ 2026-01-23 0:25 ` Fabio Estevam
2026-01-23 0:52 ` Fabio Estevam
0 siblings, 1 reply; 56+ messages in thread
From: Fabio Estevam @ 2026-01-23 0:25 UTC (permalink / raw)
To: Tom Rini
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
On Thu, Jan 22, 2026 at 8:24 PM Tom Rini <trini@konsulko.com> wrote:
> So with SEPARATE_BSS the dtb is found where it's expected to be? But
> that then brings us back to what I'm saying..
I retried with SEPARATE_BSS, and it also does not boot. Sorry for the confusion.
> What's appending the dtb there? With SPL_SEPARATE_BSS off it needs to be
> at __bss_end, and that's the same location for me, in both cases.
Correct: spl/u-boot-spl.map shows:
0x0000000000015f10 __bss_end = .
So the dtb should be present at 0x15f10.
The commit in the Subject is what appends 4 bytes, and the binary is
now shifted, causing the boot failure:
hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
00015f10 00 00 00 00 d0 0d fe ed 00 00 0a 43 00 00 00 38 |...........C...8|
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-23 0:25 ` Fabio Estevam
@ 2026-01-23 0:52 ` Fabio Estevam
2026-01-23 14:27 ` Tom Rini
0 siblings, 1 reply; 56+ messages in thread
From: Fabio Estevam @ 2026-01-23 0:52 UTC (permalink / raw)
To: Tom Rini
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
On Thu, Jan 22, 2026 at 9:25 PM Fabio Estevam <festevam@gmail.com> wrote:
> The commit in the Subject is what appends 4 bytes, and the binary is
> now shifted, causing the boot failure:
>
> hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
> 00015f10 00 00 00 00 d0 0d fe ed 00 00 0a 43 00 00 00 38 |...........C...8|
To make things simple, let's use a supported board in mainline.
Please follow these steps to reproduce the bug:
U-Boot top-of-tree:
make mrproper
make sonoff-ihost-rv1126_defconfig
cat spl/u-boot-spl.map | grep __bss_end
0x000000000000b468 __bss_end = .
0x0000000000000054 __bss_size =
(__bss_end - __bss_start)
hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
000016d0 a9 98 00 00 15 15 00 00 d0 0d fe ed 48 99 00 00 |............H...|
00001d20 08 00 70 47 6f f0 12 00 70 47 00 bf d0 0d fe ed |..pGo...pG......|
0000b460 00 00 00 00 00 00 00 00 00 00 00 00 d0 0d fe ed |................|
b468 contains 00 00 00 00 instead of FDT_MAGIC. FDT_MAGIC appears at b468 + 4.
After reverting 8b0ebe054bb3334c6ca9bed018360b08d4ddc7a4:
cat spl/u-boot-spl.map | grep __bss_end
0x000000000000b468 __bss_end = .
0x0000000000000054 __bss_size =
(__bss_end - __bss_start)
hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
000016d0 a9 98 00 00 15 15 00 00 d0 0d fe ed 48 99 00 00 |............H...|
00001d20 08 00 70 47 6f f0 12 00 70 47 00 bf d0 0d fe ed |..pGo...pG......|
0000b460 00 00 00 00 00 00 00 00 d0 0d fe ed 00 00 0d 95 |................|
b468 contains FDT_MAGIC as expected.
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-23 0:52 ` Fabio Estevam
@ 2026-01-23 14:27 ` Tom Rini
2026-01-23 15:45 ` Fabio Estevam
0 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-01-23 14:27 UTC (permalink / raw)
To: Fabio Estevam
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 2323 bytes --]
On Thu, Jan 22, 2026 at 09:52:39PM -0300, Fabio Estevam wrote:
> On Thu, Jan 22, 2026 at 9:25 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> > The commit in the Subject is what appends 4 bytes, and the binary is
> > now shifted, causing the boot failure:
> >
> > hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
> > 00015f10 00 00 00 00 d0 0d fe ed 00 00 0a 43 00 00 00 38 |...........C...8|
>
> To make things simple, let's use a supported board in mainline.
>
> Please follow these steps to reproduce the bug:
>
> U-Boot top-of-tree:
>
> make mrproper
> make sonoff-ihost-rv1126_defconfig
> cat spl/u-boot-spl.map | grep __bss_end
> 0x000000000000b468 __bss_end = .
> 0x0000000000000054 __bss_size =
> (__bss_end - __bss_start)
>
> hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
> 000016d0 a9 98 00 00 15 15 00 00 d0 0d fe ed 48 99 00 00 |............H...|
> 00001d20 08 00 70 47 6f f0 12 00 70 47 00 bf d0 0d fe ed |..pGo...pG......|
> 0000b460 00 00 00 00 00 00 00 00 00 00 00 00 d0 0d fe ed |................|
>
> b468 contains 00 00 00 00 instead of FDT_MAGIC. FDT_MAGIC appears at b468 + 4.
>
> After reverting 8b0ebe054bb3334c6ca9bed018360b08d4ddc7a4:
>
> cat spl/u-boot-spl.map | grep __bss_end
> 0x000000000000b468 __bss_end = .
> 0x0000000000000054 __bss_size =
> (__bss_end - __bss_start)
> hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
> 000016d0 a9 98 00 00 15 15 00 00 d0 0d fe ed 48 99 00 00 |............H...|
> 00001d20 08 00 70 47 6f f0 12 00 70 47 00 bf d0 0d fe ed |..pGo...pG......|
> 0000b460 00 00 00 00 00 00 00 00 d0 0d fe ed 00 00 0d 95 |................|
>
> b468 contains FDT_MAGIC as expected.
So this:
diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds
index d780a5060774..dcc201c30482 100644
--- a/arch/arm/cpu/u-boot-spl.lds
+++ b/arch/arm/cpu/u-boot-spl.lds
@@ -50,8 +50,8 @@ SECTIONS
.rel.dyn : {
__rel_dyn_start = .;
*(.rel*)
- __rel_dyn_end = .;
. = ALIGN(8);
+ __rel_dyn_end = .;
}
_image_binary_end = .;
Will shift the dtb location lower and __rel_dyn_end 4 bytes higher.
Which is probably fine.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-23 14:27 ` Tom Rini
@ 2026-01-23 15:45 ` Fabio Estevam
2026-01-23 15:50 ` Tom Rini
0 siblings, 1 reply; 56+ messages in thread
From: Fabio Estevam @ 2026-01-23 15:45 UTC (permalink / raw)
To: Tom Rini
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
On Fri, Jan 23, 2026 at 11:27 AM Tom Rini <trini@konsulko.com> wrote:
> So this:
>
> diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds
> index d780a5060774..dcc201c30482 100644
> --- a/arch/arm/cpu/u-boot-spl.lds
> +++ b/arch/arm/cpu/u-boot-spl.lds
> @@ -50,8 +50,8 @@ SECTIONS
> .rel.dyn : {
> __rel_dyn_start = .;
> *(.rel*)
> - __rel_dyn_end = .;
> . = ALIGN(8);
> + __rel_dyn_end = .;
> }
>
> _image_binary_end = .;
>
> Will shift the dtb location lower and __rel_dyn_end 4 bytes higher.
> Which is probably fine.
This change fixes rv1126, but still fails on rv1103:
sonoff-ihost-rv1126_defconfig:
$ cat spl/u-boot-spl.map | grep __bss_end
0x000000000000b468 __bss_end = .
0x0000000000000050 __bss_size =
(__bss_end - __bss_start)
$ hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
000016d0 af 98 00 00 15 15 00 00 d0 0d fe ed 4e 99 00 00 |............N...|
00001d20 08 00 70 47 6f f0 12 00 70 47 00 bf d0 0d fe ed |..pGo...pG......|
0000b460 00 00 00 00 00 00 00 00 d0 0d fe ed 00 00 0d 95 |................|
dtb is correctly found at 0xb468.
omega4-rv1103_defconfig:
$ cat spl/u-boot-spl.map | grep __bss_end
0x0000000000015f18 __bss_end = .
0x0000000000000264 __bss_size =
(__bss_end - __bss_start)
$ hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
000029f0 d0 0d fe ed 00 29 05 db 8a 18 03 d2 43 6a 1b ba |.....)......Cj..|
00015f10 00 00 00 00 00 00 00 00 00 00 00 00 d0 0d fe ed |................|
dtb is not found at 0x15f18.
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-23 15:45 ` Fabio Estevam
@ 2026-01-23 15:50 ` Tom Rini
0 siblings, 0 replies; 56+ messages in thread
From: Tom Rini @ 2026-01-23 15:50 UTC (permalink / raw)
To: Fabio Estevam
Cc: Marek Vasut, Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 1979 bytes --]
On Fri, Jan 23, 2026 at 12:45:01PM -0300, Fabio Estevam wrote:
> On Fri, Jan 23, 2026 at 11:27 AM Tom Rini <trini@konsulko.com> wrote:
>
> > So this:
> >
> > diff --git a/arch/arm/cpu/u-boot-spl.lds b/arch/arm/cpu/u-boot-spl.lds
> > index d780a5060774..dcc201c30482 100644
> > --- a/arch/arm/cpu/u-boot-spl.lds
> > +++ b/arch/arm/cpu/u-boot-spl.lds
> > @@ -50,8 +50,8 @@ SECTIONS
> > .rel.dyn : {
> > __rel_dyn_start = .;
> > *(.rel*)
> > - __rel_dyn_end = .;
> > . = ALIGN(8);
> > + __rel_dyn_end = .;
> > }
> >
> > _image_binary_end = .;
> >
> > Will shift the dtb location lower and __rel_dyn_end 4 bytes higher.
> > Which is probably fine.
>
> This change fixes rv1126, but still fails on rv1103:
>
> sonoff-ihost-rv1126_defconfig:
>
> $ cat spl/u-boot-spl.map | grep __bss_end
> 0x000000000000b468 __bss_end = .
> 0x0000000000000050 __bss_size =
> (__bss_end - __bss_start)
>
> $ hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
> 000016d0 af 98 00 00 15 15 00 00 d0 0d fe ed 4e 99 00 00 |............N...|
> 00001d20 08 00 70 47 6f f0 12 00 70 47 00 bf d0 0d fe ed |..pGo...pG......|
> 0000b460 00 00 00 00 00 00 00 00 d0 0d fe ed 00 00 0d 95 |................|
>
> dtb is correctly found at 0xb468.
>
> omega4-rv1103_defconfig:
>
> $ cat spl/u-boot-spl.map | grep __bss_end
> 0x0000000000015f18 __bss_end = .
> 0x0000000000000264 __bss_size =
> (__bss_end - __bss_start)
>
> $ hexdump -Cv spl/u-boot-spl.bin | grep 'd0 0d fe ed'
> 000029f0 d0 0d fe ed 00 29 05 db 8a 18 03 d2 43 6a 1b ba |.....)......Cj..|
> 00015f10 00 00 00 00 00 00 00 00 00 00 00 00 d0 0d fe ed |................|
>
> dtb is not found at 0x15f18.
Keep looking then please, thanks.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-22 3:08 ` Fabio Estevam
2026-01-22 3:33 ` Fabio Estevam
@ 2026-01-22 14:25 ` Tom Rini
1 sibling, 0 replies; 56+ messages in thread
From: Tom Rini @ 2026-01-22 14:25 UTC (permalink / raw)
To: Fabio Estevam
Cc: Kever Yang, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Michal Simek,
Philipp Tomsich, Richard Henderson, Ryan Chen, Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 2773 bytes --]
On Thu, Jan 22, 2026 at 12:08:04AM -0300, Fabio Estevam wrote:
> Hi Tom,
>
> On Thu, Jan 15, 2026 at 7:28 PM Tom Rini <trini@konsulko.com> wrote:
> >
> > 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:
> > - Expands some linker sections to be more readable when adding a second
> > statement to the section.
> > - Aligns the final section before _end (for U-Boot) or
> > _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> > '. = ALIGN(8);' to the final section before the symbol.
> > - Ensure that we do have alignment by adding an ASSERT so that when not
> > aligned we fail to link (and explain why).
> > - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> > provide the above alignments.
> >
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> > ---
> > The only part of this I am only mostly rather than fully confident in is
> > having caught all cases of having SPL_SEPARATE_BSS being false. I
> > believe I have as the generic ARM SPL linker script enforces the BSS
> > ending with 8-byte alignment, and the point of the ASSERTs here is to
> > catch the case where the section we're adding the ALIGN to ends up being
> > empty and so that ALIGN would become useless.
>
> I'm working on bringing up Rockchip RV1103 (ARMv7 SoC, no custom .lds file)
>
> After this patch is applied, the board does not boot anymore:
>
> Missing DTB
> spl_early_init() failed: -2
> ### ERROR ### Please RESET the board ###
>
> If I force "imply SPL_SEPARATE_BSS" in the SoC Kconfig, the board boots again.
>
> In this case, the build shows some warnings:
>
> LD spl/u-boot-spl
> /usr/bin/arm-linux-gnueabihf-ld: invalid length for memory region .sram
> /usr/bin/arm-linux-gnueabihf-ld: invalid origin for memory region .sdram
> /usr/bin/arm-linux-gnueabihf-ld: invalid length for memory region .sdram
> OBJCOPY spl/u-boot-spl-nodtb.bin
> SYM spl/u-boot-spl.sym
> CAT spl/u-boot-spl-dtb.bin
> COPY spl/u-boot-spl.bin
> BINMAN .binman_stamp
> OFCHK .config
>
> RV1108 is also an ARMv7 without SPL_SEPARATE_BSS, so I believe it is
> also affected by this change.
>
> What do you suggest?
Where are those memory regions coming from? They aren't specified in
arch/arm/cpu/u-boot-spl.lds
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-01-15 22:19 ` [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned Tom Rini
` (2 preceding siblings ...)
2026-01-22 3:08 ` Fabio Estevam
@ 2026-02-04 21:16 ` Phil Sutter
2026-02-04 21:20 ` Tom Rini
3 siblings, 1 reply; 56+ messages in thread
From: Phil Sutter @ 2026-02-04 21:16 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Fabio Estevam, Ilias Apalodimas, Jagan Teki,
Joel Stanley, Kever Yang, Michal Simek, Philipp Tomsich,
Richard Henderson, Ryan Chen, Stefano Babic
Hi,
On Thu, Jan 15, 2026 at 04:19:32PM -0600, Tom Rini wrote:
> 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:
> - Expands some linker sections to be more readable when adding a second
> statement to the section.
> - Aligns the final section before _end (for U-Boot) or
> _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> '. = ALIGN(8);' to the final section before the symbol.
> - Ensure that we do have alignment by adding an ASSERT so that when not
> aligned we fail to link (and explain why).
> - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> provide the above alignments.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
For unclear reasons, this seems to break boot via xmodem protocol on my
Synology DS414. I found this commit via 'git bisect'. The symptom is:
| kwboot version 2026.04-rc1-00098-g6ad0cf8f83db
| Detected kwbimage v1 with SPI boot signature
| Patching image boot signature to UART
| Aligning image header to Xmodem block size
| Sending boot message. Please reboot the target...\
| Sending boot image header (67584 bytes)...
| 0 % [......................................................................]
| 13 % [......................................................................]
| 26 % [......................................................................]
| 39 % [......................................................................]
| 53 % [......................................................................]
| 66 % [......................................................................]
| 79 % [......................................................................]
| 92 % [...................................... ]
| Done
| Missing DTB
| spl_init() failed: -2
| ### ERROR ### Please RESET the board ###
|
|
| xmodem: Connection timed out
Debug printf()s in fdtdec_prepare_fdt() show that fdt_check_header()
returns -FDT_ERR_BADMAGIC.
With HEAD at a8d982e1f1726 ("x86: cpu: Fix crash on FTRACE enabled
builds"), reverting arch/arm/cpu/u-boot-spl.lds like so:
| @@ -41,14 +41,21 @@ SECTIONS
| __binman_sym_start = .;
| KEEP(*(SORT(.binman_sym*)));
| __binman_sym_end = .;
| - . = ALIGN(8);
| }
|
| + . = ALIGN(4); /* critical! */
| __image_copy_end = .;
| + .rel.dyn : {
| + __rel_dyn_start = .;
| + *(.rel*)
| + __rel_dyn_end = .;
| + }
| +
| + . = ALIGN(8);
| _image_binary_end = .;
| _end = .;
|
| - .bss : {
| + .bss __rel_dyn_start (OVERLAY) : {
| __bss_start = .;
| *(.bss*)
| . = ALIGN(8);
The SPL image starts up again and continues loading the real uboot
image. Note that I have no idea what these changes actually do, so I
need instructions if I should dig further.
Thanks, Phil
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-02-04 21:16 ` Phil Sutter
@ 2026-02-04 21:20 ` Tom Rini
2026-02-04 21:27 ` Phil Sutter
0 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-02-04 21:20 UTC (permalink / raw)
To: Phil Sutter
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Fabio Estevam, Ilias Apalodimas, Jagan Teki,
Joel Stanley, Kever Yang, Michal Simek, Philipp Tomsich,
Richard Henderson, Ryan Chen, Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 3801 bytes --]
On Wed, Feb 04, 2026 at 10:16:12PM +0100, Phil Sutter wrote:
> Hi,
>
> On Thu, Jan 15, 2026 at 04:19:32PM -0600, Tom Rini wrote:
> > 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:
> > - Expands some linker sections to be more readable when adding a second
> > statement to the section.
> > - Aligns the final section before _end (for U-Boot) or
> > _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> > '. = ALIGN(8);' to the final section before the symbol.
> > - Ensure that we do have alignment by adding an ASSERT so that when not
> > aligned we fail to link (and explain why).
> > - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> > provide the above alignments.
> >
> > Signed-off-by: Tom Rini <trini@konsulko.com>
>
> For unclear reasons, this seems to break boot via xmodem protocol on my
> Synology DS414. I found this commit via 'git bisect'. The symptom is:
>
> | kwboot version 2026.04-rc1-00098-g6ad0cf8f83db
> | Detected kwbimage v1 with SPI boot signature
> | Patching image boot signature to UART
> | Aligning image header to Xmodem block size
> | Sending boot message. Please reboot the target...\
> | Sending boot image header (67584 bytes)...
> | 0 % [......................................................................]
> | 13 % [......................................................................]
> | 26 % [......................................................................]
> | 39 % [......................................................................]
> | 53 % [......................................................................]
> | 66 % [......................................................................]
> | 79 % [......................................................................]
> | 92 % [...................................... ]
> | Done
> | Missing DTB
> | spl_init() failed: -2
> | ### ERROR ### Please RESET the board ###
> |
> |
> | xmodem: Connection timed out
>
> Debug printf()s in fdtdec_prepare_fdt() show that fdt_check_header()
> returns -FDT_ERR_BADMAGIC.
>
> With HEAD at a8d982e1f1726 ("x86: cpu: Fix crash on FTRACE enabled
> builds"), reverting arch/arm/cpu/u-boot-spl.lds like so:
>
> | @@ -41,14 +41,21 @@ SECTIONS
> | __binman_sym_start = .;
> | KEEP(*(SORT(.binman_sym*)));
> | __binman_sym_end = .;
> | - . = ALIGN(8);
> | }
> |
> | + . = ALIGN(4); /* critical! */
> | __image_copy_end = .;
> | + .rel.dyn : {
> | + __rel_dyn_start = .;
> | + *(.rel*)
> | + __rel_dyn_end = .;
> | + }
> | +
> | + . = ALIGN(8);
> | _image_binary_end = .;
> | _end = .;
> |
> | - .bss : {
> | + .bss __rel_dyn_start (OVERLAY) : {
> | __bss_start = .;
> | *(.bss*)
> | . = ALIGN(8);
>
> The SPL image starts up again and continues loading the real uboot
> image. Note that I have no idea what these changes actually do, so I
> need instructions if I should dig further.
Does:
https://patchwork.ozlabs.org/project/uboot/patch/20260130183635.2612933-1-trini@konsulko.com/
fix it?
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-02-04 21:20 ` Tom Rini
@ 2026-02-04 21:27 ` Phil Sutter
2026-02-04 21:31 ` Tom Rini
0 siblings, 1 reply; 56+ messages in thread
From: Phil Sutter @ 2026-02-04 21:27 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Fabio Estevam, Ilias Apalodimas, Jagan Teki,
Joel Stanley, Kever Yang, Michal Simek, Philipp Tomsich,
Richard Henderson, Ryan Chen, Stefano Babic
On Wed, Feb 04, 2026 at 03:20:10PM -0600, Tom Rini wrote:
> On Wed, Feb 04, 2026 at 10:16:12PM +0100, Phil Sutter wrote:
> > Hi,
> >
> > On Thu, Jan 15, 2026 at 04:19:32PM -0600, Tom Rini wrote:
> > > 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:
> > > - Expands some linker sections to be more readable when adding a second
> > > statement to the section.
> > > - Aligns the final section before _end (for U-Boot) or
> > > _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> > > '. = ALIGN(8);' to the final section before the symbol.
> > > - Ensure that we do have alignment by adding an ASSERT so that when not
> > > aligned we fail to link (and explain why).
> > > - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> > > provide the above alignments.
> > >
> > > Signed-off-by: Tom Rini <trini@konsulko.com>
> >
> > For unclear reasons, this seems to break boot via xmodem protocol on my
> > Synology DS414. I found this commit via 'git bisect'. The symptom is:
> >
> > | kwboot version 2026.04-rc1-00098-g6ad0cf8f83db
> > | Detected kwbimage v1 with SPI boot signature
> > | Patching image boot signature to UART
> > | Aligning image header to Xmodem block size
> > | Sending boot message. Please reboot the target...\
> > | Sending boot image header (67584 bytes)...
> > | 0 % [......................................................................]
> > | 13 % [......................................................................]
> > | 26 % [......................................................................]
> > | 39 % [......................................................................]
> > | 53 % [......................................................................]
> > | 66 % [......................................................................]
> > | 79 % [......................................................................]
> > | 92 % [...................................... ]
> > | Done
> > | Missing DTB
> > | spl_init() failed: -2
> > | ### ERROR ### Please RESET the board ###
> > |
> > |
> > | xmodem: Connection timed out
> >
> > Debug printf()s in fdtdec_prepare_fdt() show that fdt_check_header()
> > returns -FDT_ERR_BADMAGIC.
> >
> > With HEAD at a8d982e1f1726 ("x86: cpu: Fix crash on FTRACE enabled
> > builds"), reverting arch/arm/cpu/u-boot-spl.lds like so:
> >
> > | @@ -41,14 +41,21 @@ SECTIONS
> > | __binman_sym_start = .;
> > | KEEP(*(SORT(.binman_sym*)));
> > | __binman_sym_end = .;
> > | - . = ALIGN(8);
> > | }
> > |
> > | + . = ALIGN(4); /* critical! */
> > | __image_copy_end = .;
> > | + .rel.dyn : {
> > | + __rel_dyn_start = .;
> > | + *(.rel*)
> > | + __rel_dyn_end = .;
> > | + }
> > | +
> > | + . = ALIGN(8);
> > | _image_binary_end = .;
> > | _end = .;
> > |
> > | - .bss : {
> > | + .bss __rel_dyn_start (OVERLAY) : {
> > | __bss_start = .;
> > | *(.bss*)
> > | . = ALIGN(8);
> >
> > The SPL image starts up again and continues loading the real uboot
> > image. Note that I have no idea what these changes actually do, so I
> > need instructions if I should dig further.
>
> Does:
> https://patchwork.ozlabs.org/project/uboot/patch/20260130183635.2612933-1-trini@konsulko.com/
> fix it?
Sadly not, same result.
Thanks for the quick reply!
Cheers, Phil
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-02-04 21:27 ` Phil Sutter
@ 2026-02-04 21:31 ` Tom Rini
2026-02-04 21:40 ` Phil Sutter
0 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-02-04 21:31 UTC (permalink / raw)
To: Phil Sutter, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev, Fabio Estevam,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Kever Yang,
Michal Simek, Philipp Tomsich, Richard Henderson, Ryan Chen,
Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 4486 bytes --]
On Wed, Feb 04, 2026 at 10:27:11PM +0100, Phil Sutter wrote:
> On Wed, Feb 04, 2026 at 03:20:10PM -0600, Tom Rini wrote:
> > On Wed, Feb 04, 2026 at 10:16:12PM +0100, Phil Sutter wrote:
> > > Hi,
> > >
> > > On Thu, Jan 15, 2026 at 04:19:32PM -0600, Tom Rini wrote:
> > > > 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:
> > > > - Expands some linker sections to be more readable when adding a second
> > > > statement to the section.
> > > > - Aligns the final section before _end (for U-Boot) or
> > > > _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> > > > '. = ALIGN(8);' to the final section before the symbol.
> > > > - Ensure that we do have alignment by adding an ASSERT so that when not
> > > > aligned we fail to link (and explain why).
> > > > - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> > > > provide the above alignments.
> > > >
> > > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > >
> > > For unclear reasons, this seems to break boot via xmodem protocol on my
> > > Synology DS414. I found this commit via 'git bisect'. The symptom is:
> > >
> > > | kwboot version 2026.04-rc1-00098-g6ad0cf8f83db
> > > | Detected kwbimage v1 with SPI boot signature
> > > | Patching image boot signature to UART
> > > | Aligning image header to Xmodem block size
> > > | Sending boot message. Please reboot the target...\
> > > | Sending boot image header (67584 bytes)...
> > > | 0 % [......................................................................]
> > > | 13 % [......................................................................]
> > > | 26 % [......................................................................]
> > > | 39 % [......................................................................]
> > > | 53 % [......................................................................]
> > > | 66 % [......................................................................]
> > > | 79 % [......................................................................]
> > > | 92 % [...................................... ]
> > > | Done
> > > | Missing DTB
> > > | spl_init() failed: -2
> > > | ### ERROR ### Please RESET the board ###
> > > |
> > > |
> > > | xmodem: Connection timed out
> > >
> > > Debug printf()s in fdtdec_prepare_fdt() show that fdt_check_header()
> > > returns -FDT_ERR_BADMAGIC.
> > >
> > > With HEAD at a8d982e1f1726 ("x86: cpu: Fix crash on FTRACE enabled
> > > builds"), reverting arch/arm/cpu/u-boot-spl.lds like so:
> > >
> > > | @@ -41,14 +41,21 @@ SECTIONS
> > > | __binman_sym_start = .;
> > > | KEEP(*(SORT(.binman_sym*)));
> > > | __binman_sym_end = .;
> > > | - . = ALIGN(8);
> > > | }
> > > |
> > > | + . = ALIGN(4); /* critical! */
> > > | __image_copy_end = .;
> > > | + .rel.dyn : {
> > > | + __rel_dyn_start = .;
> > > | + *(.rel*)
> > > | + __rel_dyn_end = .;
> > > | + }
> > > | +
> > > | + . = ALIGN(8);
> > > | _image_binary_end = .;
> > > | _end = .;
> > > |
> > > | - .bss : {
> > > | + .bss __rel_dyn_start (OVERLAY) : {
> > > | __bss_start = .;
> > > | *(.bss*)
> > > | . = ALIGN(8);
> > >
> > > The SPL image starts up again and continues loading the real uboot
> > > image. Note that I have no idea what these changes actually do, so I
> > > need instructions if I should dig further.
> >
> > Does:
> > https://patchwork.ozlabs.org/project/uboot/patch/20260130183635.2612933-1-trini@konsulko.com/
> > fix it?
>
> Sadly not, same result.
Ugh. What file, specifically, do you send via xmodem? And so that maybe
I can more easily replicate the failure, are you using the kernel.org
gcc-14.2.0 toolchain or something else?
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-02-04 21:31 ` Tom Rini
@ 2026-02-04 21:40 ` Phil Sutter
2026-02-04 21:50 ` Tom Rini
0 siblings, 1 reply; 56+ messages in thread
From: Phil Sutter @ 2026-02-04 21:40 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Fabio Estevam, Ilias Apalodimas, Jagan Teki,
Joel Stanley, Kever Yang, Michal Simek, Philipp Tomsich,
Richard Henderson, Ryan Chen, Stefano Babic
On Wed, Feb 04, 2026 at 03:31:39PM -0600, Tom Rini wrote:
> On Wed, Feb 04, 2026 at 10:27:11PM +0100, Phil Sutter wrote:
> > On Wed, Feb 04, 2026 at 03:20:10PM -0600, Tom Rini wrote:
> > > On Wed, Feb 04, 2026 at 10:16:12PM +0100, Phil Sutter wrote:
> > > > Hi,
> > > >
> > > > On Thu, Jan 15, 2026 at 04:19:32PM -0600, Tom Rini wrote:
> > > > > 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:
> > > > > - Expands some linker sections to be more readable when adding a second
> > > > > statement to the section.
> > > > > - Aligns the final section before _end (for U-Boot) or
> > > > > _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> > > > > '. = ALIGN(8);' to the final section before the symbol.
> > > > > - Ensure that we do have alignment by adding an ASSERT so that when not
> > > > > aligned we fail to link (and explain why).
> > > > > - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> > > > > provide the above alignments.
> > > > >
> > > > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > >
> > > > For unclear reasons, this seems to break boot via xmodem protocol on my
> > > > Synology DS414. I found this commit via 'git bisect'. The symptom is:
> > > >
> > > > | kwboot version 2026.04-rc1-00098-g6ad0cf8f83db
> > > > | Detected kwbimage v1 with SPI boot signature
> > > > | Patching image boot signature to UART
> > > > | Aligning image header to Xmodem block size
> > > > | Sending boot message. Please reboot the target...\
> > > > | Sending boot image header (67584 bytes)...
> > > > | 0 % [......................................................................]
> > > > | 13 % [......................................................................]
> > > > | 26 % [......................................................................]
> > > > | 39 % [......................................................................]
> > > > | 53 % [......................................................................]
> > > > | 66 % [......................................................................]
> > > > | 79 % [......................................................................]
> > > > | 92 % [...................................... ]
> > > > | Done
> > > > | Missing DTB
> > > > | spl_init() failed: -2
> > > > | ### ERROR ### Please RESET the board ###
> > > > |
> > > > |
> > > > | xmodem: Connection timed out
> > > >
> > > > Debug printf()s in fdtdec_prepare_fdt() show that fdt_check_header()
> > > > returns -FDT_ERR_BADMAGIC.
> > > >
> > > > With HEAD at a8d982e1f1726 ("x86: cpu: Fix crash on FTRACE enabled
> > > > builds"), reverting arch/arm/cpu/u-boot-spl.lds like so:
> > > >
> > > > | @@ -41,14 +41,21 @@ SECTIONS
> > > > | __binman_sym_start = .;
> > > > | KEEP(*(SORT(.binman_sym*)));
> > > > | __binman_sym_end = .;
> > > > | - . = ALIGN(8);
> > > > | }
> > > > |
> > > > | + . = ALIGN(4); /* critical! */
> > > > | __image_copy_end = .;
> > > > | + .rel.dyn : {
> > > > | + __rel_dyn_start = .;
> > > > | + *(.rel*)
> > > > | + __rel_dyn_end = .;
> > > > | + }
> > > > | +
> > > > | + . = ALIGN(8);
> > > > | _image_binary_end = .;
> > > > | _end = .;
> > > > |
> > > > | - .bss : {
> > > > | + .bss __rel_dyn_start (OVERLAY) : {
> > > > | __bss_start = .;
> > > > | *(.bss*)
> > > > | . = ALIGN(8);
> > > >
> > > > The SPL image starts up again and continues loading the real uboot
> > > > image. Note that I have no idea what these changes actually do, so I
> > > > need instructions if I should dig further.
> > >
> > > Does:
> > > https://patchwork.ozlabs.org/project/uboot/patch/20260130183635.2612933-1-trini@konsulko.com/
> > > fix it?
> >
> > Sadly not, same result.
>
> Ugh. What file, specifically, do you send via xmodem? And so that maybe
> I can more easily replicate the failure, are you using the kernel.org
> gcc-14.2.0 toolchain or something else?
I am building with a custom-built arm-openadk-linux-uclibceabi-gcc
version 14.3.0. Basically what I run is:
MYENV='ARCH=arm CROSS_COMPILE=~/git/openadk-ds414/toolchain_synology-ds414_uclibc-ng_softfp_eabi_arm/usr/bin/arm-openadk-linux-uclibceabi-'
make $MYENV clean && \
for f in $(ls u-boot*.kwb 2>/dev/null); do rm $f; done && \
make $MYENV ds414_defconfig && \
make $MYENV -j12 && \
./tools/kwboot -a -t -p -b u-boot-*spl.kwb /dev/ttyUSB0
With current uboot, this should be u-boot-with-spl.kwb image.
With said patch reverted (or the above changes applied), I produce a
working u-boot-with-spl.kwb which loads and boots linux from flash. So
my toolchain is at least not totally broken. ;)
Cheers, Phil
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-02-04 21:40 ` Phil Sutter
@ 2026-02-04 21:50 ` Tom Rini
2026-02-04 23:00 ` Phil Sutter
0 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-02-04 21:50 UTC (permalink / raw)
To: Phil Sutter, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev, Fabio Estevam,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Kever Yang,
Michal Simek, Philipp Tomsich, Richard Henderson, Ryan Chen,
Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 6810 bytes --]
On Wed, Feb 04, 2026 at 10:40:12PM +0100, Phil Sutter wrote:
> On Wed, Feb 04, 2026 at 03:31:39PM -0600, Tom Rini wrote:
> > On Wed, Feb 04, 2026 at 10:27:11PM +0100, Phil Sutter wrote:
> > > On Wed, Feb 04, 2026 at 03:20:10PM -0600, Tom Rini wrote:
> > > > On Wed, Feb 04, 2026 at 10:16:12PM +0100, Phil Sutter wrote:
> > > > > Hi,
> > > > >
> > > > > On Thu, Jan 15, 2026 at 04:19:32PM -0600, Tom Rini wrote:
> > > > > > 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:
> > > > > > - Expands some linker sections to be more readable when adding a second
> > > > > > statement to the section.
> > > > > > - Aligns the final section before _end (for U-Boot) or
> > > > > > _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> > > > > > '. = ALIGN(8);' to the final section before the symbol.
> > > > > > - Ensure that we do have alignment by adding an ASSERT so that when not
> > > > > > aligned we fail to link (and explain why).
> > > > > > - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> > > > > > provide the above alignments.
> > > > > >
> > > > > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > > >
> > > > > For unclear reasons, this seems to break boot via xmodem protocol on my
> > > > > Synology DS414. I found this commit via 'git bisect'. The symptom is:
> > > > >
> > > > > | kwboot version 2026.04-rc1-00098-g6ad0cf8f83db
> > > > > | Detected kwbimage v1 with SPI boot signature
> > > > > | Patching image boot signature to UART
> > > > > | Aligning image header to Xmodem block size
> > > > > | Sending boot message. Please reboot the target...\
> > > > > | Sending boot image header (67584 bytes)...
> > > > > | 0 % [......................................................................]
> > > > > | 13 % [......................................................................]
> > > > > | 26 % [......................................................................]
> > > > > | 39 % [......................................................................]
> > > > > | 53 % [......................................................................]
> > > > > | 66 % [......................................................................]
> > > > > | 79 % [......................................................................]
> > > > > | 92 % [...................................... ]
> > > > > | Done
> > > > > | Missing DTB
> > > > > | spl_init() failed: -2
> > > > > | ### ERROR ### Please RESET the board ###
> > > > > |
> > > > > |
> > > > > | xmodem: Connection timed out
> > > > >
> > > > > Debug printf()s in fdtdec_prepare_fdt() show that fdt_check_header()
> > > > > returns -FDT_ERR_BADMAGIC.
> > > > >
> > > > > With HEAD at a8d982e1f1726 ("x86: cpu: Fix crash on FTRACE enabled
> > > > > builds"), reverting arch/arm/cpu/u-boot-spl.lds like so:
> > > > >
> > > > > | @@ -41,14 +41,21 @@ SECTIONS
> > > > > | __binman_sym_start = .;
> > > > > | KEEP(*(SORT(.binman_sym*)));
> > > > > | __binman_sym_end = .;
> > > > > | - . = ALIGN(8);
> > > > > | }
> > > > > |
> > > > > | + . = ALIGN(4); /* critical! */
> > > > > | __image_copy_end = .;
> > > > > | + .rel.dyn : {
> > > > > | + __rel_dyn_start = .;
> > > > > | + *(.rel*)
> > > > > | + __rel_dyn_end = .;
> > > > > | + }
> > > > > | +
> > > > > | + . = ALIGN(8);
> > > > > | _image_binary_end = .;
> > > > > | _end = .;
> > > > > |
> > > > > | - .bss : {
> > > > > | + .bss __rel_dyn_start (OVERLAY) : {
> > > > > | __bss_start = .;
> > > > > | *(.bss*)
> > > > > | . = ALIGN(8);
> > > > >
> > > > > The SPL image starts up again and continues loading the real uboot
> > > > > image. Note that I have no idea what these changes actually do, so I
> > > > > need instructions if I should dig further.
> > > >
> > > > Does:
> > > > https://patchwork.ozlabs.org/project/uboot/patch/20260130183635.2612933-1-trini@konsulko.com/
> > > > fix it?
> > >
> > > Sadly not, same result.
> >
> > Ugh. What file, specifically, do you send via xmodem? And so that maybe
> > I can more easily replicate the failure, are you using the kernel.org
> > gcc-14.2.0 toolchain or something else?
>
> I am building with a custom-built arm-openadk-linux-uclibceabi-gcc
> version 14.3.0. Basically what I run is:
>
> MYENV='ARCH=arm CROSS_COMPILE=~/git/openadk-ds414/toolchain_synology-ds414_uclibc-ng_softfp_eabi_arm/usr/bin/arm-openadk-linux-uclibceabi-'
>
> make $MYENV clean && \
> for f in $(ls u-boot*.kwb 2>/dev/null); do rm $f; done && \
> make $MYENV ds414_defconfig && \
> make $MYENV -j12 && \
> ./tools/kwboot -a -t -p -b u-boot-*spl.kwb /dev/ttyUSB0
>
> With current uboot, this should be u-boot-with-spl.kwb image.
>
> With said patch reverted (or the above changes applied), I produce a
> working u-boot-with-spl.kwb which loads and boots linux from flash. So
> my toolchain is at least not totally broken. ;)
Right, so, for background, the following threads might shed some light
on things:
https://lore.kernel.org/u-boot/CAOMZO5DZNJ+=AP1spWCv7Ar6etf03H=DFVU=mXZcC7QFTGoh_Q@mail.gmail.com/
https://lore.kernel.org/u-boot/20260123161907.392211-1-festevam@gmail.com/
And so to that end, can you please do:
hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed'
and let me know what that says? And the first line there should match,
content-wise at least (but not quite file offset) spl/u-boot-spl. I was
asking about your toolchain because with gcc-14.2.0 from kernel.org:
$ hexdump -Cv /tmp/ds414/spl/u-boot-spl | grep 'd0 0d fe ed'
00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
$ hexdump -Cv /tmp/ds414/u-boot-with-spl.kwb | grep 'd0 0d fe ed'
00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
And while this should then *work* that's luck and not design. If you can
confirm that instead 'd0 0d fe ed' is in the middle (and so 4 byte but
not 8 byte aligned) it'll at least be the same symptom as before.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-02-04 21:50 ` Tom Rini
@ 2026-02-04 23:00 ` Phil Sutter
2026-02-04 23:04 ` Tom Rini
0 siblings, 1 reply; 56+ messages in thread
From: Phil Sutter @ 2026-02-04 23:00 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Fabio Estevam, Ilias Apalodimas, Jagan Teki,
Joel Stanley, Kever Yang, Michal Simek, Philipp Tomsich,
Richard Henderson, Ryan Chen, Stefano Babic
On Wed, Feb 04, 2026 at 03:50:16PM -0600, Tom Rini wrote:
> On Wed, Feb 04, 2026 at 10:40:12PM +0100, Phil Sutter wrote:
> > On Wed, Feb 04, 2026 at 03:31:39PM -0600, Tom Rini wrote:
> > > On Wed, Feb 04, 2026 at 10:27:11PM +0100, Phil Sutter wrote:
> > > > On Wed, Feb 04, 2026 at 03:20:10PM -0600, Tom Rini wrote:
> > > > > On Wed, Feb 04, 2026 at 10:16:12PM +0100, Phil Sutter wrote:
> > > > > > Hi,
> > > > > >
> > > > > > On Thu, Jan 15, 2026 at 04:19:32PM -0600, Tom Rini wrote:
> > > > > > > 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:
> > > > > > > - Expands some linker sections to be more readable when adding a second
> > > > > > > statement to the section.
> > > > > > > - Aligns the final section before _end (for U-Boot) or
> > > > > > > _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> > > > > > > '. = ALIGN(8);' to the final section before the symbol.
> > > > > > > - Ensure that we do have alignment by adding an ASSERT so that when not
> > > > > > > aligned we fail to link (and explain why).
> > > > > > > - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> > > > > > > provide the above alignments.
> > > > > > >
> > > > > > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > > > >
> > > > > > For unclear reasons, this seems to break boot via xmodem protocol on my
> > > > > > Synology DS414. I found this commit via 'git bisect'. The symptom is:
> > > > > >
> > > > > > | kwboot version 2026.04-rc1-00098-g6ad0cf8f83db
> > > > > > | Detected kwbimage v1 with SPI boot signature
> > > > > > | Patching image boot signature to UART
> > > > > > | Aligning image header to Xmodem block size
> > > > > > | Sending boot message. Please reboot the target...\
> > > > > > | Sending boot image header (67584 bytes)...
> > > > > > | 0 % [......................................................................]
> > > > > > | 13 % [......................................................................]
> > > > > > | 26 % [......................................................................]
> > > > > > | 39 % [......................................................................]
> > > > > > | 53 % [......................................................................]
> > > > > > | 66 % [......................................................................]
> > > > > > | 79 % [......................................................................]
> > > > > > | 92 % [...................................... ]
> > > > > > | Done
> > > > > > | Missing DTB
> > > > > > | spl_init() failed: -2
> > > > > > | ### ERROR ### Please RESET the board ###
> > > > > > |
> > > > > > |
> > > > > > | xmodem: Connection timed out
> > > > > >
> > > > > > Debug printf()s in fdtdec_prepare_fdt() show that fdt_check_header()
> > > > > > returns -FDT_ERR_BADMAGIC.
> > > > > >
> > > > > > With HEAD at a8d982e1f1726 ("x86: cpu: Fix crash on FTRACE enabled
> > > > > > builds"), reverting arch/arm/cpu/u-boot-spl.lds like so:
> > > > > >
> > > > > > | @@ -41,14 +41,21 @@ SECTIONS
> > > > > > | __binman_sym_start = .;
> > > > > > | KEEP(*(SORT(.binman_sym*)));
> > > > > > | __binman_sym_end = .;
> > > > > > | - . = ALIGN(8);
> > > > > > | }
> > > > > > |
> > > > > > | + . = ALIGN(4); /* critical! */
> > > > > > | __image_copy_end = .;
> > > > > > | + .rel.dyn : {
> > > > > > | + __rel_dyn_start = .;
> > > > > > | + *(.rel*)
> > > > > > | + __rel_dyn_end = .;
> > > > > > | + }
> > > > > > | +
> > > > > > | + . = ALIGN(8);
> > > > > > | _image_binary_end = .;
> > > > > > | _end = .;
> > > > > > |
> > > > > > | - .bss : {
> > > > > > | + .bss __rel_dyn_start (OVERLAY) : {
> > > > > > | __bss_start = .;
> > > > > > | *(.bss*)
> > > > > > | . = ALIGN(8);
> > > > > >
> > > > > > The SPL image starts up again and continues loading the real uboot
> > > > > > image. Note that I have no idea what these changes actually do, so I
> > > > > > need instructions if I should dig further.
> > > > >
> > > > > Does:
> > > > > https://patchwork.ozlabs.org/project/uboot/patch/20260130183635.2612933-1-trini@konsulko.com/
> > > > > fix it?
> > > >
> > > > Sadly not, same result.
> > >
> > > Ugh. What file, specifically, do you send via xmodem? And so that maybe
> > > I can more easily replicate the failure, are you using the kernel.org
> > > gcc-14.2.0 toolchain or something else?
> >
> > I am building with a custom-built arm-openadk-linux-uclibceabi-gcc
> > version 14.3.0. Basically what I run is:
> >
> > MYENV='ARCH=arm CROSS_COMPILE=~/git/openadk-ds414/toolchain_synology-ds414_uclibc-ng_softfp_eabi_arm/usr/bin/arm-openadk-linux-uclibceabi-'
> >
> > make $MYENV clean && \
> > for f in $(ls u-boot*.kwb 2>/dev/null); do rm $f; done && \
> > make $MYENV ds414_defconfig && \
> > make $MYENV -j12 && \
> > ./tools/kwboot -a -t -p -b u-boot-*spl.kwb /dev/ttyUSB0
> >
> > With current uboot, this should be u-boot-with-spl.kwb image.
> >
> > With said patch reverted (or the above changes applied), I produce a
> > working u-boot-with-spl.kwb which loads and boots linux from flash. So
> > my toolchain is at least not totally broken. ;)
>
> Right, so, for background, the following threads might shed some light
> on things:
> https://lore.kernel.org/u-boot/CAOMZO5DZNJ+=AP1spWCv7Ar6etf03H=DFVU=mXZcC7QFTGoh_Q@mail.gmail.com/
> https://lore.kernel.org/u-boot/20260123161907.392211-1-festevam@gmail.com/
>
> And so to that end, can you please do:
> hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed'
> and let me know what that says? And the first line there should match,
> content-wise at least (but not quite file offset) spl/u-boot-spl. I was
> asking about your toolchain because with gcc-14.2.0 from kernel.org:
> $ hexdump -Cv /tmp/ds414/spl/u-boot-spl | grep 'd0 0d fe ed'
> 00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> $ hexdump -Cv /tmp/ds414/u-boot-with-spl.kwb | grep 'd0 0d fe ed'
> 00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
This is with HEAD at a8d982e1f17 + your "spl: Ensure final section before BSS
is non-empty" applied:
% hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed' | head -n1
00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
% hexdump -Cv spl/u-boot-spl | grep 'd0 0d fe ed'
00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> And while this should then *work* that's luck and not design. If you can
> confirm that instead 'd0 0d fe ed' is in the middle (and so 4 byte but
> not 8 byte aligned) it'll at least be the same symptom as before.
Hmm. My dumps indicate correct 8B alignment, right? Switching over to a branch
which has the problematic commit reverted and produced images work, I
get exactly the same output from hexdump on those files, BTW. Does that
mean we're on the wrong track and my problem is not wrong DTB alignment?
Cheers, Phil
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-02-04 23:00 ` Phil Sutter
@ 2026-02-04 23:04 ` Tom Rini
2026-02-04 23:29 ` Phil Sutter
0 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-02-04 23:04 UTC (permalink / raw)
To: Phil Sutter, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev, Fabio Estevam,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Kever Yang,
Michal Simek, Philipp Tomsich, Richard Henderson, Ryan Chen,
Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 8565 bytes --]
On Thu, Feb 05, 2026 at 12:00:34AM +0100, Phil Sutter wrote:
> On Wed, Feb 04, 2026 at 03:50:16PM -0600, Tom Rini wrote:
> > On Wed, Feb 04, 2026 at 10:40:12PM +0100, Phil Sutter wrote:
> > > On Wed, Feb 04, 2026 at 03:31:39PM -0600, Tom Rini wrote:
> > > > On Wed, Feb 04, 2026 at 10:27:11PM +0100, Phil Sutter wrote:
> > > > > On Wed, Feb 04, 2026 at 03:20:10PM -0600, Tom Rini wrote:
> > > > > > On Wed, Feb 04, 2026 at 10:16:12PM +0100, Phil Sutter wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > On Thu, Jan 15, 2026 at 04:19:32PM -0600, Tom Rini wrote:
> > > > > > > > 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:
> > > > > > > > - Expands some linker sections to be more readable when adding a second
> > > > > > > > statement to the section.
> > > > > > > > - Aligns the final section before _end (for U-Boot) or
> > > > > > > > _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> > > > > > > > '. = ALIGN(8);' to the final section before the symbol.
> > > > > > > > - Ensure that we do have alignment by adding an ASSERT so that when not
> > > > > > > > aligned we fail to link (and explain why).
> > > > > > > > - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> > > > > > > > provide the above alignments.
> > > > > > > >
> > > > > > > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > > > > >
> > > > > > > For unclear reasons, this seems to break boot via xmodem protocol on my
> > > > > > > Synology DS414. I found this commit via 'git bisect'. The symptom is:
> > > > > > >
> > > > > > > | kwboot version 2026.04-rc1-00098-g6ad0cf8f83db
> > > > > > > | Detected kwbimage v1 with SPI boot signature
> > > > > > > | Patching image boot signature to UART
> > > > > > > | Aligning image header to Xmodem block size
> > > > > > > | Sending boot message. Please reboot the target...\
> > > > > > > | Sending boot image header (67584 bytes)...
> > > > > > > | 0 % [......................................................................]
> > > > > > > | 13 % [......................................................................]
> > > > > > > | 26 % [......................................................................]
> > > > > > > | 39 % [......................................................................]
> > > > > > > | 53 % [......................................................................]
> > > > > > > | 66 % [......................................................................]
> > > > > > > | 79 % [......................................................................]
> > > > > > > | 92 % [...................................... ]
> > > > > > > | Done
> > > > > > > | Missing DTB
> > > > > > > | spl_init() failed: -2
> > > > > > > | ### ERROR ### Please RESET the board ###
> > > > > > > |
> > > > > > > |
> > > > > > > | xmodem: Connection timed out
> > > > > > >
> > > > > > > Debug printf()s in fdtdec_prepare_fdt() show that fdt_check_header()
> > > > > > > returns -FDT_ERR_BADMAGIC.
> > > > > > >
> > > > > > > With HEAD at a8d982e1f1726 ("x86: cpu: Fix crash on FTRACE enabled
> > > > > > > builds"), reverting arch/arm/cpu/u-boot-spl.lds like so:
> > > > > > >
> > > > > > > | @@ -41,14 +41,21 @@ SECTIONS
> > > > > > > | __binman_sym_start = .;
> > > > > > > | KEEP(*(SORT(.binman_sym*)));
> > > > > > > | __binman_sym_end = .;
> > > > > > > | - . = ALIGN(8);
> > > > > > > | }
> > > > > > > |
> > > > > > > | + . = ALIGN(4); /* critical! */
> > > > > > > | __image_copy_end = .;
> > > > > > > | + .rel.dyn : {
> > > > > > > | + __rel_dyn_start = .;
> > > > > > > | + *(.rel*)
> > > > > > > | + __rel_dyn_end = .;
> > > > > > > | + }
> > > > > > > | +
> > > > > > > | + . = ALIGN(8);
> > > > > > > | _image_binary_end = .;
> > > > > > > | _end = .;
> > > > > > > |
> > > > > > > | - .bss : {
> > > > > > > | + .bss __rel_dyn_start (OVERLAY) : {
> > > > > > > | __bss_start = .;
> > > > > > > | *(.bss*)
> > > > > > > | . = ALIGN(8);
> > > > > > >
> > > > > > > The SPL image starts up again and continues loading the real uboot
> > > > > > > image. Note that I have no idea what these changes actually do, so I
> > > > > > > need instructions if I should dig further.
> > > > > >
> > > > > > Does:
> > > > > > https://patchwork.ozlabs.org/project/uboot/patch/20260130183635.2612933-1-trini@konsulko.com/
> > > > > > fix it?
> > > > >
> > > > > Sadly not, same result.
> > > >
> > > > Ugh. What file, specifically, do you send via xmodem? And so that maybe
> > > > I can more easily replicate the failure, are you using the kernel.org
> > > > gcc-14.2.0 toolchain or something else?
> > >
> > > I am building with a custom-built arm-openadk-linux-uclibceabi-gcc
> > > version 14.3.0. Basically what I run is:
> > >
> > > MYENV='ARCH=arm CROSS_COMPILE=~/git/openadk-ds414/toolchain_synology-ds414_uclibc-ng_softfp_eabi_arm/usr/bin/arm-openadk-linux-uclibceabi-'
> > >
> > > make $MYENV clean && \
> > > for f in $(ls u-boot*.kwb 2>/dev/null); do rm $f; done && \
> > > make $MYENV ds414_defconfig && \
> > > make $MYENV -j12 && \
> > > ./tools/kwboot -a -t -p -b u-boot-*spl.kwb /dev/ttyUSB0
> > >
> > > With current uboot, this should be u-boot-with-spl.kwb image.
> > >
> > > With said patch reverted (or the above changes applied), I produce a
> > > working u-boot-with-spl.kwb which loads and boots linux from flash. So
> > > my toolchain is at least not totally broken. ;)
> >
> > Right, so, for background, the following threads might shed some light
> > on things:
> > https://lore.kernel.org/u-boot/CAOMZO5DZNJ+=AP1spWCv7Ar6etf03H=DFVU=mXZcC7QFTGoh_Q@mail.gmail.com/
> > https://lore.kernel.org/u-boot/20260123161907.392211-1-festevam@gmail.com/
> >
> > And so to that end, can you please do:
> > hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed'
> > and let me know what that says? And the first line there should match,
> > content-wise at least (but not quite file offset) spl/u-boot-spl. I was
> > asking about your toolchain because with gcc-14.2.0 from kernel.org:
> > $ hexdump -Cv /tmp/ds414/spl/u-boot-spl | grep 'd0 0d fe ed'
> > 00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > $ hexdump -Cv /tmp/ds414/u-boot-with-spl.kwb | grep 'd0 0d fe ed'
> > 00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
>
> This is with HEAD at a8d982e1f17 + your "spl: Ensure final section before BSS
> is non-empty" applied:
>
> % hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed' | head -n1
> 00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
>
> % hexdump -Cv spl/u-boot-spl | grep 'd0 0d fe ed'
> 00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
>
> > And while this should then *work* that's luck and not design. If you can
> > confirm that instead 'd0 0d fe ed' is in the middle (and so 4 byte but
> > not 8 byte aligned) it'll at least be the same symptom as before.
>
> Hmm. My dumps indicate correct 8B alignment, right? Switching over to a branch
> which has the problematic commit reverted and produced images work, I
> get exactly the same output from hexdump on those files, BTW. Does that
> mean we're on the wrong track and my problem is not wrong DTB alignment?
So, I'm not sure. The error message is what shows up quickly from trying
to find the device tree, and not finding it. In debugging the other
times, we did see mysterious shifts 4 bytes in either direction, but
never 8 bytes. I think you might need to start throwing some debug
prints around and seeing where the device tree *is* at run time in
relation to where it's expected to be.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-02-04 23:04 ` Tom Rini
@ 2026-02-04 23:29 ` Phil Sutter
2026-02-04 23:35 ` Tom Rini
0 siblings, 1 reply; 56+ messages in thread
From: Phil Sutter @ 2026-02-04 23:29 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Fabio Estevam, Ilias Apalodimas, Jagan Teki,
Joel Stanley, Kever Yang, Michal Simek, Philipp Tomsich,
Richard Henderson, Ryan Chen, Stefano Babic
On Wed, Feb 04, 2026 at 05:04:16PM -0600, Tom Rini wrote:
> On Thu, Feb 05, 2026 at 12:00:34AM +0100, Phil Sutter wrote:
> > On Wed, Feb 04, 2026 at 03:50:16PM -0600, Tom Rini wrote:
> > > On Wed, Feb 04, 2026 at 10:40:12PM +0100, Phil Sutter wrote:
> > > > On Wed, Feb 04, 2026 at 03:31:39PM -0600, Tom Rini wrote:
> > > > > On Wed, Feb 04, 2026 at 10:27:11PM +0100, Phil Sutter wrote:
> > > > > > On Wed, Feb 04, 2026 at 03:20:10PM -0600, Tom Rini wrote:
> > > > > > > On Wed, Feb 04, 2026 at 10:16:12PM +0100, Phil Sutter wrote:
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > On Thu, Jan 15, 2026 at 04:19:32PM -0600, Tom Rini wrote:
> > > > > > > > > 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:
> > > > > > > > > - Expands some linker sections to be more readable when adding a second
> > > > > > > > > statement to the section.
> > > > > > > > > - Aligns the final section before _end (for U-Boot) or
> > > > > > > > > _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> > > > > > > > > '. = ALIGN(8);' to the final section before the symbol.
> > > > > > > > > - Ensure that we do have alignment by adding an ASSERT so that when not
> > > > > > > > > aligned we fail to link (and explain why).
> > > > > > > > > - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> > > > > > > > > provide the above alignments.
> > > > > > > > >
> > > > > > > > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > > > > > >
> > > > > > > > For unclear reasons, this seems to break boot via xmodem protocol on my
> > > > > > > > Synology DS414. I found this commit via 'git bisect'. The symptom is:
> > > > > > > >
> > > > > > > > | kwboot version 2026.04-rc1-00098-g6ad0cf8f83db
> > > > > > > > | Detected kwbimage v1 with SPI boot signature
> > > > > > > > | Patching image boot signature to UART
> > > > > > > > | Aligning image header to Xmodem block size
> > > > > > > > | Sending boot message. Please reboot the target...\
> > > > > > > > | Sending boot image header (67584 bytes)...
> > > > > > > > | 0 % [......................................................................]
> > > > > > > > | 13 % [......................................................................]
> > > > > > > > | 26 % [......................................................................]
> > > > > > > > | 39 % [......................................................................]
> > > > > > > > | 53 % [......................................................................]
> > > > > > > > | 66 % [......................................................................]
> > > > > > > > | 79 % [......................................................................]
> > > > > > > > | 92 % [...................................... ]
> > > > > > > > | Done
> > > > > > > > | Missing DTB
> > > > > > > > | spl_init() failed: -2
> > > > > > > > | ### ERROR ### Please RESET the board ###
> > > > > > > > |
> > > > > > > > |
> > > > > > > > | xmodem: Connection timed out
> > > > > > > >
> > > > > > > > Debug printf()s in fdtdec_prepare_fdt() show that fdt_check_header()
> > > > > > > > returns -FDT_ERR_BADMAGIC.
> > > > > > > >
> > > > > > > > With HEAD at a8d982e1f1726 ("x86: cpu: Fix crash on FTRACE enabled
> > > > > > > > builds"), reverting arch/arm/cpu/u-boot-spl.lds like so:
> > > > > > > >
> > > > > > > > | @@ -41,14 +41,21 @@ SECTIONS
> > > > > > > > | __binman_sym_start = .;
> > > > > > > > | KEEP(*(SORT(.binman_sym*)));
> > > > > > > > | __binman_sym_end = .;
> > > > > > > > | - . = ALIGN(8);
> > > > > > > > | }
> > > > > > > > |
> > > > > > > > | + . = ALIGN(4); /* critical! */
> > > > > > > > | __image_copy_end = .;
> > > > > > > > | + .rel.dyn : {
> > > > > > > > | + __rel_dyn_start = .;
> > > > > > > > | + *(.rel*)
> > > > > > > > | + __rel_dyn_end = .;
> > > > > > > > | + }
> > > > > > > > | +
> > > > > > > > | + . = ALIGN(8);
> > > > > > > > | _image_binary_end = .;
> > > > > > > > | _end = .;
> > > > > > > > |
> > > > > > > > | - .bss : {
> > > > > > > > | + .bss __rel_dyn_start (OVERLAY) : {
> > > > > > > > | __bss_start = .;
> > > > > > > > | *(.bss*)
> > > > > > > > | . = ALIGN(8);
> > > > > > > >
> > > > > > > > The SPL image starts up again and continues loading the real uboot
> > > > > > > > image. Note that I have no idea what these changes actually do, so I
> > > > > > > > need instructions if I should dig further.
> > > > > > >
> > > > > > > Does:
> > > > > > > https://patchwork.ozlabs.org/project/uboot/patch/20260130183635.2612933-1-trini@konsulko.com/
> > > > > > > fix it?
> > > > > >
> > > > > > Sadly not, same result.
> > > > >
> > > > > Ugh. What file, specifically, do you send via xmodem? And so that maybe
> > > > > I can more easily replicate the failure, are you using the kernel.org
> > > > > gcc-14.2.0 toolchain or something else?
> > > >
> > > > I am building with a custom-built arm-openadk-linux-uclibceabi-gcc
> > > > version 14.3.0. Basically what I run is:
> > > >
> > > > MYENV='ARCH=arm CROSS_COMPILE=~/git/openadk-ds414/toolchain_synology-ds414_uclibc-ng_softfp_eabi_arm/usr/bin/arm-openadk-linux-uclibceabi-'
> > > >
> > > > make $MYENV clean && \
> > > > for f in $(ls u-boot*.kwb 2>/dev/null); do rm $f; done && \
> > > > make $MYENV ds414_defconfig && \
> > > > make $MYENV -j12 && \
> > > > ./tools/kwboot -a -t -p -b u-boot-*spl.kwb /dev/ttyUSB0
> > > >
> > > > With current uboot, this should be u-boot-with-spl.kwb image.
> > > >
> > > > With said patch reverted (or the above changes applied), I produce a
> > > > working u-boot-with-spl.kwb which loads and boots linux from flash. So
> > > > my toolchain is at least not totally broken. ;)
> > >
> > > Right, so, for background, the following threads might shed some light
> > > on things:
> > > https://lore.kernel.org/u-boot/CAOMZO5DZNJ+=AP1spWCv7Ar6etf03H=DFVU=mXZcC7QFTGoh_Q@mail.gmail.com/
> > > https://lore.kernel.org/u-boot/20260123161907.392211-1-festevam@gmail.com/
> > >
> > > And so to that end, can you please do:
> > > hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed'
> > > and let me know what that says? And the first line there should match,
> > > content-wise at least (but not quite file offset) spl/u-boot-spl. I was
> > > asking about your toolchain because with gcc-14.2.0 from kernel.org:
> > > $ hexdump -Cv /tmp/ds414/spl/u-boot-spl | grep 'd0 0d fe ed'
> > > 00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > > $ hexdump -Cv /tmp/ds414/u-boot-with-spl.kwb | grep 'd0 0d fe ed'
> > > 00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> >
> > This is with HEAD at a8d982e1f17 + your "spl: Ensure final section before BSS
> > is non-empty" applied:
> >
> > % hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed' | head -n1
> > 00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> >
> > % hexdump -Cv spl/u-boot-spl | grep 'd0 0d fe ed'
> > 00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> >
> > > And while this should then *work* that's luck and not design. If you can
> > > confirm that instead 'd0 0d fe ed' is in the middle (and so 4 byte but
> > > not 8 byte aligned) it'll at least be the same symptom as before.
> >
> > Hmm. My dumps indicate correct 8B alignment, right? Switching over to a branch
> > which has the problematic commit reverted and produced images work, I
> > get exactly the same output from hexdump on those files, BTW. Does that
> > mean we're on the wrong track and my problem is not wrong DTB alignment?
>
> So, I'm not sure. The error message is what shows up quickly from trying
> to find the device tree, and not finding it. In debugging the other
> times, we did see mysterious shifts 4 bytes in either direction, but
> never 8 bytes. I think you might need to start throwing some debug
> prints around and seeing where the device tree *is* at run time in
> relation to where it's expected to be.
FDT_MAGIC sequence is found 12B before 'blob' as passed to
fdtdec_prepare_fdt(). I searched in a range of (-128;127), it was the
only offset which matched.
Cheers, Phil
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-02-04 23:29 ` Phil Sutter
@ 2026-02-04 23:35 ` Tom Rini
2026-02-04 23:48 ` Phil Sutter
0 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-02-04 23:35 UTC (permalink / raw)
To: Phil Sutter, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev, Fabio Estevam,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Kever Yang,
Michal Simek, Philipp Tomsich, Richard Henderson, Ryan Chen,
Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 9886 bytes --]
On Thu, Feb 05, 2026 at 12:29:52AM +0100, Phil Sutter wrote:
> On Wed, Feb 04, 2026 at 05:04:16PM -0600, Tom Rini wrote:
> > On Thu, Feb 05, 2026 at 12:00:34AM +0100, Phil Sutter wrote:
> > > On Wed, Feb 04, 2026 at 03:50:16PM -0600, Tom Rini wrote:
> > > > On Wed, Feb 04, 2026 at 10:40:12PM +0100, Phil Sutter wrote:
> > > > > On Wed, Feb 04, 2026 at 03:31:39PM -0600, Tom Rini wrote:
> > > > > > On Wed, Feb 04, 2026 at 10:27:11PM +0100, Phil Sutter wrote:
> > > > > > > On Wed, Feb 04, 2026 at 03:20:10PM -0600, Tom Rini wrote:
> > > > > > > > On Wed, Feb 04, 2026 at 10:16:12PM +0100, Phil Sutter wrote:
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > On Thu, Jan 15, 2026 at 04:19:32PM -0600, Tom Rini wrote:
> > > > > > > > > > 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:
> > > > > > > > > > - Expands some linker sections to be more readable when adding a second
> > > > > > > > > > statement to the section.
> > > > > > > > > > - Aligns the final section before _end (for U-Boot) or
> > > > > > > > > > _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> > > > > > > > > > '. = ALIGN(8);' to the final section before the symbol.
> > > > > > > > > > - Ensure that we do have alignment by adding an ASSERT so that when not
> > > > > > > > > > aligned we fail to link (and explain why).
> > > > > > > > > > - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> > > > > > > > > > provide the above alignments.
> > > > > > > > > >
> > > > > > > > > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > > > > > > >
> > > > > > > > > For unclear reasons, this seems to break boot via xmodem protocol on my
> > > > > > > > > Synology DS414. I found this commit via 'git bisect'. The symptom is:
> > > > > > > > >
> > > > > > > > > | kwboot version 2026.04-rc1-00098-g6ad0cf8f83db
> > > > > > > > > | Detected kwbimage v1 with SPI boot signature
> > > > > > > > > | Patching image boot signature to UART
> > > > > > > > > | Aligning image header to Xmodem block size
> > > > > > > > > | Sending boot message. Please reboot the target...\
> > > > > > > > > | Sending boot image header (67584 bytes)...
> > > > > > > > > | 0 % [......................................................................]
> > > > > > > > > | 13 % [......................................................................]
> > > > > > > > > | 26 % [......................................................................]
> > > > > > > > > | 39 % [......................................................................]
> > > > > > > > > | 53 % [......................................................................]
> > > > > > > > > | 66 % [......................................................................]
> > > > > > > > > | 79 % [......................................................................]
> > > > > > > > > | 92 % [...................................... ]
> > > > > > > > > | Done
> > > > > > > > > | Missing DTB
> > > > > > > > > | spl_init() failed: -2
> > > > > > > > > | ### ERROR ### Please RESET the board ###
> > > > > > > > > |
> > > > > > > > > |
> > > > > > > > > | xmodem: Connection timed out
> > > > > > > > >
> > > > > > > > > Debug printf()s in fdtdec_prepare_fdt() show that fdt_check_header()
> > > > > > > > > returns -FDT_ERR_BADMAGIC.
> > > > > > > > >
> > > > > > > > > With HEAD at a8d982e1f1726 ("x86: cpu: Fix crash on FTRACE enabled
> > > > > > > > > builds"), reverting arch/arm/cpu/u-boot-spl.lds like so:
> > > > > > > > >
> > > > > > > > > | @@ -41,14 +41,21 @@ SECTIONS
> > > > > > > > > | __binman_sym_start = .;
> > > > > > > > > | KEEP(*(SORT(.binman_sym*)));
> > > > > > > > > | __binman_sym_end = .;
> > > > > > > > > | - . = ALIGN(8);
> > > > > > > > > | }
> > > > > > > > > |
> > > > > > > > > | + . = ALIGN(4); /* critical! */
> > > > > > > > > | __image_copy_end = .;
> > > > > > > > > | + .rel.dyn : {
> > > > > > > > > | + __rel_dyn_start = .;
> > > > > > > > > | + *(.rel*)
> > > > > > > > > | + __rel_dyn_end = .;
> > > > > > > > > | + }
> > > > > > > > > | +
> > > > > > > > > | + . = ALIGN(8);
> > > > > > > > > | _image_binary_end = .;
> > > > > > > > > | _end = .;
> > > > > > > > > |
> > > > > > > > > | - .bss : {
> > > > > > > > > | + .bss __rel_dyn_start (OVERLAY) : {
> > > > > > > > > | __bss_start = .;
> > > > > > > > > | *(.bss*)
> > > > > > > > > | . = ALIGN(8);
> > > > > > > > >
> > > > > > > > > The SPL image starts up again and continues loading the real uboot
> > > > > > > > > image. Note that I have no idea what these changes actually do, so I
> > > > > > > > > need instructions if I should dig further.
> > > > > > > >
> > > > > > > > Does:
> > > > > > > > https://patchwork.ozlabs.org/project/uboot/patch/20260130183635.2612933-1-trini@konsulko.com/
> > > > > > > > fix it?
> > > > > > >
> > > > > > > Sadly not, same result.
> > > > > >
> > > > > > Ugh. What file, specifically, do you send via xmodem? And so that maybe
> > > > > > I can more easily replicate the failure, are you using the kernel.org
> > > > > > gcc-14.2.0 toolchain or something else?
> > > > >
> > > > > I am building with a custom-built arm-openadk-linux-uclibceabi-gcc
> > > > > version 14.3.0. Basically what I run is:
> > > > >
> > > > > MYENV='ARCH=arm CROSS_COMPILE=~/git/openadk-ds414/toolchain_synology-ds414_uclibc-ng_softfp_eabi_arm/usr/bin/arm-openadk-linux-uclibceabi-'
> > > > >
> > > > > make $MYENV clean && \
> > > > > for f in $(ls u-boot*.kwb 2>/dev/null); do rm $f; done && \
> > > > > make $MYENV ds414_defconfig && \
> > > > > make $MYENV -j12 && \
> > > > > ./tools/kwboot -a -t -p -b u-boot-*spl.kwb /dev/ttyUSB0
> > > > >
> > > > > With current uboot, this should be u-boot-with-spl.kwb image.
> > > > >
> > > > > With said patch reverted (or the above changes applied), I produce a
> > > > > working u-boot-with-spl.kwb which loads and boots linux from flash. So
> > > > > my toolchain is at least not totally broken. ;)
> > > >
> > > > Right, so, for background, the following threads might shed some light
> > > > on things:
> > > > https://lore.kernel.org/u-boot/CAOMZO5DZNJ+=AP1spWCv7Ar6etf03H=DFVU=mXZcC7QFTGoh_Q@mail.gmail.com/
> > > > https://lore.kernel.org/u-boot/20260123161907.392211-1-festevam@gmail.com/
> > > >
> > > > And so to that end, can you please do:
> > > > hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed'
> > > > and let me know what that says? And the first line there should match,
> > > > content-wise at least (but not quite file offset) spl/u-boot-spl. I was
> > > > asking about your toolchain because with gcc-14.2.0 from kernel.org:
> > > > $ hexdump -Cv /tmp/ds414/spl/u-boot-spl | grep 'd0 0d fe ed'
> > > > 00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > > > $ hexdump -Cv /tmp/ds414/u-boot-with-spl.kwb | grep 'd0 0d fe ed'
> > > > 00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > >
> > > This is with HEAD at a8d982e1f17 + your "spl: Ensure final section before BSS
> > > is non-empty" applied:
> > >
> > > % hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed' | head -n1
> > > 00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > >
> > > % hexdump -Cv spl/u-boot-spl | grep 'd0 0d fe ed'
> > > 00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > >
> > > > And while this should then *work* that's luck and not design. If you can
> > > > confirm that instead 'd0 0d fe ed' is in the middle (and so 4 byte but
> > > > not 8 byte aligned) it'll at least be the same symptom as before.
> > >
> > > Hmm. My dumps indicate correct 8B alignment, right? Switching over to a branch
> > > which has the problematic commit reverted and produced images work, I
> > > get exactly the same output from hexdump on those files, BTW. Does that
> > > mean we're on the wrong track and my problem is not wrong DTB alignment?
> >
> > So, I'm not sure. The error message is what shows up quickly from trying
> > to find the device tree, and not finding it. In debugging the other
> > times, we did see mysterious shifts 4 bytes in either direction, but
> > never 8 bytes. I think you might need to start throwing some debug
> > prints around and seeing where the device tree *is* at run time in
> > relation to where it's expected to be.
>
> FDT_MAGIC sequence is found 12B before 'blob' as passed to
> fdtdec_prepare_fdt(). I searched in a range of (-128;127), it was the
> only offset which matched.
So, our mysterious 4 shift is now 12. If you undo the patch I asked you
to test, is it now 4B before? I basically want to confirm that my newest
patch just changes when we hit this problem and doesn't solve it, only
changes the mystery shift. Oh, and can you please readelf -S the
spl/u-boot-spl for both with my patch and current master AND the one you
made work? Thanks again!
>
> Cheers, Phil
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-02-04 23:35 ` Tom Rini
@ 2026-02-04 23:48 ` Phil Sutter
2026-02-05 18:01 ` Tom Rini
0 siblings, 1 reply; 56+ messages in thread
From: Phil Sutter @ 2026-02-04 23:48 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, NXP i.MX U-Boot Team,
Adam Ford, Andre Przywara, Aspeed BMC SW team, Chia-Wei Wang,
Eugen Hristev, Fabio Estevam, Ilias Apalodimas, Jagan Teki,
Joel Stanley, Kever Yang, Michal Simek, Philipp Tomsich,
Richard Henderson, Ryan Chen, Stefano Babic
On Wed, Feb 04, 2026 at 05:35:50PM -0600, Tom Rini wrote:
> On Thu, Feb 05, 2026 at 12:29:52AM +0100, Phil Sutter wrote:
> > On Wed, Feb 04, 2026 at 05:04:16PM -0600, Tom Rini wrote:
> > > On Thu, Feb 05, 2026 at 12:00:34AM +0100, Phil Sutter wrote:
> > > > On Wed, Feb 04, 2026 at 03:50:16PM -0600, Tom Rini wrote:
> > > > > On Wed, Feb 04, 2026 at 10:40:12PM +0100, Phil Sutter wrote:
> > > > > > On Wed, Feb 04, 2026 at 03:31:39PM -0600, Tom Rini wrote:
> > > > > > > On Wed, Feb 04, 2026 at 10:27:11PM +0100, Phil Sutter wrote:
> > > > > > > > On Wed, Feb 04, 2026 at 03:20:10PM -0600, Tom Rini wrote:
> > > > > > > > > On Wed, Feb 04, 2026 at 10:16:12PM +0100, Phil Sutter wrote:
> > > > > > > > > > Hi,
> > > > > > > > > >
> > > > > > > > > > On Thu, Jan 15, 2026 at 04:19:32PM -0600, Tom Rini wrote:
> > > > > > > > > > > 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:
> > > > > > > > > > > - Expands some linker sections to be more readable when adding a second
> > > > > > > > > > > statement to the section.
> > > > > > > > > > > - Aligns the final section before _end (for U-Boot) or
> > > > > > > > > > > _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> > > > > > > > > > > '. = ALIGN(8);' to the final section before the symbol.
> > > > > > > > > > > - Ensure that we do have alignment by adding an ASSERT so that when not
> > > > > > > > > > > aligned we fail to link (and explain why).
> > > > > > > > > > > - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> > > > > > > > > > > provide the above alignments.
> > > > > > > > > > >
> > > > > > > > > > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > > > > > > > >
> > > > > > > > > > For unclear reasons, this seems to break boot via xmodem protocol on my
> > > > > > > > > > Synology DS414. I found this commit via 'git bisect'. The symptom is:
> > > > > > > > > >
> > > > > > > > > > | kwboot version 2026.04-rc1-00098-g6ad0cf8f83db
> > > > > > > > > > | Detected kwbimage v1 with SPI boot signature
> > > > > > > > > > | Patching image boot signature to UART
> > > > > > > > > > | Aligning image header to Xmodem block size
> > > > > > > > > > | Sending boot message. Please reboot the target...\
> > > > > > > > > > | Sending boot image header (67584 bytes)...
> > > > > > > > > > | 0 % [......................................................................]
> > > > > > > > > > | 13 % [......................................................................]
> > > > > > > > > > | 26 % [......................................................................]
> > > > > > > > > > | 39 % [......................................................................]
> > > > > > > > > > | 53 % [......................................................................]
> > > > > > > > > > | 66 % [......................................................................]
> > > > > > > > > > | 79 % [......................................................................]
> > > > > > > > > > | 92 % [...................................... ]
> > > > > > > > > > | Done
> > > > > > > > > > | Missing DTB
> > > > > > > > > > | spl_init() failed: -2
> > > > > > > > > > | ### ERROR ### Please RESET the board ###
> > > > > > > > > > |
> > > > > > > > > > |
> > > > > > > > > > | xmodem: Connection timed out
> > > > > > > > > >
> > > > > > > > > > Debug printf()s in fdtdec_prepare_fdt() show that fdt_check_header()
> > > > > > > > > > returns -FDT_ERR_BADMAGIC.
> > > > > > > > > >
> > > > > > > > > > With HEAD at a8d982e1f1726 ("x86: cpu: Fix crash on FTRACE enabled
> > > > > > > > > > builds"), reverting arch/arm/cpu/u-boot-spl.lds like so:
> > > > > > > > > >
> > > > > > > > > > | @@ -41,14 +41,21 @@ SECTIONS
> > > > > > > > > > | __binman_sym_start = .;
> > > > > > > > > > | KEEP(*(SORT(.binman_sym*)));
> > > > > > > > > > | __binman_sym_end = .;
> > > > > > > > > > | - . = ALIGN(8);
> > > > > > > > > > | }
> > > > > > > > > > |
> > > > > > > > > > | + . = ALIGN(4); /* critical! */
> > > > > > > > > > | __image_copy_end = .;
> > > > > > > > > > | + .rel.dyn : {
> > > > > > > > > > | + __rel_dyn_start = .;
> > > > > > > > > > | + *(.rel*)
> > > > > > > > > > | + __rel_dyn_end = .;
> > > > > > > > > > | + }
> > > > > > > > > > | +
> > > > > > > > > > | + . = ALIGN(8);
> > > > > > > > > > | _image_binary_end = .;
> > > > > > > > > > | _end = .;
> > > > > > > > > > |
> > > > > > > > > > | - .bss : {
> > > > > > > > > > | + .bss __rel_dyn_start (OVERLAY) : {
> > > > > > > > > > | __bss_start = .;
> > > > > > > > > > | *(.bss*)
> > > > > > > > > > | . = ALIGN(8);
> > > > > > > > > >
> > > > > > > > > > The SPL image starts up again and continues loading the real uboot
> > > > > > > > > > image. Note that I have no idea what these changes actually do, so I
> > > > > > > > > > need instructions if I should dig further.
> > > > > > > > >
> > > > > > > > > Does:
> > > > > > > > > https://patchwork.ozlabs.org/project/uboot/patch/20260130183635.2612933-1-trini@konsulko.com/
> > > > > > > > > fix it?
> > > > > > > >
> > > > > > > > Sadly not, same result.
> > > > > > >
> > > > > > > Ugh. What file, specifically, do you send via xmodem? And so that maybe
> > > > > > > I can more easily replicate the failure, are you using the kernel.org
> > > > > > > gcc-14.2.0 toolchain or something else?
> > > > > >
> > > > > > I am building with a custom-built arm-openadk-linux-uclibceabi-gcc
> > > > > > version 14.3.0. Basically what I run is:
> > > > > >
> > > > > > MYENV='ARCH=arm CROSS_COMPILE=~/git/openadk-ds414/toolchain_synology-ds414_uclibc-ng_softfp_eabi_arm/usr/bin/arm-openadk-linux-uclibceabi-'
> > > > > >
> > > > > > make $MYENV clean && \
> > > > > > for f in $(ls u-boot*.kwb 2>/dev/null); do rm $f; done && \
> > > > > > make $MYENV ds414_defconfig && \
> > > > > > make $MYENV -j12 && \
> > > > > > ./tools/kwboot -a -t -p -b u-boot-*spl.kwb /dev/ttyUSB0
> > > > > >
> > > > > > With current uboot, this should be u-boot-with-spl.kwb image.
> > > > > >
> > > > > > With said patch reverted (or the above changes applied), I produce a
> > > > > > working u-boot-with-spl.kwb which loads and boots linux from flash. So
> > > > > > my toolchain is at least not totally broken. ;)
> > > > >
> > > > > Right, so, for background, the following threads might shed some light
> > > > > on things:
> > > > > https://lore.kernel.org/u-boot/CAOMZO5DZNJ+=AP1spWCv7Ar6etf03H=DFVU=mXZcC7QFTGoh_Q@mail.gmail.com/
> > > > > https://lore.kernel.org/u-boot/20260123161907.392211-1-festevam@gmail.com/
> > > > >
> > > > > And so to that end, can you please do:
> > > > > hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed'
> > > > > and let me know what that says? And the first line there should match,
> > > > > content-wise at least (but not quite file offset) spl/u-boot-spl. I was
> > > > > asking about your toolchain because with gcc-14.2.0 from kernel.org:
> > > > > $ hexdump -Cv /tmp/ds414/spl/u-boot-spl | grep 'd0 0d fe ed'
> > > > > 00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > > > > $ hexdump -Cv /tmp/ds414/u-boot-with-spl.kwb | grep 'd0 0d fe ed'
> > > > > 00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > > >
> > > > This is with HEAD at a8d982e1f17 + your "spl: Ensure final section before BSS
> > > > is non-empty" applied:
> > > >
> > > > % hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed' | head -n1
> > > > 00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > > >
> > > > % hexdump -Cv spl/u-boot-spl | grep 'd0 0d fe ed'
> > > > 00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > > >
> > > > > And while this should then *work* that's luck and not design. If you can
> > > > > confirm that instead 'd0 0d fe ed' is in the middle (and so 4 byte but
> > > > > not 8 byte aligned) it'll at least be the same symptom as before.
> > > >
> > > > Hmm. My dumps indicate correct 8B alignment, right? Switching over to a branch
> > > > which has the problematic commit reverted and produced images work, I
> > > > get exactly the same output from hexdump on those files, BTW. Does that
> > > > mean we're on the wrong track and my problem is not wrong DTB alignment?
> > >
> > > So, I'm not sure. The error message is what shows up quickly from trying
> > > to find the device tree, and not finding it. In debugging the other
> > > times, we did see mysterious shifts 4 bytes in either direction, but
> > > never 8 bytes. I think you might need to start throwing some debug
> > > prints around and seeing where the device tree *is* at run time in
> > > relation to where it's expected to be.
> >
> > FDT_MAGIC sequence is found 12B before 'blob' as passed to
> > fdtdec_prepare_fdt(). I searched in a range of (-128;127), it was the
> > only offset which matched.
>
> So, our mysterious 4 shift is now 12. If you undo the patch I asked you
> to test, is it now 4B before? I basically want to confirm that my newest
> patch just changes when we hit this problem and doesn't solve it, only
> changes the mystery shift. Oh, and can you please readelf -S the
> spl/u-boot-spl for both with my patch and current master AND the one you
> made work? Thanks again!
Sorry for the mess, I did my FDT_MAGIC search with master branch, so not
with your patch applied. Readelf prints:
% readelf -S spl/u-boot-spl
There are 20 section headers, starting at offset 0x127d54:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 40004030 001030 009c1e 00 AX 0 0 16
[ 2] .rodata PROGBITS 4000dc50 00ac50 0016f9 00 A 0 0 4
[ 3] .data PROGBITS 4000f360 00c360 0042e0 00 WA 0 0 32
[ 4] __u_boot_list PROGBITS 40013640 010640 000594 00 WA 0 0 4
[ 5] .binman_sym_table NOBITS 40013bd4 010bd4 000004 00 WA 0 0 1
[ 6] .bss NOBITS 40013be0 010bd4 000728 00 WA 0 0 32
[ 7] .ARM.attributes ARM_ATTRIBUTES 00000000 010bd4 000029 00 0 0 1
[ 8] .comment PROGBITS 00000000 010bfd 000012 01 MS 0 0 1
[ 9] .debug_line PROGBITS 00000000 010c0f 02844f 00 0 0 1
[10] .debug_info PROGBITS 00000000 03905e 076ced 00 0 0 1
[11] .debug_abbrev PROGBITS 00000000 0afd4b 00f697 00 0 0 1
[12] .debug_aranges PROGBITS 00000000 0bf3e8 002430 00 0 0 8
[13] .debug_str PROGBITS 00000000 0c1818 00d85c 01 MS 0 0 1
[14] .debug_loc PROGBITS 00000000 0cf074 044a87 00 0 0 1
[15] .debug_ranges PROGBITS 00000000 113b00 006578 00 0 0 8
[16] .debug_frame PROGBITS 00000000 11a078 0069c0 00 0 0 4
[17] .symtab SYMTAB 00000000 120a38 004d10 10 18 888 4
[18] .strtab STRTAB 00000000 125748 002539 00 0 0 1
[19] .shstrtab STRTAB 00000000 127c81 0000d3 00 0 0 1
Next try with your patch applied on top of master:
FDT_MAGIC is found at offset -8. Readelf:
There are 19 section headers, starting at offset 0x127d34:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 40004030 001030 009c1e 00 AX 0 0 16
[ 2] .rodata PROGBITS 4000dc50 00ac50 0016f9 00 A 0 0 4
[ 3] .data PROGBITS 4000f360 00c360 0042e0 00 WA 0 0 32
[ 4] __u_boot_list PROGBITS 40013640 010640 000598 00 WA 0 0 4
[ 5] .bss NOBITS 40013be0 010bd8 000728 00 WA 0 0 32
[ 6] .ARM.attributes ARM_ATTRIBUTES 00000000 010bd8 000029 00 0 0 1
[ 7] .comment PROGBITS 00000000 010c01 000012 01 MS 0 0 1
[ 8] .debug_line PROGBITS 00000000 010c13 02844f 00 0 0 1
[ 9] .debug_info PROGBITS 00000000 039062 076ced 00 0 0 1
[10] .debug_abbrev PROGBITS 00000000 0afd4f 00f697 00 0 0 1
[11] .debug_aranges PROGBITS 00000000 0bf3e8 002430 00 0 0 8
[12] .debug_str PROGBITS 00000000 0c1818 00d85c 01 MS 0 0 1
[13] .debug_loc PROGBITS 00000000 0cf074 044a87 00 0 0 1
[14] .debug_ranges PROGBITS 00000000 113b00 006578 00 0 0 8
[15] .debug_frame PROGBITS 00000000 11a078 0069c0 00 0 0 4
[16] .symtab SYMTAB 00000000 120a38 004d00 10 17 887 4
[17] .strtab STRTAB 00000000 125738 002539 00 0 0 1
[18] .shstrtab STRTAB 00000000 127c71 0000c1 00 0 0 1
Finally, with problematic patches reverted:
FDT_MAGIC is found at offset 0 (obviously). Readelf:
There are 19 section headers, starting at offset 0x1284a0:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 40004030 001030 009c1e 00 AX 0 0 16
[ 2] .rodata PROGBITS 4000dc50 00ac50 0016f9 00 A 0 0 4
[ 3] .data PROGBITS 4000f360 00c360 0042e0 00 WA 0 0 32
[ 4] __u_boot_list PROGBITS 40013640 010640 000594 00 WA 0 0 4
[ 5] .bss PROGBITS 40013bd4 010bd4 000734 00 W 0 0 4
[ 6] .ARM.attributes ARM_ATTRIBUTES 00000000 011308 000029 00 0 0 1
[ 7] .comment PROGBITS 00000000 011331 000012 01 MS 0 0 1
[ 8] .debug_line PROGBITS 00000000 011343 02844f 00 0 0 1
[ 9] .debug_info PROGBITS 00000000 039792 076ced 00 0 0 1
[10] .debug_abbrev PROGBITS 00000000 0b047f 00f697 00 0 0 1
[11] .debug_aranges PROGBITS 00000000 0bfb18 002430 00 0 0 8
[12] .debug_str PROGBITS 00000000 0c1f48 00d85c 01 MS 0 0 1
[13] .debug_loc PROGBITS 00000000 0cf7a4 044a87 00 0 0 1
[14] .debug_ranges PROGBITS 00000000 114230 006578 00 0 0 8
[15] .debug_frame PROGBITS 00000000 11a7a8 0069c0 00 0 0 4
[16] .symtab SYMTAB 00000000 121168 004d20 10 17 887 4
[17] .strtab STRTAB 00000000 125e88 002557 00 0 0 1
[18] .shstrtab STRTAB 00000000 1283df 0000c1 00 0 0 1
HTH, Phil
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned
2026-02-04 23:48 ` Phil Sutter
@ 2026-02-05 18:01 ` Tom Rini
0 siblings, 0 replies; 56+ messages in thread
From: Tom Rini @ 2026-02-05 18:01 UTC (permalink / raw)
To: Phil Sutter, u-boot, Marek Vasut, Beleswar Padhi,
NXP i.MX U-Boot Team, Adam Ford, Andre Przywara,
Aspeed BMC SW team, Chia-Wei Wang, Eugen Hristev, Fabio Estevam,
Ilias Apalodimas, Jagan Teki, Joel Stanley, Kever Yang,
Michal Simek, Philipp Tomsich, Richard Henderson, Ryan Chen,
Stefano Babic
[-- Attachment #1: Type: text/plain, Size: 16751 bytes --]
On Thu, Feb 05, 2026 at 12:48:43AM +0100, Phil Sutter wrote:
> On Wed, Feb 04, 2026 at 05:35:50PM -0600, Tom Rini wrote:
> > On Thu, Feb 05, 2026 at 12:29:52AM +0100, Phil Sutter wrote:
> > > On Wed, Feb 04, 2026 at 05:04:16PM -0600, Tom Rini wrote:
> > > > On Thu, Feb 05, 2026 at 12:00:34AM +0100, Phil Sutter wrote:
> > > > > On Wed, Feb 04, 2026 at 03:50:16PM -0600, Tom Rini wrote:
> > > > > > On Wed, Feb 04, 2026 at 10:40:12PM +0100, Phil Sutter wrote:
> > > > > > > On Wed, Feb 04, 2026 at 03:31:39PM -0600, Tom Rini wrote:
> > > > > > > > On Wed, Feb 04, 2026 at 10:27:11PM +0100, Phil Sutter wrote:
> > > > > > > > > On Wed, Feb 04, 2026 at 03:20:10PM -0600, Tom Rini wrote:
> > > > > > > > > > On Wed, Feb 04, 2026 at 10:16:12PM +0100, Phil Sutter wrote:
> > > > > > > > > > > Hi,
> > > > > > > > > > >
> > > > > > > > > > > On Thu, Jan 15, 2026 at 04:19:32PM -0600, Tom Rini wrote:
> > > > > > > > > > > > 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:
> > > > > > > > > > > > - Expands some linker sections to be more readable when adding a second
> > > > > > > > > > > > statement to the section.
> > > > > > > > > > > > - Aligns the final section before _end (for U-Boot) or
> > > > > > > > > > > > _image_binary_end or __bss_end (for xPL phases) by 8-bytes by adding
> > > > > > > > > > > > '. = ALIGN(8);' to the final section before the symbol.
> > > > > > > > > > > > - Ensure that we do have alignment by adding an ASSERT so that when not
> > > > > > > > > > > > aligned we fail to link (and explain why).
> > > > > > > > > > > > - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> > > > > > > > > > > > provide the above alignments.
> > > > > > > > > > > >
> > > > > > > > > > > > Signed-off-by: Tom Rini <trini@konsulko.com>
> > > > > > > > > > >
> > > > > > > > > > > For unclear reasons, this seems to break boot via xmodem protocol on my
> > > > > > > > > > > Synology DS414. I found this commit via 'git bisect'. The symptom is:
> > > > > > > > > > >
> > > > > > > > > > > | kwboot version 2026.04-rc1-00098-g6ad0cf8f83db
> > > > > > > > > > > | Detected kwbimage v1 with SPI boot signature
> > > > > > > > > > > | Patching image boot signature to UART
> > > > > > > > > > > | Aligning image header to Xmodem block size
> > > > > > > > > > > | Sending boot message. Please reboot the target...\
> > > > > > > > > > > | Sending boot image header (67584 bytes)...
> > > > > > > > > > > | 0 % [......................................................................]
> > > > > > > > > > > | 13 % [......................................................................]
> > > > > > > > > > > | 26 % [......................................................................]
> > > > > > > > > > > | 39 % [......................................................................]
> > > > > > > > > > > | 53 % [......................................................................]
> > > > > > > > > > > | 66 % [......................................................................]
> > > > > > > > > > > | 79 % [......................................................................]
> > > > > > > > > > > | 92 % [...................................... ]
> > > > > > > > > > > | Done
> > > > > > > > > > > | Missing DTB
> > > > > > > > > > > | spl_init() failed: -2
> > > > > > > > > > > | ### ERROR ### Please RESET the board ###
> > > > > > > > > > > |
> > > > > > > > > > > |
> > > > > > > > > > > | xmodem: Connection timed out
> > > > > > > > > > >
> > > > > > > > > > > Debug printf()s in fdtdec_prepare_fdt() show that fdt_check_header()
> > > > > > > > > > > returns -FDT_ERR_BADMAGIC.
> > > > > > > > > > >
> > > > > > > > > > > With HEAD at a8d982e1f1726 ("x86: cpu: Fix crash on FTRACE enabled
> > > > > > > > > > > builds"), reverting arch/arm/cpu/u-boot-spl.lds like so:
> > > > > > > > > > >
> > > > > > > > > > > | @@ -41,14 +41,21 @@ SECTIONS
> > > > > > > > > > > | __binman_sym_start = .;
> > > > > > > > > > > | KEEP(*(SORT(.binman_sym*)));
> > > > > > > > > > > | __binman_sym_end = .;
> > > > > > > > > > > | - . = ALIGN(8);
> > > > > > > > > > > | }
> > > > > > > > > > > |
> > > > > > > > > > > | + . = ALIGN(4); /* critical! */
> > > > > > > > > > > | __image_copy_end = .;
> > > > > > > > > > > | + .rel.dyn : {
> > > > > > > > > > > | + __rel_dyn_start = .;
> > > > > > > > > > > | + *(.rel*)
> > > > > > > > > > > | + __rel_dyn_end = .;
> > > > > > > > > > > | + }
> > > > > > > > > > > | +
> > > > > > > > > > > | + . = ALIGN(8);
> > > > > > > > > > > | _image_binary_end = .;
> > > > > > > > > > > | _end = .;
> > > > > > > > > > > |
> > > > > > > > > > > | - .bss : {
> > > > > > > > > > > | + .bss __rel_dyn_start (OVERLAY) : {
> > > > > > > > > > > | __bss_start = .;
> > > > > > > > > > > | *(.bss*)
> > > > > > > > > > > | . = ALIGN(8);
> > > > > > > > > > >
> > > > > > > > > > > The SPL image starts up again and continues loading the real uboot
> > > > > > > > > > > image. Note that I have no idea what these changes actually do, so I
> > > > > > > > > > > need instructions if I should dig further.
> > > > > > > > > >
> > > > > > > > > > Does:
> > > > > > > > > > https://patchwork.ozlabs.org/project/uboot/patch/20260130183635.2612933-1-trini@konsulko.com/
> > > > > > > > > > fix it?
> > > > > > > > >
> > > > > > > > > Sadly not, same result.
> > > > > > > >
> > > > > > > > Ugh. What file, specifically, do you send via xmodem? And so that maybe
> > > > > > > > I can more easily replicate the failure, are you using the kernel.org
> > > > > > > > gcc-14.2.0 toolchain or something else?
> > > > > > >
> > > > > > > I am building with a custom-built arm-openadk-linux-uclibceabi-gcc
> > > > > > > version 14.3.0. Basically what I run is:
> > > > > > >
> > > > > > > MYENV='ARCH=arm CROSS_COMPILE=~/git/openadk-ds414/toolchain_synology-ds414_uclibc-ng_softfp_eabi_arm/usr/bin/arm-openadk-linux-uclibceabi-'
> > > > > > >
> > > > > > > make $MYENV clean && \
> > > > > > > for f in $(ls u-boot*.kwb 2>/dev/null); do rm $f; done && \
> > > > > > > make $MYENV ds414_defconfig && \
> > > > > > > make $MYENV -j12 && \
> > > > > > > ./tools/kwboot -a -t -p -b u-boot-*spl.kwb /dev/ttyUSB0
> > > > > > >
> > > > > > > With current uboot, this should be u-boot-with-spl.kwb image.
> > > > > > >
> > > > > > > With said patch reverted (or the above changes applied), I produce a
> > > > > > > working u-boot-with-spl.kwb which loads and boots linux from flash. So
> > > > > > > my toolchain is at least not totally broken. ;)
> > > > > >
> > > > > > Right, so, for background, the following threads might shed some light
> > > > > > on things:
> > > > > > https://lore.kernel.org/u-boot/CAOMZO5DZNJ+=AP1spWCv7Ar6etf03H=DFVU=mXZcC7QFTGoh_Q@mail.gmail.com/
> > > > > > https://lore.kernel.org/u-boot/20260123161907.392211-1-festevam@gmail.com/
> > > > > >
> > > > > > And so to that end, can you please do:
> > > > > > hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed'
> > > > > > and let me know what that says? And the first line there should match,
> > > > > > content-wise at least (but not quite file offset) spl/u-boot-spl. I was
> > > > > > asking about your toolchain because with gcc-14.2.0 from kernel.org:
> > > > > > $ hexdump -Cv /tmp/ds414/spl/u-boot-spl | grep 'd0 0d fe ed'
> > > > > > 00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > > > > > $ hexdump -Cv /tmp/ds414/u-boot-with-spl.kwb | grep 'd0 0d fe ed'
> > > > > > 00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > > > >
> > > > > This is with HEAD at a8d982e1f17 + your "spl: Ensure final section before BSS
> > > > > is non-empty" applied:
> > > > >
> > > > > % hexdump -Cv u-boot-with-spl.kwb | grep 'd0 0d fe ed' | head -n1
> > > > > 00001ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > > > >
> > > > > % hexdump -Cv spl/u-boot-spl | grep 'd0 0d fe ed'
> > > > > 00002ed0 6f f0 12 00 70 47 00 bf d0 0d fe ed 00 29 05 db |o...pG.......)..|
> > > > >
> > > > > > And while this should then *work* that's luck and not design. If you can
> > > > > > confirm that instead 'd0 0d fe ed' is in the middle (and so 4 byte but
> > > > > > not 8 byte aligned) it'll at least be the same symptom as before.
> > > > >
> > > > > Hmm. My dumps indicate correct 8B alignment, right? Switching over to a branch
> > > > > which has the problematic commit reverted and produced images work, I
> > > > > get exactly the same output from hexdump on those files, BTW. Does that
> > > > > mean we're on the wrong track and my problem is not wrong DTB alignment?
> > > >
> > > > So, I'm not sure. The error message is what shows up quickly from trying
> > > > to find the device tree, and not finding it. In debugging the other
> > > > times, we did see mysterious shifts 4 bytes in either direction, but
> > > > never 8 bytes. I think you might need to start throwing some debug
> > > > prints around and seeing where the device tree *is* at run time in
> > > > relation to where it's expected to be.
> > >
> > > FDT_MAGIC sequence is found 12B before 'blob' as passed to
> > > fdtdec_prepare_fdt(). I searched in a range of (-128;127), it was the
> > > only offset which matched.
> >
> > So, our mysterious 4 shift is now 12. If you undo the patch I asked you
> > to test, is it now 4B before? I basically want to confirm that my newest
> > patch just changes when we hit this problem and doesn't solve it, only
> > changes the mystery shift. Oh, and can you please readelf -S the
> > spl/u-boot-spl for both with my patch and current master AND the one you
> > made work? Thanks again!
>
> Sorry for the mess, I did my FDT_MAGIC search with master branch, so not
> with your patch applied. Readelf prints:
>
> % readelf -S spl/u-boot-spl
> There are 20 section headers, starting at offset 0x127d54:
>
> Section Headers:
> [Nr] Name Type Addr Off Size ES Flg Lk Inf Al
> [ 0] NULL 00000000 000000 000000 00 0 0 0
> [ 1] .text PROGBITS 40004030 001030 009c1e 00 AX 0 0 16
> [ 2] .rodata PROGBITS 4000dc50 00ac50 0016f9 00 A 0 0 4
> [ 3] .data PROGBITS 4000f360 00c360 0042e0 00 WA 0 0 32
> [ 4] __u_boot_list PROGBITS 40013640 010640 000594 00 WA 0 0 4
> [ 5] .binman_sym_table NOBITS 40013bd4 010bd4 000004 00 WA 0 0 1
> [ 6] .bss NOBITS 40013be0 010bd4 000728 00 WA 0 0 32
> [ 7] .ARM.attributes ARM_ATTRIBUTES 00000000 010bd4 000029 00 0 0 1
> [ 8] .comment PROGBITS 00000000 010bfd 000012 01 MS 0 0 1
> [ 9] .debug_line PROGBITS 00000000 010c0f 02844f 00 0 0 1
> [10] .debug_info PROGBITS 00000000 03905e 076ced 00 0 0 1
> [11] .debug_abbrev PROGBITS 00000000 0afd4b 00f697 00 0 0 1
> [12] .debug_aranges PROGBITS 00000000 0bf3e8 002430 00 0 0 8
> [13] .debug_str PROGBITS 00000000 0c1818 00d85c 01 MS 0 0 1
> [14] .debug_loc PROGBITS 00000000 0cf074 044a87 00 0 0 1
> [15] .debug_ranges PROGBITS 00000000 113b00 006578 00 0 0 8
> [16] .debug_frame PROGBITS 00000000 11a078 0069c0 00 0 0 4
> [17] .symtab SYMTAB 00000000 120a38 004d10 10 18 888 4
> [18] .strtab STRTAB 00000000 125748 002539 00 0 0 1
> [19] .shstrtab STRTAB 00000000 127c81 0000d3 00 0 0 1
>
> Next try with your patch applied on top of master:
>
> FDT_MAGIC is found at offset -8. Readelf:
>
> There are 19 section headers, starting at offset 0x127d34:
>
> Section Headers:
> [Nr] Name Type Addr Off Size ES Flg Lk Inf Al
> [ 0] NULL 00000000 000000 000000 00 0 0 0
> [ 1] .text PROGBITS 40004030 001030 009c1e 00 AX 0 0 16
> [ 2] .rodata PROGBITS 4000dc50 00ac50 0016f9 00 A 0 0 4
> [ 3] .data PROGBITS 4000f360 00c360 0042e0 00 WA 0 0 32
> [ 4] __u_boot_list PROGBITS 40013640 010640 000598 00 WA 0 0 4
> [ 5] .bss NOBITS 40013be0 010bd8 000728 00 WA 0 0 32
> [ 6] .ARM.attributes ARM_ATTRIBUTES 00000000 010bd8 000029 00 0 0 1
> [ 7] .comment PROGBITS 00000000 010c01 000012 01 MS 0 0 1
> [ 8] .debug_line PROGBITS 00000000 010c13 02844f 00 0 0 1
> [ 9] .debug_info PROGBITS 00000000 039062 076ced 00 0 0 1
> [10] .debug_abbrev PROGBITS 00000000 0afd4f 00f697 00 0 0 1
> [11] .debug_aranges PROGBITS 00000000 0bf3e8 002430 00 0 0 8
> [12] .debug_str PROGBITS 00000000 0c1818 00d85c 01 MS 0 0 1
> [13] .debug_loc PROGBITS 00000000 0cf074 044a87 00 0 0 1
> [14] .debug_ranges PROGBITS 00000000 113b00 006578 00 0 0 8
> [15] .debug_frame PROGBITS 00000000 11a078 0069c0 00 0 0 4
> [16] .symtab SYMTAB 00000000 120a38 004d00 10 17 887 4
> [17] .strtab STRTAB 00000000 125738 002539 00 0 0 1
> [18] .shstrtab STRTAB 00000000 127c71 0000c1 00 0 0 1
>
> Finally, with problematic patches reverted:
>
> FDT_MAGIC is found at offset 0 (obviously). Readelf:
>
> There are 19 section headers, starting at offset 0x1284a0:
>
> Section Headers:
> [Nr] Name Type Addr Off Size ES Flg Lk Inf Al
> [ 0] NULL 00000000 000000 000000 00 0 0 0
> [ 1] .text PROGBITS 40004030 001030 009c1e 00 AX 0 0 16
> [ 2] .rodata PROGBITS 4000dc50 00ac50 0016f9 00 A 0 0 4
> [ 3] .data PROGBITS 4000f360 00c360 0042e0 00 WA 0 0 32
> [ 4] __u_boot_list PROGBITS 40013640 010640 000594 00 WA 0 0 4
> [ 5] .bss PROGBITS 40013bd4 010bd4 000734 00 W 0 0 4
> [ 6] .ARM.attributes ARM_ATTRIBUTES 00000000 011308 000029 00 0 0 1
> [ 7] .comment PROGBITS 00000000 011331 000012 01 MS 0 0 1
> [ 8] .debug_line PROGBITS 00000000 011343 02844f 00 0 0 1
> [ 9] .debug_info PROGBITS 00000000 039792 076ced 00 0 0 1
> [10] .debug_abbrev PROGBITS 00000000 0b047f 00f697 00 0 0 1
> [11] .debug_aranges PROGBITS 00000000 0bfb18 002430 00 0 0 8
> [12] .debug_str PROGBITS 00000000 0c1f48 00d85c 01 MS 0 0 1
> [13] .debug_loc PROGBITS 00000000 0cf7a4 044a87 00 0 0 1
> [14] .debug_ranges PROGBITS 00000000 114230 006578 00 0 0 8
> [15] .debug_frame PROGBITS 00000000 11a7a8 0069c0 00 0 0 4
> [16] .symtab SYMTAB 00000000 121168 004d20 10 17 887 4
> [17] .strtab STRTAB 00000000 125e88 002557 00 0 0 1
> [18] .shstrtab STRTAB 00000000 1283df 0000c1 00 0 0 1
>
> HTH, Phil
It's confusing, but it does help, thanks again. I'll be cc'ing you and
Brian on a patch that supersedes the one I asked you to try. I finally
see where the discrepency comes from, and I'm doing to builds now to
check the old behavior first before I run off and fix this for the
needed new behavior.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 03/10] m68k: Update linker scripts to ensure appended device tree is aligned
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-15 22:19 ` [PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned Tom Rini
@ 2026-01-15 22:19 ` Tom Rini
2026-01-15 22:19 ` [PATCH 04/10] microblaze: " Tom Rini
` (7 subsequent siblings)
10 siblings, 0 replies; 56+ messages in thread
From: Tom Rini @ 2026-01-15 22:19 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Beleswar Padhi, Ilias Apalodimas, Richard Henderson
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:
- Remove part of what Marek Vasut did in commit 9ed99e2eeadb ("m68k:
Assure end of U-Boot is at 8-byte aligned offset") as we now better
understand what can trigger failure and check for it.
- Rewrite the '.dynsym' section to follow modern practices, and include
the 8-byte alignment at the end of the section.
- 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>
---
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: Richard Henderson <richard.henderson@linaro.org>
---
arch/m68k/cpu/u-boot.lds | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/arch/m68k/cpu/u-boot.lds b/arch/m68k/cpu/u-boot.lds
index be1ad0170af6..452003ff43cb 100644
--- a/arch/m68k/cpu/u-boot.lds
+++ b/arch/m68k/cpu/u-boot.lds
@@ -69,28 +69,27 @@ SECTIONS
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
- . = ALIGN(8);
+ . = ALIGN(4);
__init_begin = .;
.text.init : { *(.text.init) }
.data.init : { *(.data.init) }
- . = ALIGN(8);
+ . = ALIGN(4);
__init_end = .;
- . = ALIGN(8);
+ . = ALIGN(4);
__rel_dyn_start = .;
.rela.dyn : {
*(.rela.dyn)
}
__rel_dyn_end = .;
- . = ALIGN(8);
- __dyn_sym_start = .;
- .dynsym : {
+ .dynsym ALIGN(4) : {
+ __dyn_sym_start = .;
*(.dynsym)
+ __dyn_sym_end = .;
+ . = ALIGN(8);
}
- __dyn_sym_end = .;
- . = ALIGN(8);
_end = .;
__bss_start = .;
@@ -100,9 +99,11 @@ SECTIONS
*(.bss*)
*(.sbss*)
*(COMMON)
- . = ALIGN(8);
+ . = ALIGN(4);
_ebss = .;
}
__bss_end = . ;
PROVIDE (end = .);
}
+
+ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread* [PATCH 04/10] microblaze: Update linker scripts to ensure appended device tree is aligned
2026-01-15 22:19 [PATCH 00/10] Update linker scripts to ensure appended device tree is correctly aligned Tom Rini
` (2 preceding siblings ...)
2026-01-15 22:19 ` [PATCH 03/10] m68k: " Tom Rini
@ 2026-01-15 22:19 ` 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
` (6 subsequent siblings)
10 siblings, 2 replies; 56+ messages in thread
From: Tom Rini @ 2026-01-15 22:19 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Beleswar Padhi, Ilias Apalodimas, Michal Simek,
Richard Henderson
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 (for U-Boot) or _image_binary_end
(for xPL phases) by 8-bytes by adjusting the ALIGN(4) statement to be
ALIGN(8) in the final section before the symbol.
- 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>
---
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
---
arch/microblaze/cpu/u-boot-spl.lds | 5 ++++-
arch/microblaze/cpu/u-boot.lds | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/microblaze/cpu/u-boot-spl.lds b/arch/microblaze/cpu/u-boot-spl.lds
index 09abbea84d06..620ef2c96dbd 100644
--- a/arch/microblaze/cpu/u-boot-spl.lds
+++ b/arch/microblaze/cpu/u-boot-spl.lds
@@ -50,7 +50,7 @@ SECTIONS
*(.bss)
*(.bss.*)
*(COMMON)
- . = ALIGN(4);
+ . = ALIGN(8);
__bss_end = .;
}
_end = . ;
@@ -61,3 +61,6 @@ SECTIONS
ASSERT(_end - _start <= (CONFIG_SPL_MAX_FOOTPRINT), \
"SPL image plus BSS too big");
#endif
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
diff --git a/arch/microblaze/cpu/u-boot.lds b/arch/microblaze/cpu/u-boot.lds
index a2c8fb2e21c0..70fa49c31712 100644
--- a/arch/microblaze/cpu/u-boot.lds
+++ b/arch/microblaze/cpu/u-boot.lds
@@ -67,8 +67,10 @@ SECTIONS
*(.scommon)
*(.bss*)
*(COMMON)
- . = ALIGN(4);
+ . = ALIGN(8);
__bss_end = .;
}
_end = . ;
}
+
+ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 04/10] microblaze: Update linker scripts to ensure appended device tree is aligned
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
1 sibling, 0 replies; 56+ messages in thread
From: Michal Simek @ 2026-01-16 9:59 UTC (permalink / raw)
To: Tom Rini, u-boot
Cc: Marek Vasut, Beleswar Padhi, Ilias Apalodimas, Richard Henderson
On 1/15/26 23:19, Tom Rini wrote:
> 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 (for U-Boot) or _image_binary_end
> (for xPL phases) by 8-bytes by adjusting the ALIGN(4) statement to be
> ALIGN(8) in the final section before the symbol.
> - 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>
> ---
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> ---
> arch/microblaze/cpu/u-boot-spl.lds | 5 ++++-
> arch/microblaze/cpu/u-boot.lds | 4 +++-
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/microblaze/cpu/u-boot-spl.lds b/arch/microblaze/cpu/u-boot-spl.lds
> index 09abbea84d06..620ef2c96dbd 100644
> --- a/arch/microblaze/cpu/u-boot-spl.lds
> +++ b/arch/microblaze/cpu/u-boot-spl.lds
> @@ -50,7 +50,7 @@ SECTIONS
> *(.bss)
> *(.bss.*)
> *(COMMON)
> - . = ALIGN(4);
> + . = ALIGN(8);
> __bss_end = .;
> }
> _end = . ;
> @@ -61,3 +61,6 @@ SECTIONS
> ASSERT(_end - _start <= (CONFIG_SPL_MAX_FOOTPRINT), \
> "SPL image plus BSS too big");
> #endif
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/microblaze/cpu/u-boot.lds b/arch/microblaze/cpu/u-boot.lds
> index a2c8fb2e21c0..70fa49c31712 100644
> --- a/arch/microblaze/cpu/u-boot.lds
> +++ b/arch/microblaze/cpu/u-boot.lds
> @@ -67,8 +67,10 @@ SECTIONS
> *(.scommon)
> *(.bss*)
> *(COMMON)
> - . = ALIGN(4);
> + . = ALIGN(8);
> __bss_end = .;
> }
> _end = . ;
> }
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
Tested-by: Michal Simek <michal.simek@amd.com>
Thanks,
Michal
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 04/10] microblaze: Update linker scripts to ensure appended device tree is aligned
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
1 sibling, 0 replies; 56+ messages in thread
From: Ilias Apalodimas @ 2026-01-16 10:00 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, Michal Simek,
Richard Henderson
On Fri, 16 Jan 2026 at 00:28, Tom Rini <trini@konsulko.com> wrote:
>
> 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 (for U-Boot) or _image_binary_end
> (for xPL phases) by 8-bytes by adjusting the ALIGN(4) statement to be
> ALIGN(8) in the final section before the symbol.
> - 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: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> ---
> arch/microblaze/cpu/u-boot-spl.lds | 5 ++++-
> arch/microblaze/cpu/u-boot.lds | 4 +++-
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/microblaze/cpu/u-boot-spl.lds b/arch/microblaze/cpu/u-boot-spl.lds
> index 09abbea84d06..620ef2c96dbd 100644
> --- a/arch/microblaze/cpu/u-boot-spl.lds
> +++ b/arch/microblaze/cpu/u-boot-spl.lds
> @@ -50,7 +50,7 @@ SECTIONS
> *(.bss)
> *(.bss.*)
> *(COMMON)
> - . = ALIGN(4);
> + . = ALIGN(8);
> __bss_end = .;
> }
> _end = . ;
> @@ -61,3 +61,6 @@ SECTIONS
> ASSERT(_end - _start <= (CONFIG_SPL_MAX_FOOTPRINT), \
> "SPL image plus BSS too big");
> #endif
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/microblaze/cpu/u-boot.lds b/arch/microblaze/cpu/u-boot.lds
> index a2c8fb2e21c0..70fa49c31712 100644
> --- a/arch/microblaze/cpu/u-boot.lds
> +++ b/arch/microblaze/cpu/u-boot.lds
> @@ -67,8 +67,10 @@ SECTIONS
> *(.scommon)
> *(.bss*)
> *(COMMON)
> - . = ALIGN(4);
> + . = ALIGN(8);
> __bss_end = .;
> }
> _end = . ;
> }
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 05/10] mips: Update linker scripts to ensure appended device tree is aligned
2026-01-15 22:19 [PATCH 00/10] Update linker scripts to ensure appended device tree is correctly aligned Tom Rini
` (3 preceding siblings ...)
2026-01-15 22:19 ` [PATCH 04/10] microblaze: " Tom Rini
@ 2026-01-15 22:19 ` Tom Rini
2026-01-20 13:57 ` Daniel Schwierzeck
2026-01-15 22:19 ` [PATCH 06/10] nios2: " Tom Rini
` (5 subsequent siblings)
10 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-01-15 22:19 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Beleswar Padhi, Daniel Schwierzeck, Ilias Apalodimas,
Richard Henderson
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 (for U-Boot) or _image_binary_end
(for xPL phases) by 8-bytes by adding '. = ALIGN(8);' to the final
section before the symbol. For SPL we need this in two places to cover
all build configurations.
- Remove now-spurious '. = ALIGN(x);' statements that were intended to
provide the above alignments.
- 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>
---
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> (maintainer:MIPS)
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: Richard Henderson <richard.henderson@linaro.org>
---
arch/mips/cpu/u-boot-spl.lds | 6 +++++-
arch/mips/cpu/u-boot.lds | 4 +++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/mips/cpu/u-boot-spl.lds b/arch/mips/cpu/u-boot-spl.lds
index 310a5c5053b1..ea2deed34f15 100644
--- a/arch/mips/cpu/u-boot-spl.lds
+++ b/arch/mips/cpu/u-boot-spl.lds
@@ -27,16 +27,17 @@ SECTIONS
.data : {
*(SORT_BY_ALIGNMENT(.data*))
*(SORT_BY_ALIGNMENT(.sdata*))
+ . = ALIGN(8);
} > .spl_mem
#if defined(CONFIG_SPL_DM) || defined(CONFIG_SPL_LOADER_SUPPORT)
. = ALIGN(4);
__u_boot_list : {
KEEP(*(SORT(__u_boot_list*)));
+ . = ALIGN(8);
} > .spl_mem
#endif
- . = ALIGN(4);
__image_copy_end = .;
__image_copy_len = __image_copy_end - __text_start;
@@ -123,3 +124,6 @@ SECTIONS
*(.eh_frame)
}
}
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
diff --git a/arch/mips/cpu/u-boot.lds b/arch/mips/cpu/u-boot.lds
index 133ea05df3da..d59a48b7ef85 100644
--- a/arch/mips/cpu/u-boot.lds
+++ b/arch/mips/cpu/u-boot.lds
@@ -54,9 +54,9 @@ SECTIONS
LONG(0xFFFFFFFF);
FILL(0);
. += CONFIG_MIPS_RELOCATION_TABLE_SIZE - 4;
+ . = ALIGN(8);
}
- . = ALIGN(8);
_end = .;
.bss __rel_start (OVERLAY) : {
@@ -140,3 +140,5 @@ SECTIONS
*(.eh_frame)
}
}
+
+ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 05/10] mips: Update linker scripts to ensure appended device tree is aligned
2026-01-15 22:19 ` [PATCH 05/10] mips: " Tom Rini
@ 2026-01-20 13:57 ` Daniel Schwierzeck
0 siblings, 0 replies; 56+ messages in thread
From: Daniel Schwierzeck @ 2026-01-20 13:57 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, Ilias Apalodimas,
Richard Henderson
On Thu, Jan 15, 2026 at 11:28 PM Tom Rini <trini@konsulko.com> wrote:
>
> 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 (for U-Boot) or _image_binary_end
> (for xPL phases) by 8-bytes by adding '. = ALIGN(8);' to the final
> section before the symbol. For SPL we need this in two places to cover
> all build configurations.
> - Remove now-spurious '. = ALIGN(x);' statements that were intended to
> provide the above alignments.
> - 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>
> ---
> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> (maintainer:MIPS)
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> ---
> arch/mips/cpu/u-boot-spl.lds | 6 +++++-
> arch/mips/cpu/u-boot.lds | 4 +++-
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 06/10] nios2: Update linker scripts to ensure appended device tree is aligned
2026-01-15 22:19 [PATCH 00/10] Update linker scripts to ensure appended device tree is correctly aligned Tom Rini
` (4 preceding siblings ...)
2026-01-15 22:19 ` [PATCH 05/10] mips: " Tom Rini
@ 2026-01-15 22:19 ` Tom Rini
2026-01-16 10:00 ` Ilias Apalodimas
2026-01-15 22:19 ` [PATCH 07/10] powerpc: " Tom Rini
` (4 subsequent siblings)
10 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-01-15 22:19 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Beleswar Padhi, Ilias Apalodimas, Richard Henderson,
Thomas Chou
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 8-bytes by adding '. = ALIGN(8);'
to the final section before the symbol.
- Remove a now-spurious '. = ALIGN(x);' statement that was intended to
provide the above alignments.
- 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>
---
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Thomas Chou <thomas@wytron.com.tw>
---
arch/nios2/cpu/u-boot.lds | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/nios2/cpu/u-boot.lds b/arch/nios2/cpu/u-boot.lds
index 5b9e27d94062..fc366d44341d 100644
--- a/arch/nios2/cpu/u-boot.lds
+++ b/arch/nios2/cpu/u-boot.lds
@@ -60,8 +60,8 @@ SECTIONS
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
+ . = ALIGN(8);
}
- . = ALIGN(4);
_edata = .;
PROVIDE (edata = .);
@@ -124,3 +124,5 @@ SECTIONS
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
}
+
+ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 06/10] nios2: Update linker scripts to ensure appended device tree is aligned
2026-01-15 22:19 ` [PATCH 06/10] nios2: " Tom Rini
@ 2026-01-16 10:00 ` Ilias Apalodimas
0 siblings, 0 replies; 56+ messages in thread
From: Ilias Apalodimas @ 2026-01-16 10:00 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, Richard Henderson,
Thomas Chou
On Fri, 16 Jan 2026 at 00:28, Tom Rini <trini@konsulko.com> wrote:
>
> 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 8-bytes by adding '. = ALIGN(8);'
> to the final section before the symbol.
> - Remove a now-spurious '. = ALIGN(x);' statement that was intended to
> provide the above alignments.
> - 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>
> ---
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Thomas Chou <thomas@wytron.com.tw>
> ---
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> arch/nios2/cpu/u-boot.lds | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/nios2/cpu/u-boot.lds b/arch/nios2/cpu/u-boot.lds
> index 5b9e27d94062..fc366d44341d 100644
> --- a/arch/nios2/cpu/u-boot.lds
> +++ b/arch/nios2/cpu/u-boot.lds
> @@ -60,8 +60,8 @@ SECTIONS
> *(.sdata)
> *(.sdata.*)
> *(.gnu.linkonce.s.*)
> + . = ALIGN(8);
> }
> - . = ALIGN(4);
>
> _edata = .;
> PROVIDE (edata = .);
> @@ -124,3 +124,5 @@ SECTIONS
> .debug_typenames 0 : { *(.debug_typenames) }
> .debug_varnames 0 : { *(.debug_varnames) }
> }
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 07/10] powerpc: Update linker scripts to ensure appended device tree is aligned
2026-01-15 22:19 [PATCH 00/10] Update linker scripts to ensure appended device tree is correctly aligned Tom Rini
` (5 preceding siblings ...)
2026-01-15 22:19 ` [PATCH 06/10] nios2: " Tom Rini
@ 2026-01-15 22:19 ` Tom Rini
2026-02-06 7:18 ` Christophe Leroy (CS GROUP)
2026-01-15 22:19 ` [PATCH 08/10] riscv: " Tom Rini
` (3 subsequent siblings)
10 siblings, 1 reply; 56+ messages in thread
From: Tom Rini @ 2026-01-15 22:19 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Beleswar Padhi, Marek Behún, Christophe Leroy,
Ilias Apalodimas, Mario Six, Richard Henderson
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>
---
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");
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 07/10] powerpc: Update linker scripts to ensure appended device tree is aligned
2026-01-15 22:19 ` [PATCH 07/10] powerpc: " Tom Rini
@ 2026-02-06 7:18 ` Christophe Leroy (CS GROUP)
0 siblings, 0 replies; 56+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-02-06 7:18 UTC (permalink / raw)
To: Tom Rini, u-boot
Cc: Marek Vasut, Beleswar Padhi, Marek Behún, Ilias Apalodimas,
Mario Six, Richard Henderson
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");
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 08/10] riscv: Update linker scripts to ensure appended device tree is aligned
2026-01-15 22:19 [PATCH 00/10] Update linker scripts to ensure appended device tree is correctly aligned Tom Rini
` (6 preceding siblings ...)
2026-01-15 22:19 ` [PATCH 07/10] powerpc: " Tom Rini
@ 2026-01-15 22:19 ` 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
` (2 subsequent siblings)
10 siblings, 2 replies; 56+ messages in thread
From: Tom Rini @ 2026-01-15 22:19 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Beleswar Padhi, Ilias Apalodimas, Leo,
Richard Henderson, Rick Chen
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 (for U-Boot) or _image_binary_end
(for xPL phases) by 8-bytes by adding '. = ALIGN(8);' to the final
section before the symbol.
- Remove a now-spurious '. = ALIGN(x);' statement that was intended to
provide the above alignments.
- 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>
---
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Leo <ycliang@andestech.com>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Rick Chen <rick@andestech.com>
---
arch/riscv/cpu/u-boot-spl.lds | 4 ++++
arch/riscv/cpu/u-boot.lds | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/cpu/u-boot-spl.lds b/arch/riscv/cpu/u-boot-spl.lds
index 0717833df556..35de28db8f3a 100644
--- a/arch/riscv/cpu/u-boot-spl.lds
+++ b/arch/riscv/cpu/u-boot-spl.lds
@@ -43,6 +43,7 @@ SECTIONS
__binman_sym_start = .;
KEEP(*(SORT(.binman_sym*)));
__binman_sym_end = .;
+ . = ALIGN(8);
} > .spl_mem
_end = .;
@@ -56,3 +57,6 @@ SECTIONS
__bss_end = .;
} > .bss_mem
}
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
diff --git a/arch/riscv/cpu/u-boot.lds b/arch/riscv/cpu/u-boot.lds
index b11ea8b56d25..c299c00fa298 100644
--- a/arch/riscv/cpu/u-boot.lds
+++ b/arch/riscv/cpu/u-boot.lds
@@ -73,10 +73,9 @@ SECTIONS
__dyn_sym_start = .;
*(.dynsym)
__dyn_sym_end = .;
+ . = ALIGN(8);
}
- . = ALIGN(8);
-
_end = .;
.bss : {
@@ -86,3 +85,5 @@ SECTIONS
__bss_end = .;
}
}
+
+ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 08/10] riscv: Update linker scripts to ensure appended device tree is aligned
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
1 sibling, 0 replies; 56+ messages in thread
From: Leo Liang @ 2026-01-16 1:27 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, Ilias Apalodimas,
Richard Henderson, Rick Chen
On Thu, Jan 15, 2026 at 04:19:38PM -0600, Tom Rini wrote:
> [EXTERNAL MAIL]
>
> 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 (for U-Boot) or _image_binary_end
> (for xPL phases) by 8-bytes by adding '. = ALIGN(8);' to the final
> section before the symbol.
> - Remove a now-spurious '. = ALIGN(x);' statement that was intended to
> provide the above alignments.
> - 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>
> ---
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Leo <ycliang@andestech.com>
> Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Rick Chen <rick@andestech.com>
> ---
> arch/riscv/cpu/u-boot-spl.lds | 4 ++++
> arch/riscv/cpu/u-boot.lds | 5 +++--
> 2 files changed, 7 insertions(+), 2 deletions(-)
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
^ permalink raw reply [flat|nested] 56+ messages in thread* Re: [PATCH 08/10] riscv: Update linker scripts to ensure appended device tree is aligned
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
1 sibling, 0 replies; 56+ messages in thread
From: Ilias Apalodimas @ 2026-01-16 9:49 UTC (permalink / raw)
To: Tom Rini
Cc: u-boot, Marek Vasut, Beleswar Padhi, Leo, Richard Henderson,
Rick Chen
On Fri, 16 Jan 2026 at 00:28, Tom Rini <trini@konsulko.com> wrote:
>
> 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 (for U-Boot) or _image_binary_end
> (for xPL phases) by 8-bytes by adding '. = ALIGN(8);' to the final
> section before the symbol.
> - Remove a now-spurious '. = ALIGN(x);' statement that was intended to
> provide the above alignments.
> - 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: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> Cc: Leo <ycliang@andestech.com>
> Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Rick Chen <rick@andestech.com>
> ---
> arch/riscv/cpu/u-boot-spl.lds | 4 ++++
> arch/riscv/cpu/u-boot.lds | 5 +++--
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/cpu/u-boot-spl.lds b/arch/riscv/cpu/u-boot-spl.lds
> index 0717833df556..35de28db8f3a 100644
> --- a/arch/riscv/cpu/u-boot-spl.lds
> +++ b/arch/riscv/cpu/u-boot-spl.lds
> @@ -43,6 +43,7 @@ SECTIONS
> __binman_sym_start = .;
> KEEP(*(SORT(.binman_sym*)));
> __binman_sym_end = .;
> + . = ALIGN(8);
> } > .spl_mem
>
> _end = .;
> @@ -56,3 +57,6 @@ SECTIONS
> __bss_end = .;
> } > .bss_mem
> }
> +
> +ASSERT(_image_binary_end % 8 == 0, \
> + "_image_binary_end must be 8-byte aligned for device tree");
> diff --git a/arch/riscv/cpu/u-boot.lds b/arch/riscv/cpu/u-boot.lds
> index b11ea8b56d25..c299c00fa298 100644
> --- a/arch/riscv/cpu/u-boot.lds
> +++ b/arch/riscv/cpu/u-boot.lds
> @@ -73,10 +73,9 @@ SECTIONS
> __dyn_sym_start = .;
> *(.dynsym)
> __dyn_sym_end = .;
> + . = ALIGN(8);
> }
>
> - . = ALIGN(8);
> -
> _end = .;
>
> .bss : {
> @@ -86,3 +85,5 @@ SECTIONS
> __bss_end = .;
> }
> }
> +
> +ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH 09/10] sandbox: Update linker scripts to ensure appended device tree is aligned
2026-01-15 22:19 [PATCH 00/10] Update linker scripts to ensure appended device tree is correctly aligned Tom Rini
` (7 preceding siblings ...)
2026-01-15 22:19 ` [PATCH 08/10] riscv: " Tom Rini
@ 2026-01-15 22:19 ` 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
10 siblings, 0 replies; 56+ messages in thread
From: Tom Rini @ 2026-01-15 22:19 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Beleswar Padhi, Ilias Apalodimas, Richard Henderson,
Simon Glass
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 _image_binary_end (for xPL phases) by
8-bytes by adding '. = ALIGN(8);' to the final section before the
symbol.
- 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>
---
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
---
arch/sandbox/cpu/u-boot-spl.lds | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/sandbox/cpu/u-boot-spl.lds b/arch/sandbox/cpu/u-boot-spl.lds
index a81d66a6f2e8..bd5a164b8c95 100644
--- a/arch/sandbox/cpu/u-boot-spl.lds
+++ b/arch/sandbox/cpu/u-boot-spl.lds
@@ -25,9 +25,13 @@ SECTIONS
*(_u_boot_sandbox_getopt_start)
KEEP(*(_u_boot_sandbox_getopt))
*(_u_boot_sandbox_getopt_end)
+ . = ALIGN(8);
}
_image_binary_end = .;
}
INSERT AFTER .data;
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread* [PATCH 10/10] x86: Update linker scripts to ensure appended device tree is aligned
2026-01-15 22:19 [PATCH 00/10] Update linker scripts to ensure appended device tree is correctly aligned Tom Rini
` (8 preceding siblings ...)
2026-01-15 22:19 ` [PATCH 09/10] sandbox: " Tom Rini
@ 2026-01-15 22:19 ` Tom Rini
2026-01-20 18:08 ` [PATCH 00/10] Update linker scripts to ensure appended device tree is correctly aligned Tom Rini
10 siblings, 0 replies; 56+ messages in thread
From: Tom Rini @ 2026-01-15 22:19 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Beleswar Padhi, Bin Meng, Ilias Apalodimas,
Richard Henderson, Simon Glass
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:
- Rewrite the '.rel.dyn' (u-boot.lds) to follow modern practices, and
include the 8-byte alignment at the end of the section.
- Expands the '.dynamic' section (u-boot-64.lds) to be more readable
when adding a second statement to the section.
- Aligns the final section before _end (for U-Boot) or _image_binary_end
or __bss_end (for xPL phases) by 8-bytes by adding '. = ALIGN(8);' to
the final section before the symbol 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>
---
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Simon Glass <sjg@chromium.org>
---
arch/x86/cpu/u-boot-64.lds | 6 ++++--
arch/x86/cpu/u-boot-spl.lds | 10 +++++++++-
arch/x86/cpu/u-boot.lds | 11 ++++++-----
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/arch/x86/cpu/u-boot-64.lds b/arch/x86/cpu/u-boot-64.lds
index 00a6d8691211..0c353c5d7401 100644
--- a/arch/x86/cpu/u-boot-64.lds
+++ b/arch/x86/cpu/u-boot-64.lds
@@ -86,9 +86,11 @@ SECTIONS
__rel_dyn_end = .;
. = ALIGN(4);
- .dynamic : { *(.dynamic) }
+ .dynamic : {
+ *(.dynamic)
+ . = ALIGN(8);
+ }
- . = ALIGN(4);
_end = .;
.bss __rel_dyn_start (OVERLAY) : {
diff --git a/arch/x86/cpu/u-boot-spl.lds b/arch/x86/cpu/u-boot-spl.lds
index 50b4b1608552..57cdce6d7515 100644
--- a/arch/x86/cpu/u-boot-spl.lds
+++ b/arch/x86/cpu/u-boot-spl.lds
@@ -68,7 +68,7 @@ SECTIONS
__bss_start = .;
*(.bss*)
*(COM*)
- . = ALIGN(4);
+ . = ALIGN(8);
__bss_end = .;
}
__bss_size = __bss_end - __bss_start;
@@ -97,3 +97,11 @@ SECTIONS
#endif
}
+
+ASSERT(_image_binary_end % 8 == 0, \
+ "_image_binary_end must be 8-byte aligned for device tree");
+
+#if !CONFIG_IS_ENABLED(SEPARATE_BSS)
+ASSERT(__bss_end % 8 == 0, \
+ "__bss_end must be 8-byte aligned for device tree");
+#endif
diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds
index c418ff44aa08..ea070acd6a15 100644
--- a/arch/x86/cpu/u-boot.lds
+++ b/arch/x86/cpu/u-boot.lds
@@ -79,13 +79,12 @@ SECTIONS
. = ALIGN(4);
.dynsym : { *(.dynsym*) }
- . = ALIGN(4);
- __rel_dyn_start = .;
- .rel.dyn : {
+ .rel.dyn ALIGN(4) : {
+ __rel_dyn_start = .;
*(.rel*)
+ __rel_dyn_end = .;
+ . = ALIGN(8);
}
- __rel_dyn_end = .;
- . = ALIGN(4);
_end = .;
.bss __rel_dyn_start (OVERLAY) : {
@@ -120,3 +119,5 @@ SECTIONS
#endif
}
+
+ASSERT(_end % 8 == 0, "_end must be 8-byte aligned for device tree");
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread* Re: [PATCH 00/10] Update linker scripts to ensure appended device tree is correctly aligned
2026-01-15 22:19 [PATCH 00/10] Update linker scripts to ensure appended device tree is correctly aligned Tom Rini
` (9 preceding siblings ...)
2026-01-15 22:19 ` [PATCH 10/10] x86: " Tom Rini
@ 2026-01-20 18:08 ` Tom Rini
10 siblings, 0 replies; 56+ messages in thread
From: Tom Rini @ 2026-01-20 18:08 UTC (permalink / raw)
To: u-boot, Tom Rini; +Cc: Marek Vasut, Beleswar Padhi
On Thu, 15 Jan 2026 16:19:30 -0600, Tom Rini wrote:
> Hey all,
>
> This series builds on top of what Beleswar Padhi did in [1]. While
> there's still discussion about the mkimage related parts, the linker
> portion appears to the reliable path forward. An alternative that I had
> mentioned before, and was part of previous discussions on this topic[2]
> is in the end I believe not reliable enough. While we can take an output
> file and pad it to where we think it needs to be, ultimately the linker
> needs to place the symbol where we want it and if that isn't where we
> pad to, we have a different problem. So what this series does (but each
> commit message elaborates on the arch-specific linker scripts being
> inconsistent) is make sure the linker script will place the required
> symbol at 8-byte alignment, and then also use an ASSERT to fail the
> build if this would not be true due to some unforseen event.
>
> [...]
Applied to u-boot/master, thanks!
[01/10] Makefile: Have binary_size_check report only first match of _image_binary_end
commit: 90efb8d394de9df1ae2c20f5e25ffc2009dc7ec5
[02/10] arm: Update linker scripts to ensure appended device tree is aligned
commit: 8b0ebe054bb3334c6ca9bed018360b08d4ddc7a4
[03/10] m68k: Update linker scripts to ensure appended device tree is aligned
commit: dac67bf0bee168de8f43050fe9b1d776de1ee00f
[04/10] microblaze: Update linker scripts to ensure appended device tree is aligned
commit: 2e52030584d069b702f8367ddd34b3a65f522806
[05/10] mips: Update linker scripts to ensure appended device tree is aligned
commit: b220a43f5ae69f1b258976691fe70414c4fc2259
[06/10] nios2: Update linker scripts to ensure appended device tree is aligned
commit: 546d84ca0cb367240c93aa3e3492be4dccf85332
[07/10] powerpc: Update linker scripts to ensure appended device tree is aligned
commit: 87d3780ebc242e28a180606f72335ce37d8bcca1
[08/10] riscv: Update linker scripts to ensure appended device tree is aligned
commit: f150843499b3139c2358f5659411571399902d4a
[09/10] sandbox: Update linker scripts to ensure appended device tree is aligned
commit: 94b81451890f42b422bb13b03e2c1034b9bfb43d
[10/10] x86: Update linker scripts to ensure appended device tree is aligned
commit: 410d31bae4b863eabd70adb22a0c9976bfe4fee3
--
Tom
^ permalink raw reply [flat|nested] 56+ messages in thread