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 extremly slow (because of running in a emulated VM, not because of using pbuilder), but is included for completeness.
You Need an ARM HardFloat VM
Build and boot an ARM HardFloat VM created using one of the methods pointed to by Four ARMs for LibVirt KVM
Install and Configure pbuilder
sudo apt install pbuilder
Create a pbuilder rootfs
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
Add Additional Packages to pbuilder as Required
- 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
--extrapackagesin 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"
Build Kernel (for example)
Get a Copy of a 2.6 Kernel
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.danielfdickinson.ca/linux-kernel/wm8650-2.6-reference-kernel-build.git --shallow-submodules wm8650-2.6-reference-kernel-build
Use pbuilder to build the kernel
- 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
- Build the kernel (for this example all that we need to do is execute
- Wait (a long time).
- Once you are done,
exitthe login session.
Copy the Build Artifacts
Copy artifacts (aka output/reults) to where you can use them (this is just standard Linux copying or remote copy, etc).