diff options
author | Alistair Delva <adelva@google.com> | 2022-10-03 13:54:04 -0700 |
---|---|---|
committer | Alistair Delva <adelva@google.com> | 2022-11-21 18:12:36 +0000 |
commit | 1c9bd973f72400f700621ada64ef7723f12d443c (patch) | |
tree | ae87828962d12585bce30ad233e5e06682b9a65f | |
parent | c0d66ec9a419a43beea81c3b7168d9fb2f3fd035 (diff) | |
download | u-boot-android12.tar.gz |
ANDROID: Fix alignment of DTB blob in u-boot-dtb.binandroid12
Compared to upstream, we use a newer version of libfdt from the dtc
project via a symlink, but this newer code requires the dtb to be
aligned to 8 bytes, not 4 bytes, and upstream's linker script can't
handle this.
So, move the DTB to be aligned to 8 bytes, by updating the alignment
of the _end address set by the linker script, and extending the size
of the nodtb.bin on x86 only to be a multiple of 8 bytes. I couldn't
find a cleaner way to do it, as objcopy -O binary only copies sections
and not symbols, and the size of the last section copied matters and
can't just be hacked to be a multiple of 8 bytes..
This was randomly breaking either crosvm or QEMU prebuilts for x86
because they would rarely be aligned the same.
Bug: 250067610
Signed-off-by: Alistair Delva <adelva@google.com>
Change-Id: I68f1dd3dbd14c08d53859c8eebfafea5440ada6e
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | arch/x86/cpu/u-boot.lds | 2 |
2 files changed, 2 insertions, 1 deletions
@@ -1301,6 +1301,7 @@ endif u-boot-nodtb.bin: u-boot FORCE $(call if_changed,objcopy_uboot) + @$(if $(CONFIG_X86),truncate -s $$(((($$(stat -c %s $@)+8-1)/8)*8)) $@) $(BOARD_SIZE_CHECK) u-boot.ldr: u-boot diff --git a/arch/x86/cpu/u-boot.lds b/arch/x86/cpu/u-boot.lds index 22fde01e74..bafafe09a2 100644 --- a/arch/x86/cpu/u-boot.lds +++ b/arch/x86/cpu/u-boot.lds @@ -89,7 +89,7 @@ SECTIONS *(.rel*) } __rel_dyn_end = .; - . = ALIGN(4); + . = ALIGN(8); _end = .; .bss __rel_dyn_start (OVERLAY) : { |