Can old ARM32 binaries run on the AARCH64 kernel?

I am interested to know about the possibility of running old ARM32-Linux programs on AARCH64-Linux machines, and I did some experiments:

  • write the program "Hello, World!" and compile it statically with arm-none-linux-gnueabi-gcc and aarch64-linux-gnu-gcc.
  • statically create and create ramdisk using busybox and aarch64 compiler.
  • put 2 "Hello, World!" (in ARM32 and AARCH64) in ramdisk.
  • create a simple AARCH64-Linux kernel with vexpress_defconfig and the aarch64 compiler.
  • start the kernel and ramdisk with qemu-system-aarch64.

(All binaries, including busybox in ramdisk, are statically compiled.)

Result:

  • "Hello World!" AARCH64 program was successfully executed.
  • "Hello World!" a program in ARM32 cannot be started, but displays messages:

line 1: syntax error: unexpected word (pending ")")

Is there any suggestion or experience to solve the problem above?

+5
source share
1 answer

Thank moonbutt74 You have provided me with a helpful hint to find a solution to this problem.

To enable support for running ARM32-Linux programs on the AARCH64 kernel, you must select a parameter in the kernel:

  • execute make menuconfig ARCH = arm64
  • go to the option and select it:

User-space binary formats ---> Kernel support for 32-bit EL0

  1. recompile the kernel by running make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-

  2. start the recompiled kernel using ramdisk and qemu-system-aarch64.

  3. "Hello World!" programs in (ARM32 and AARCH64) can be successfully executed.

Screenshot

+6
source

Source: https://habr.com/ru/post/1240058/


All Articles