4

Is it possible to compile some Linux Kernel and run it over QEMU, emulating some Big Endian ARM processor?

If QEMU is not capable of that, I'd love to hear about other system emulators than can.

My basic goal is to run and debug dedicated Big Endian ELFs in as much as possible native environment.

Every close solution or idea would help!

Reflection
  • 1,936
  • 3
  • 21
  • 39
  • QEMU has supported ARM big-endian since March 2016. Also see QEMU [Commit 9776f636455b6f0d9c](https://github.com/qemu/qemu/commits/9776f636455b6f0d9c). – jww Oct 26 '18 at 17:54

1 Answers1

2

QEMU has support for big-endian ARM CPUs, but it does not currently have support for emulation of any specific machines (boards) which have big-endian ARM CPUs in them. ARM Linux kernels will generally only run on the hardware they're compiled for, so you can't just take a random big-endian ARM Linux kernel and run it on anything -- you'd need to model the hardware the kernel wanted to see first.

The underlying reason for this is that big-endian ARM systems are very rare -- almost everybody runs ARM CPUs in little-endian mode, and all the boards QEMU models today are little-endian.

Peter Maydell
  • 9,707
  • 1
  • 19
  • 25
  • Are there no machines with ARM models that support both endiannes, that we can switch from the default configuration? – Reflection Jan 12 '17 at 14:18
  • The emulator would support a hypothetical boot rom that switched endianness before booting a kernel, but the Linux kernel doesn't support those boards in bigendian mode -- the device drivers etc would likely not work. In theory you could get it working but you'd probably spend a lot of time fiddling with the kernel in the process. – Peter Maydell Jan 15 '17 at 21:05
  • Hi Pete, out of curiosity, can you run user mode big endian binaries? I tried to add `-mbig-endian` on my aarch64 Linux freestanding assembly hello world, but QEMU didn't like it: " Invalid ELF image for this architecture" :-( – Ciro Santilli Jul 17 '19 at 15:55
  • It should be possible -- you'll need to use the qemu-aarch64_be binary, not the qemu-aarch64 little-endian one. (that's 'aarch64_be-linux-user' in your target-list option to configure.) – Peter Maydell Jul 18 '19 at 09:41