Building Packages Through Emulation
This is an updated version of the presentation by SeanBruno entitled Building Packages Through Emulation at EuroBSDCon.
If you have a system with limited resources (for example, the Raspberry Pi), you may find that building your own packages on the native machine is very slow. Your options are:
use packages from the existing FreeBSD repository. This is recommended if they are available, and the defaults are sufficient for you. Otherwise:
- build packages on a more powerful system.
For building packages, the most attractive option is to use poudriere on a more powerful machine (e.g. an amd64) building under emulation via Qemu.
Note that this is not true native cross-building; however, the Ports Collection does not yet widely support that. There Be Dragons.
What you need
Very highly recommended
- ZFS
Getting started
Once the above ports are installed, you need to enable the binary image activtors for QEMU via binmisctl(8). To do so, add the following line to your /etc/rc.conf:
qemu_user_static_enable="YES"
Unless you are planning to reboot before proceeding, manually start the script via service qemu_user_static onestart as root. Ignore any errors about 'not unique in activator list'; that just means you ran the script twice.
Checking out a ports tree via git
poudriere ports -c
Examples
The following examples should be enough to get you started. You do not necessarily need to use the exact same names for the jails (-j parameter).
Checking out and building the world that qemu will use
The arguments to the -a parameter must appear exactly as below. These are derived from the output of make targets.
These examples assume you are building FreeBSD 13.0-RELEASE jails from FreeBSD 14 (-CURRENT).
architecture |
command |
32-bit ARM |
poudriere jail -c -j 130armv6 -m git+https -v releng/13.0 -a arm.armv6 -x |
64-bit ARM |
poudriere jail -c -j 130aarch64 -m http -v13.0-RELEASE -a arm64.aarch64 -x |
32-bit MIPS |
poudriere jail -c -j 130mips32 -m git+https -v releng/13.0 -a mips.mips -x |
64-bit MIPS |
poudriere jail -c -j 130mips64 -m git+https -v releng/13.0 -a mips.mips64 -x |
To build jails for other FreeBSD versions, replace the -v parameter with the branch name corresponding to that version.
Although QEMU claims to support them, at the moment, it is believed not to work with powerpc.powerpc, powerpc.powerpc64, or sparc64.sparc64.
Building packages
This example assumes you want to build every single package on armv6. This is how the ports build cluster builds packages.
XXX TODO fill in more information here.
poudriere bulk -a -j 13armv6.
Things you do not need to worry about
- installing poudriere-devel instead of poudriere. This is no longer required.
- fiddling around with binmiscctl(8). The instructions above take care of this for you.
- chrooting into the qemu-built world, unless you really want to.
Things you do need to worry about
- There are still many ports that do not build under emulation, in particular, things that need X11. More help is needed!