Cross-compiling FreeBSD ARM on AMD-64

I've been learning about FreeBSD kernel development, and discovering that, not surprisingly, it's very, very slow to compile on a Raspberry Pi.  So, I decided to figure out how to compile the Pi kernel on a nice fast AMD-64.

Firstly, get the kernel sources to a subdirectory under a non-root user profile:

mkdir fbsd
cd fbsd
svn co http://svn0.us-east.freebsd.org/base/head src/FreeBSD/
cd src/FreeBSD

Next, we need to set some environment variables:

export MAKEOBJDIRPREFIX=/storage/home/tom/fbsd/obj
export TARGET_ARCH=armv6

Then, in order to cross-compile we need the kern build tools, so build those:

make kernel-toolchain

Then finally, build the kernel

make buildkernel KERNCONF=RPI-B

The completed kernel should show up in '/storage/home/tom/fbsd/obj/arm.armv6/storage/home/tom/fbsd/src/FreeBSD/sys/RPI-B'.  There will be a large number of .ko files in there and of course a file named "kernel".  Copy everything to the directory '/boot/kernel' on the Raspberry Pi, and reboot.

One Response to "Cross-compiling FreeBSD ARM on AMD-64"

  • Jonas
    September 22, 2013 - 8:17 am Reply

    Hi, this is great tips!
    I’ve tried to follow this steps on a virtual box installation and it all runs well. But, when all have compile, i’ve only got a *.o, *.c and *.h files in my directory. Of coarse there’s a kernel file, but no *.ko files (modules). What am i doing wrong?
    My KERNCONF is the same as the one provided with source, with an additional device (gif interface).

    Regards J

Leave a Reply