OpenWrt running on La Fonera

Like any other Unix geek I've always had a bunch of old computers performing server tasks within my home LAN. Though running decent operating systems like some flavours of Linux, BSD and others, there was a couple of things I really couldn't stand anymore: constant noise and energy waste. I'm not in my early twenties anymore, so quality of life (rather than QoS) has been increasingly making part of my goals, as well as both environmental and economical awareness. Thus, embbeded systems feel like the natural way to go for me, more so when combined with the flexibility of embbeded Linux. I had a La Fonera wireless router laying arround for a few years, when I stumbled uppon OpenWrt, a Linux distribution for embedded devices.

OpenWrt runs on a wide range of wireless routers, most notably the Linksys WRT54G series though many other platforms are now supported, including La Fonera. The original firmware installed on these home gateways is usually quite limited, tailored for the very specific task of routing data between your LAN and the Internet, whereas OpenWrt is a fully fledged Linux distro. This way, by flashing the OpenWrt firmware on my Fonera, it becomes quite a cheap, noiseless and low power server. Among other things I'm currently using it as HTTP server (Apache), HTTP proxy (Squid), VoIP proxy (Asterisk), IRC/MSN bouncer (Miau), share server (Samba) and to display some snappy statistics (SNMP-utils, RRDtool and Bandwidthd).

One of the main features of OpenWrt is its great package management system, opkg. Resembling APT from Debian or Pacman from Archlinux it provides mature dependency resolution and querying capabilities, as well as a solid binary repository for each architecture. Packages are size optimized down to the last byte to cope with the small amount of space available on the flash memory of these devices. The goal of the OpenWrt team is to provide a slim base system, with nothing but the absolutely necessary software compressed within a SquashFS, leaving plenty of space available which you can use as you like by installing only the packages you need. Since a SquashFS is readonly, OpenWrt performs some magic by creating a JFFS2 (Journalling Flash File System 2) overlay enabling directories like /etc, /usr and others to be writable in a seamless way. As a result, you get a minimalist yet ultra flexible and powerfull distro which feels like Debian, Archlinux or Gentoo. There are other embbeded distros out there, one of them is DD-WRT, which is a little bit bloated for my taste as it packs tons of software you'll never use and a comprehensive web interface for out of the box operation (it feels like Ubuntu). Having said that, they both allow you to download their sources and build the most custom firmware possible, provided you have time for that.

After gainning access to the redboot boot loader through an ethernet cable, setting my IP address to and starting a TFTP server with the openwrt-atheros-vmlinux.lzma and openwrt-atheros-root.squashfs files on my laptop I issued the following commands at the redboot prompt:

ip_address -l -h
fis init
load -r -b %{FREEMEMLO} openwrt-atheros-vmlinux.lzma
fis create -e 0x80041000 -r 0x80041000 vmlinux.bin.l7
fis free

This last command outputs two hexadecimal numbers, subtracting the first from the last one I got the amount of free space (FREESPACE bellow) on the flash...

load -r -b %{FREEMEMLO} openwrt-atheros-root.squashfs
fis create -l 0xFREESPACE rootfs

Finally, the "fconfig" command allows the user to configure the bootloader. To run OpenWrt at boot time I've entered this script:

>> fis load -l vmlinux.bin.l7
>> exec