WPA for wifistix
From GumstixDocsWiki
Contents |
Introduction
Setting up wpa_supplicant is straight forward now that the needed modules and patches are included in the gumstix buildroot (since 1153). The wpa_supplicant module in the buildroot environment is not enabled by default so a new file system image must be built and installed. Then wpa_supplicant must be configured for your network.
Add wpa_supplicant to a file system image
These commands are a variation of the simple step-by-step instructions on the Tutorial page.
The sources for buildroot are downloaded from the archive using a the following command.
svn co http://svn.gumstix.com/gumstix-buildroot/trunk gumstix-buildroot
Once you have the buildroot sources downloaded you must add wpa_supplicant to the default configuration:
cd gumstix-buildroot make menuconfig
Select wpa_supplicant under the wifistix module in the 'Package Selection for the target' sub-menu Then exit, of course saving you new Buildroot configuration, menuconfig.
After using menuconfig to configure Buildroot you must rebuild the file system:
make
Write the new filesystem image to your gumstix. Step-by-step instructions are available in the 'Replacing the filesystem-image' section of the Tutorial page.
Configure wpa_supplicant
To get WPA working you will have to modify the network startup configuration and add WPA specific information for your network. The example commands and referenced files in this section are all exeuted on the gumstix after the new file system image has been installed.
Network startup on gumstix is controlled by the /etc/network/interfaces file. Change the mwlan0 lines in that file from
auto mwlan0
iface mwlan0 inet dhcp
pre-up /sbin/iwconfig $IFACE essid any txpower 100mW
to
auto mwlan0
iface mwlan0 inet dhcp
pre-up /sbin/wpa_supplicant -Bw -Dmarvell -imwlan0 -c/etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant
The WPA specific information for your network goes in the file /etc/wpa_supplicant.conf. The following is a simple exmaple using pre-shared key (WPA-PSK) management. WPA-PSK is one of many possible WPA configurations. It is easy to setup and commonly used for home networks. See the README file in the wpa_supplicant package for more examples and detailed information.
To complete the WPA configuration you will need the name of your network, the SSID, and the passphrase. You can use the passphrase directly, but to save some computational time this example will pre-compute the 265-bit key. Replace each of the following references to yourSSID and your_passphrase with the proper values for your network.
$ wpa_passphrase yourSSID your_passphrase
network={
ssid="yourSSID"
#psk="your_passphrase"
psk=bf83f4c896110b115bee8ff77b372f844435108950476a51667dd1b4a97e5b98
}
$
Create the /etc/wpa_supplicant.conf with the following contents:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="yourSSID"
scan_ssid=1
key_mgmt=WPA-PSK
#psk="your_passphrase"
psk=bf83f4c896110b115bee8ff77b372f844435108950476a51667dd1b4a97e5b98
}
# Ad-hoc mode, requires global ap_scan=2
network={
ssid="gumstix"
key_mgmt=NONE
mode=1
}
The ssid and psk lines are those produced by wpa_passphrase above.
The network will start automatically when you reboot the gumstix, or you can use the following commands to restart the network without rebooting.
$ ifdown mwlan0 $ ifup mwlan0
Your gumstix/wifistix should now be connected to your Wifi network.
Troubleshooting
ESSID Dropped Character Bug
Some svn revisions seem to have a bug with setting the essid for the wifistix. The result is the last character is dropped from the essid. You can test for this by switching to ad-hoc mode and seeing what essid it's setting to if you want. The workaround is to put a dummy character onto the end if the essid. e.g. yourSSID_ instead of yourSSID This is complicated when using WPA since the essid seems to be used as part of the encryption key. The wpa_supplicant.conf should be set as normal. The /etc/network/interfaces should be changed to:
auto mwlan0
iface mwlan0 inet dhcp
pre-up /sbin/wpa_supplicant -Bw -Dmarvell -imwlan0 -c/etc/wpa_supplicant.conf
pre-up /bin/sleep 5 ; /sbin/iwconfig $IFACE essid yourSSID_
post-down killall -q wpa_supplicant
The sleep value should be set so that wpa_supplicant is done configuring the wireless interface before we change the essid ourselves for the workaround. This works with 400mhz version. Adding a dummy character can also correct this problem for unsecured, WEP secured, and ad-hoc connections.
References
- This tutorial is largely based on the Ubuntu How To: [WPA with wpa_supplicant].
- The [wpa_supplicant home page].
- The wpa_supplicant README file which can be found in the gumstix-buildroot/build_arm_nofpu/wpa_supplicant-0.4.9 directory. (Note that build_arm_nofpu/wpa_supplicant-0.4.9 directory will not exist until after you build the root file system.)

