[PATCH 02/10] arm: Update linker scripts to ensure appended device tree is aligned

Tom Rini trini at konsulko.com
Fri Jan 23 15:27:08 CET 2026


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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260123/494065a9/attachment.sig>


More information about the U-Boot mailing list