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.