In an effort to figure out the clocking for the LCD controller on the AM335X, I built a custom FreeBSD SD card image for the BeagleBone. I thought I'd share the steps I used to build the image as it isn't totally trivial. Though, the crochet-freebsd scripts really do help a lot.
The best host for cross building a FreeBSD image is FreeBSD. Since my main box runs Gentoo Linux, I decided to setup a FreeBSD virtual machine under QEMU with the latest version of FreeBSD. Here are the steps to fetch the ISO, create a disk image for the virtual machine, and run the installer:
wget -O freebsd.iso ftp://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/9.2/FreeBSD-9.2-RC3-i386-disc1.iso
qemu-img create freebsd.img 32G
qemu-kvm -localtime -net user -net nic -m 2048 -cdrom freebsd.iso \
-hda freebsd.img -boot d
There isn't a whole lot to configure during the installation. The defaults should be fine. I chose the sshd option as it allowed me to easily transfer the image off of the VM later on. Once the installation of FreeBSD is complete, you can start QEMU with this command:
qemu-kvm -rtc base=utc -net user,hostfwd=tcp::2222-:22 \
-net nic -m 2048 -hda freebsd.img
Log in to the virtual machine and install the dependencies (subversion, git, bash, gmake, and gsed). Then use subversion to checkout the latest sources. Finally build an ARM cross compiler:
pkg_add -r subversion git bash gmake gsed
rm -rf /usr/src && svn co http://svn.freebsd.org/base/head /usr/src
cd /usr/src && make XDEV=arm XDEV_ARCH=armv6 xdev
The next step is to get a copy of crochet-freebsd and u-boot.
cd ~ && git clone git://github.com/kientzle/crochet-freebsd.git
cd crochet-freebsd && ftp ftp://ftp.denx.de/pub/u-boot/u-boot-2013.04.tar.bz2
tar xf u-boot-2013.04.tar.bz2
Finally, run the crochet.sh script to build the image.
sh crochet.sh -b BeagleBone
The build will take a while, especially in a VM. When it's done, there will be an SD card image under the work directory. Insert an SD card and be sure to unmount any partitions that were auto-mounted. On my Linux host, I ran these two commands to fetch the image off of the VM and write it to the SD card.
scp -P 2222 root@localhost:/root/crochet-freebsd/work/*.img .
dd if=FreeBSD-armv6-BEAGLEBONE.img of=/dev/sdb bs=1M oflag=direct
That's it. Just put the card into the BeagleBone and apply power. It should boot up to a login prompt. At the prompt you can log in as root (no password).