The steps below provide a way to cross compile on your local development machine. Docker and QEMU to emulate the armhf
/arm32v7
architecture.
Tested on:
- Ubuntu 18.04 LTS
Install dependencies on your local development machine:
sudo apt install docker qemu-user-static binfmt-support
# Start the docker daemon
sudo service docker start
Build the docker image:
sudo docker build -t arm32v7/debian .
Enter the docker image:
Note: The -v
flag mounts the source code directory in the docker image, so any generated files (ie. the build outputs) will show up on your local filesystem.
# Start the docker image in interactive mode
sudo docker run -it -v $(pwd):/home/arm arm32v7/debian /bin/bash
Note: Any changes made to the local files will be reflected in the interactive docker image. ie. Source code can be edited and the docker shell can be left open to continually test for builds.
Once inside the docker image, build the printer application:
cd /home/arm/myrepo
make clean
# Build using all available processors/cores
make -j$(nproc)
After the build completes, you may exit the docker image with CTRL+D
or by typing exit
.