简体   繁体   中英

Can old ARM32 binary files be run on AARCH64 kernel?

I am curious about the feasibility of running old ARM32-Linux programs on AARCH64-Linux machines and I conducted some experiments:

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

(All binary files including busybox in the ramdisk are statically compiled.)

Result:

  1. "Hello, World!" program in AARCH64 was successfully executed.
  2. "Hello, World!" program in ARM32 cannot be run but shows the messages:

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

Is there suggestion or expertise to solve the issue above?

Thank you moonbutt74. You had provided an useful clue for me to seek the solution to that issue.

To enable the support of running ARM32-Linux programs on AARCH64 kernel, the option in the kernel should be selected:

  1. run make menuconfig ARCH=arm64
  2. go to the option and select it:

Userspace binary formats ---> Kernel support for 32-bit EL0

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

  2. run the recompiled kernel with ramdisk and qemu-system-aarch64.

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

“make menuconfig ARCH = arm64”的屏幕截图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM