Bug 9480

Summary: linux-yocto: make it work with arm big endian
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Robert Yang <liezhi.yang>
Component: kernelAssignee: Bruce Ashfield <bruce.ashfield>
Status: ACCEPTED --- QA Contact:
Severity: enhancement    
Priority: Medium CC: akuster808, juro.bystricky, randy.macleod, ross.burton, tom.zanussi
Version: 2.2   
Target Milestone: Future   
Hardware: x86   
OS: arm64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

Description Robert Yang 2016-04-19 01:37:07 UTC
It doesn't work currently:

MACHINE = "qemuarm64"
DEFAULTTUNE = "aarch64_be"

$ bitbake linux-yocto


aarch64_be-poky-linux-ld.bfd: usr/initramfs_data.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file usr/initramfs_data.o
make[3]: *** [usr/built-in.o] Error 1
  CC      kernel/exec_domain.o
make[2]: *** [usr] Error 2
make[2]: *** Waiting for unfinished jobs....
  OBJCOPY arch/arm64/kernel/vdso/vdso.so
  VDSOSYM arch/arm64/kernel/vdso/vdso-offsets.h
  CC      security/keys/keyring.o
  CC      kernel/panic.o
  CC      kernel/cpu.o
  AS      arch/arm64/kernel/vdso/vdso.o
  CC      kernel/exit.o
  CC      kernel/softirq.o
  LD      security/integrity/integrity.o
  CC      kernel/resource.o
aarch64_be-poky-linux-ld.bfd: security/integrity/iint.o: compiled for a little endian system and target is big endian  CC      fs/open.o

aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file security/integrity/iint.o
make[4]: *** [security/integrity/integrity.o] Error 1
make[3]: *** [security/integrity] Error 2
make[3]: *** Waiting for unfinished jobs....

[snip]
  LD      arch/arm64/mm/built-in.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/dma-mapping.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/dma-mapping.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/extable.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/extable.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/fault.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/fault.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/init.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/init.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/cache.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/cache.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/copypage.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/copypage.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/flush.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/flush.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/ioremap.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/ioremap.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/mmap.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/mmap.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/pgd.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/pgd.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/mmu.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/mmu.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/context.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/context.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/proc.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/proc.o
aarch64_be-poky-linux-ld.bfd: arch/arm64/mm/pageattr.o: compiled for a little endian system and target is big endian
aarch64_be-poky-linux-ld.bfd: failed to merge target specific data of file arch/arm64/mm/pageattr.o
make[3]: *** [arch/arm64/mm/built-in.o] Error 1
make[2]: *** [arch/arm64/mm] Error 2
  CC      fs/exec.o
[snip]
Comment 1 akuster 2020-01-23 16:27:15 UTC
checking current master.
Comment 2 akuster 2020-01-23 17:58:31 UTC
in current master I am seeing this:

ERROR: linux-yocto-5.2.28+gitAUTOINC+dd6019025c_992280855e-r0 do_package_qa: QA Issue: Endiannes did not match (0 to 1) on /work/qemuarm64-oe-linux/linux-yocto/5.2.28+gitAUTOINC+dd6019025c_992280855e-r0/packages-split/kernel-module-watchdog-5.2.28-yocto-standard/lib/modules/5.2.28-yocto-standard/kernel/drivers/watchdog/watchdog.ko [arch]


which makes sense as qemuarm64 kernel config is "LE".

I manually configured the kernel to enable BE and I will see how it goes. 

I suspect we will need to different MACHINES for Endlessness configurations.
Comment 3 akuster 2020-01-23 18:28:38 UTC
for master I would mark this as "Works for me".

Do we want old branches check like back to Thud?
Comment 4 Bruce Ashfield 2021-03-09 13:10:31 UTC
It is simple to add BE support via a dedicated machine (since that is how we typically define such options). Alternatively, KERNEL_FEATURES could be used to trigger on the TUNE variable and add a fragment on top of the existing ARM BSPs.

Either will work, but we still haven't had anyone asking for this, so it likely isn't worth the effort, or extra support cost.
Comment 5 Ross Burton 2025-03-06 16:22:10 UTC
For what it's worth, some time ago I had to build a big-endian system and documented the few things I had to do:

https://www.burtonini.com/blog/2023/03/06/big-endian/

I can see an argument for two small fragments that just set the right endian flag that BSPs can pull in if required.