Building OpenWRT firmware on FreeBSD

I have a Linksys WRT54G which runs Linux and I wanted to run the OpenWRT firmware to obtain some flexibility. I also installed a serial port modification so I can run my sprinkler system off the router.

I have built the firmware under FreeBSD using a Gentoo stage 3 tar ball. I picked Gentoo because it has 99% of what I needed in a single download. The only thing I needed to install was unzip which is available via portage.

The commands I used where as follows..

cd /usr/ports/distfiles/gentoo-linux
fetch /stage3-x86-2005.0.tar.bz2
cd ..
fetch http://downloads.openwrt.org/whiterussian/rc2/whiterussian_rc2.tar.bz2
mkdir /tmp/openwrt
cd /tmp/openwrt
tar --exclude=./dev -yxf /usr/ports/distfiles/gentoo-linux/stage3-x86-2005.0.tar.bz2
cd tmp
tar -yxf /usr/ports/distfiles/whiterussian_rc2.tar.bz2
brandelf -t Linux sbin/ldconfig sbin/sln
cp /etc/resolv.conf /etc
mkdir proc dev
mount -t linprocfs linprocfs /tmp/openwrt/proc
mount -t devfs devfs /tmp/openwrt/dev
chroot /tmp/openwrt bin/sh
emerge sync
/usr/portage/scripts/bootstrap.sh
emerge unzip
cd /tmp/openwrt
make
Note that the "emerge sync" takes a while..
Daniel O'Connor
Last modified: Wed Aug 31 17:19:18 CST 2005