For some time now I’ve been meaning to use one of my cheaply acquired Seagate Dockstars as a replacement for three or four of the miscellaneous OpenWrt based boards I use around my home for wireless, gateway routing (NAT), vpn to my work (OpenVPN) and some other functions such as my home control box. I’m somewhat partial to using a Dockstar board for this, but these steps should work equally well on the Pogo E02 and any similar Kirkwood based device. Just be sure you put the right bootloader on or you could brick your board. You’ve been warned, don’t blame me, blah blah… The first link in this chain is building a wifi access point using a USB based radio and hostapd. I had no idea how non-trivial this would end up being, but after reading and attempting to follow some of the other online guides google found for me, I wanted to keep track of this as a backup to my own very poor memory, and to share with anyone aiming to achieve the same.
Step one seems to be completely unlrelated to much of the technology I’m most worried about. It appears that the wireless device driver required to use hostapd with a usb wifi radio requires the 3.0 kernel tree. Enter the custom uBoot I’ve been running on my Pogoplugs. Evidently an issue arose somewhere around the 3.2.x kernel tree with how this bootloader initialized the CPU cache. So go here and follow the instructions to update your bootloader. It so happened that this post also helped me to get Jeff’s recovery OS flashed on my Dockstar’s nand flash. Cool, thanks Jeff!
Step two, installing Debian Wheezy. Some time ago I found this page describing a Wheezy install script based on Jeff Doozan’s initial debootstrap work. After some fiddling I figured out that Wheezy is officially named “Testing” at this point. I also had to do some prodding to find the current kernel version. Here’s the resultant script as of 3/26/2012.
This ran for about two hours, so pack a lunch. When it finally finished, I ended up with:
root@debian:~# uname -a
Linux debian 3.2.0-2-kirkwood #1 Mon Mar 5 17:06:08 UTC 2012 armv5tel GNU/Linux
Before I get ahead of myself, it’s usually a good idea to enable the following option in /etc/default/rcS so the filesystem is automatically fixed whenever possible (i.e. after you reboot using the reset button).
I went ahead and added the necessary dependencies as well as a couple personal preferences such as byobu and the grown up version of vim to the ‘EXTRA_PACKAGES’ variable in the aforementioned script. But if you’re building this on your own here’s the bare minimum requried for a WPA2/PSK access point.
Next, we need to configure a bridge so that it’s created by /etc/init.d/network starting up. Normally, I use the bridge as the configured interface, and leave eth0 and wlan0 set to manual configuration so they don’t directly have an address bound to them. The following /etc/network/interfaces file will facilitate a static address on br0 and bridge to the onboard eth0 port.
iface lo inet loopback
iface br0 inet static
Once I get around to configuring a second USB ethernet adapter for the WAN side of my router, this will require some changes. But for now I’m focusing on making the wireless access point functional.
Now you’ll want to connect your wireless radio, and install the requisite firmware. The guide at forum.doozan.com shows how to install an older version that may not be available, but at the time of this writing the firmware I needed for my TP-Link TL-WN722N was installed thusly.
dpkg -i firmware-atheros_0.35_all.deb
Now we need to setup the hostapd.conf file located at /etc/hostapd/hostapd.conf. The following are some default values, you will want to tailor them to your personal preferences / configuration.
# needed for winblows clients…
I will update this as I do more experimentation with fine-tuning wifi throughput. But this is by no means the best or even the minimum configuration needed. Go to linuxwireless.org and do your own research. It’s information well worth knowing.
To test this config file, the simplest method I’ve found is to run hostapd from the command prompt without daemonizing it. It’s a good idea to do this so you get direct feedback on your hostapd.conf syntax. Unless you’re like me and everything you do is perfect from beginning to end.
At this point you should see a wealth of information about what hostapd is doing – most importantly bringing up the wlan0 interface, configuring it in master mode and adding it to the bridge br0 we created earlier. If everything is good you should be able to connect with wireless stations and if you have a dhcp server up on your existing network you’ll be talking in bits and bytes. Don’t skip to the last step until you’ve been able do so.
Lastly, for some strange reason no default config file was specified in the startup script deployed by the hostapd package. This is simple – edit /etc/init.d/hostapd and edit the following line to reflect your config file.
At this point, you should be able to reboot your Kirkwood based device and have an active and functional wireless access point.