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. Alternatively, here is a link to a basic hostapd.conf file that will get the wireless up and running with no encryption and the SSID set to “gumstix”. 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!

About these ads

16 Comments »

  1. Hello Cory, Thanks for the excellent guide!

    I was able to enable AP mode on my Overo Air/Fire modules following your guide. However, the network is not reliable and as soon as I start sending large amounts of data the client connection is lost. I am using the “ttcp” utility for bandwidth testing.

    If you don’t mind, what are your experiences with reliability with the Thinfirm driver compared to the regular libertas_sdio driver?

    I am running Linux 2.6.35 and get very reliable connectivity using libertas_sdio in both ad-hoc and managed modes.

    Thanks for your time, and again the great guide.

    Best regards,

    Luke Tokheim

    Comment by Luke Tokheim — December 1, 2011 @ 12:36

    • I’ve noticed the same reliability issues. But I haven’t done any more work on this lately. If you figure any of it out, feel free to post your solutions here.

      Comment by corysohrakoff — December 1, 2011 @ 12:56

  2. Should both the libertas_sdio and the libertas_tf drivers be loaded? Also, how can I tell which firmware file got loaded in to the wireless module? No information appears in dmesg about whether any firmware was loaded.

    I _am_ using Arch Linux ARM rather than Ubuntu.

    Comment by Sasha Zbrozek — May 28, 2012 @ 03:41

    • You only need libertas_tf_sdio. If you build it as a module, it should be as simple as doing an lsmod. When I build the kernel, I didn’t build the regular wireless modules, only the thin firmware ones. You could build both, but I found that you need to blacklist the regular one so it doesn’t load on boot.

      Comment by corysohrakoff — May 28, 2012 @ 08:35

    • Hi All,

      When I try to load the libertas_tf.ko the following error occur:

      FATAL: Error inserting libertas_tf (/lib/modules/2.6.36/kernel/net/wireless/libertas_tf/libertas_tf.ko): Invalid argument

      Have you an idea?

      Regards,
      Yves

      Comment by yves teissier — February 7, 2013 @ 01:57

      • Not sure. I built using the 3.0.x kernel without issue. I haven’t tried 2.6.x.

        Comment by corysohrakoff — February 7, 2013 @ 08:09

  3. Hey All,
    I just got this working again in linux-3.2 for Gumstix Overo using hostapd2.0. I did in fact cross compile and it worked well, after some work. A couple of updates needed (after creating the bitbake recipe) include adding CONFIG_LIBNL20 to the CFLAGS in the make file, and adding ‘-lnl’ and ‘-ln lnl-genl’ to the LIBS. (hostapd/Makefile). Post here if anyone wants a recipe or a patch file.
    Cheers.

    Comment by John — February 15, 2013 @ 12:52

    • Yes please, can you provide recipe and patches. Thanks

      Comment by robert — February 26, 2013 @ 07:16

      • Well, I meant to post your email address just to keep the blog clean. ;) On the other hand, the changes aren’t that big, so here goes:

        [Deleted. See below.]

        Comment by John — February 26, 2013 @ 14:33

  4. Hey Robert.

    The patch file didn’t paste cleanly, probably due to font incompatibilities. Sorry, bloggers, for the uglyness, I can’t delete the bogus response. Here is a repeat of the patch.

    [Deleted. See below.]

    Comment by John — February 26, 2013 @ 14:43

  5. Thanks John for all the trouble. I will give that a try. Cheers.

    Comment by Robert — February 27, 2013 @ 03:38


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Silver is the New Black Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: