Cross-Compile for Armel Using an ARM HF VM
This method of compiling for armel (e.g. ARMv5, earlier, and some ARMv6) which uses pbuilder in an ARM HardFloat VM is not recommended as it is extremely slow (because of running in a emulated VM, not because of using pbuilder). However, it continues to be the best option for tasks like firmware image generation.
Build and boot an ARM HardFloat VM created using one of the methods pointed to by Four ARMs for LibVirt KVM
sudo apt install pbuilder
For example, if you want to build in a ‘wheezy’ armel environment:
- The main build command:
sudo pbuilder create --basetgz pbuilder-wheezy/base.tgz --buildplace pbuilder-wheezy/tmp --buildresult pbuilder-wheezy/cache --distribution wheezy --architecture armel --aptcache pbuilder-wheezy/aptcache --mirror http://archive.debian.org/debian
- This article takes this approach in order to illustrate how to add packages to an existing pbuilder rootfs because this workflow occurs often.
- You could use –extrapackages in the pbuilder command above if you already know what packages you need.
- To add packages like ‘make’ and vim-nox to an existing rootfs you might use:
sudo pbuilder update --basetgz pbuilder-wheezy/base.tgz --buildplace pbuilder-wheezy/tmp --buildresult pbuilder-wheezy/cache --aptcache pbuilder-wheezy/aptcache --extrapackages "make vim-nox nano"
In our case we’re going to clone the build system and linux 2.6 kernel from my WM8650 repo:
git clone -b wmcshore-1.0 –depth 1 –recurse-submodules https://git-large.wildtechgarden.ca/linux-kernel/wm8650-2.6-reference-kernel-build.git –shallow-submodules wm8650-2.6-reference-kernel-build
- Launch a pbuild ‘login’ with the kernel build directory bind mounted into the pbuilder chroot:
sudo pbuilder login --basetgz pbuilder-wheezy/base.tgz --buildplace pbuilder-wheezy/tmp --buildresult pbuilder-wheezy/cache --aptcache pbuilder-wheezy/aptcache --bindmounts "$(pwd)/wm8650-2.6-reference-kernel-build"
- In pbuilder login, change to your wm8650-2.6-reference-kernel-build directory. (e.g. cd /home/user/wm8650-2.6-reference-kernel-build).
- Build the kernel (for this example all that we need to do is execute make).
- Wait (a long time).
- Once you are done, exit the login session.
Copy artifacts (aka output/results) to where you can use them (this is just standard Linux copying or remote copy, etc).