Running Arm64 Binaries on x86
Arm64 architectures are becoming more widespread than ever. The architecture is no longer just used for phones but also for personal computers and server computers. Learning some basic assembly has become necessary.
In addition to learning some basic assembly in this article, we will be using a powerful sub-tool of QEMU that allows cross-running native applications from other architectures. In our case, we will be running arm64 (aka aarch64) binaries on x86_64.
The quickest way is to use the below docker:
docker run -it amine2029/qemu-user-aarch64
# wait for the bash from the docker; thenmake
To install the environment on ubuntu use the following apt commands:
sudo apt install gcc-aarch64-linux-gnu sudo apt install qemu-user
sudo apt install make
Hello World Example
Cross-Compile and Link “hello.asm”
aarch64-linux-gnu-as hello.asm -o hello.o
aarch64-linux-gnu-gcc hello.o -o hello.elf -nostdlib -static
Run the Cross-Compiled Binary
Link to GitHub: https://github.com/Aminem2019/qemu-user-example
That’s it for today, feel free to comment, and don’t forget to clap and follow for more ;)