简体   繁体   English

旧的ARM32二进制文件可以在AARCH64内核上运行吗?

[英]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: 我很好奇在AARCH64-Linux机器上运行旧的ARM32-Linux程序的可行性,我进行了一些实验:

  1. write a program "Hello, World!" 写一个程序“Hello,World!” and compile it statically with arm-none-linux-gnueabi-gcc and aarch64-linux-gnu-gcc. 并使用arm-none-linux-gnueabi-gcc和aarch64-linux-gnu-gcc静态编译它。
  2. statically build and create a ramdisk using busybox and aarch64 compiler. 使用busybox和aarch64编译器静态构建并创建ramdisk。
  3. put the 2 "Hello, World!" 把2“你好,世界!” programs (in ARM32 and AARCH64) to the ramdisk. 程序(在ARM32和AARCH64中)到ramdisk。
  4. build a simple AARCH64-Linux kernel with vexpress_defconfig and aarch64 compiler. 使用vexpress_defconfig和aarch64编译器构建一个简单的AARCH64-Linux内核。
  5. run the kernel and ramdisk using qemu-system-aarch64. 使用qemu-system-aarch64运行内核和ramdisk。

(All binary files including busybox in the ramdisk are statically compiled.) (所有二进制文件包括ramdisk中的busybox都是静态编译的。)

Result: 结果:

  1. "Hello, World!" “你好,世界!” program in AARCH64 was successfully executed. AARCH64中的程序已成功执行。
  2. "Hello, World!" “你好,世界!” program in ARM32 cannot be run but shows the messages: ARM32中的程序无法运行但显示消息:

line 1: syntax error: unexpected word (expecting ")") 第1行:语法错误:意外的单词(期待“)”)

Is there suggestion or expertise to solve the issue above? 是否有解决上述问题的建议或专业知识?

Thank you moonbutt74. 谢谢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: 要在AARCH64内核上启用运行ARM32-Linux程序的支持,应选择内核中的选项:

  1. run make menuconfig ARCH=arm64 运行make menuconfig ARCH = arm64
  2. go to the option and select it: 转到该选项并选择它:

Userspace binary formats ---> Kernel support for 32-bit EL0 用户空间二进制格式--->内核支持32位EL0

  1. recompile the kernel by running make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 通过运行make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-重新编译内核make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-

  2. run the recompiled kernel with ramdisk and qemu-system-aarch64. 使用ramdisk和qemu-system-aarch64运行重新编译的内核。

  3. the "Hello, World!" “你好,世界!” programs in (ARM32 and AARCH64) can be executed successfully !! (ARM32和AARCH64)中的程序可以成功执行!!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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