Stuff I'm Working On

September 13, 2011

Enabling Wifi AP Mode on a Gumstix Overo

Filed under: gumstix — Tags: , , , , — corysohrakoff @ 11:38

This guide demonstrates how to enable Wifi AP mode for a Gumstix Overo, running Linux Kerenel 3.0.3 and Ubuntu 10.04. Setting up AP mode has very little documentation, so I hope this helps to bridge the gap.

Get the required files

  1. Download the latest thin-firmware from dev.laptop.org. http://dev.laptop.org/pub/firmware/libertas/thinfirm/lbtf_sdio-9.0.7.p4.bin
  2. Rename the file sd8686tf.bin
  3. Get the required helper firmware from Marvell (SD-8686-LINUX26-SYSKT-9.70.3.p24-26409.P45-GPL) http://www.marvell.com/support/downloads/driverDownload.do?driverId=203&action=1
  4. Extract the downloaded zip file, then extract SD-8686-FEDORA26FC6-SYSKT-GPL-9.70.3.p24-26409.P45.tar within it. Navigate to the FwImage directory.
  5. Inside FwImage there is helper_sd.bin. Rename helper_sd.bin to sd8686_helper.bin and save it for later.
  6. Get the libertas_tf_sdio driver. http://dev.laptop.org/git/users/derosier/wireless-testing/
  7. Download the latest version of hostapd from: http://hostap.epitest.fi/hostapd (Dependencies: libssl-dev, libnl-dev)

Driver set-up

To get the Libertas SDIO thin-firmware driver working, you need to build the modules for your kernel. If you’re using a script to build your kernel see the note below first.

Copy the directory libertas_tf in drivers/net/wireless/ from the driver source tree into your own kernel source tree. You must patch the file drivers/net/wireless/Kconfig to include the following after the “config LIBERTAS_THINFIRM_USB” section.

config LIBERTAS_THINFIRM_SDIO
 tristate "Marvell Libertas 8686 SDIO 802.11b/g cards with thin firmware"
 depends on LIBERTAS_THINFIRM && MMC
 ---help---
 A driver for Marvell Libertas 8686 SDIO devices and those that include
 the 88W8686 core, such as the Wi2Wi devices. Special SDIO specific
 firmware is required to use this driver, see the OLPC site for details:

 <http://wiki.laptop.org/go/Thinfirm_1.5>

Prepare to build the kernel with the new modules. In menuconfig navigate to: Device Drivers—>Network device support—>Wireless LAN.

Select the following to build as modules.

  • Marvell 8xxx Libertas WLAN driver support with thin firmware
  • Marvell Libertas 8686 SDIO 802.11b/g cards with thin firmware

You should also ensure that Networking support—>Wireless—>Generic IEEE 802.11 Networking Stack (mac80211) is selected. I also took out the regular Marvell Libertas driver since I didn’t need its functionality. You may want to do the same.

NOTE: If you’re using a script to build your kernel, make sure it doesn’t replace the files you added to the source tree.

If you’re using this guide to build your kernel/filesystem. You will need to perform the following steps to get it working.

In build_kernel.sh comment out a few lines near the bottom of the file.

dl_kernel
extract_kernel
patch_kernel
#copy_defconfig
#make_menuconfig
#make_uImage
#make_modules
#make_headers

Run build_kernel.sh to do the basic set-up for you. Afterwards, change the file in the same place to look like:

#dl_kernel
#extract_kernel
#patch_kernel
copy_defconfig
make_menuconfig
make_uImage
make_modules
make_headers

Perform the driver set-up steps above and then run build_kernel again. This will build the kernel. Next, in build_deb.sh comment out a few lines near the bottom of the file.

#dl_kernel
#extract_kernel
#patch_kernel
copy_defconfig
#make_menuconfig
make_deb

Finally, run build_deb.sh

Firmware set-up

The thin-firmware and firmare helper must be placed in the /lib/firmware/ directory on the filesystem. Simply copy sd8686tf.bin and sd8686_helper.bin to /lib/firmware/ on the Gumstix filesystem.

hostapd set-up

The wireless interface cannot be manually set into AP mode, thus the hostapd software must be used. This involves natively compiling hostapd on the Gumstix Overo, so gcc and related tools are required to be installed. Cross-compilation has not been tested.

Copy the hostapd tarball to a suitable location on your Gumstix, extract it and navigate to the directory. Next, create the .config file.

$ cd hostapd
$ cp defconfig .config

Edit the file by by uncommenting the line “#CONFIG_DRIVER_NL80211=y”, i.e. removing the #. Then, build the program and then install it (as root).

$ make
# make install

Next you’ll want to set-up a configuration file for hostapd. In the directory that you just compiled hostapd, there is a sample hostapd.conf file you can use. You can learn more about configuration here.

Put the .conf file somewhere that makes sense, i.e. /etc/hostapd.conf.

Loose-ends

You probably want your wireless card to be put into AP mode when the Gumstix boots. Below is an example of how to do that. (This is not the only way to do this.)

Create/edit the file /etc/network/interfaces to look like below. The wireless part is what is important so if you have some custom configuration already done in this file just edit/copy the wireless part (wlan0).

# /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet static
address 192.168.0.1
netmask 255.255.255.0
broadcast 192.168.0.255
post-up /usr/local/bin/hostapd -B /etc/hostapd.conf

The example also assigns a static IP address to the wireless card. If you don’t do this, the network won’t work. Wireless clients also must have static IP addresses assigned unless you run a DHCP server on the Gumstix to automatically assign clients IP addresses. In Ubuntu the package dhcp3-server will provide that functionality. Here is an example .conf file for a dhcp3 server.

# /etc/dhcp3/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.2 192.168.0.100;
}

With all this work done, your Gumstix should now be able to act as a Wifi access point!

Blog at WordPress.com.