For a faster development we want to create ARM based containers for the AXCF2152 or AXCF1152 on x86 hardware. For this purpose, a virtual machine based on Debian or Ubuntu is used, which runs on our normal PC.
We need a emulator
To run ARM binary code on an x86 system we need an emulator that allows us to do this.
Qemu is one of the few hypervisors that can emulate ARM binary code and compile it for x86. All we need to do is install Qemu on our host system and activate the emulator.Install Qemu for Ubuntu or Debian:
apt-get update && apt-get install -y --no-install-recommends qemu-user-static binfmt-support
update-binfmts --enable qemu-arm
update-binfmts --display qemu-arm
Example for usage
To use Qemu now we need an extension in the container, namely the binary
/usr/bin/qemu-arm-static. There are several ways to use it in the container.
If the extension is only needed temporarily and if it exists locally, it can simply be passed to the container. To do this, the necessary binary is mounted in the container.
docker run -it --restart always \
-v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static \
This starts the container and jumps to a shell in the container. Now all necessary changes can be made. The changes can be transferred to the images afterwards with a commit.
docker commit ...
For a container build, the binary must be present in the container, there are two ways to do this.
1. The binary is already available, there are prefabricated images on Dockerhub for this purpose. https://hub.docker.com/u/multiarch/
2. The binary is added to the container images.Example dockerfile:
COPY qemu-arm-static /usr/bin/qemu-arm-static
COPY must appear directly as second command after
FROM. The whole thing works with all build tools.
One container for all
If you install the Qemu extension on an AXCF3152, you can use the same container for both systems (x86 and ARM). Regarding the perfomance this should be tested extensively.