Compat Wireless

From RidgeRun Developer Connection
Jump to: navigation, search

Out dated information

This page is old, left for historical purposes. See Wifi on Linux 2.6.32 for information on backports (which replaced Compat Wireless).


Many interesting SoCs useful for embedded audio video streaming applications are only supported with a Linux 2.6 kernel. To be able to use common SD card and USB WiFi dongles, a backport of the kernel wireless system is needed. Fortunately, this effort is actively supported at by the Linux kernel wireless group.

Building compat wireless

For this example, the backport is used.

Building specifying Makefile variables

Compat wireless Makefile allows several variables to be set so the kernel location and install location can be specified.

make -C $(KERNELDIR) modules_install INSTALL_MOD_PATH="$(FSROOT)"

The drivers will be installed into the target file system in /lib/modules/2.6.*/updates.

Installing drivers

All the compat wireless drivers are build as loadable modules. You need to be careful to use all compat wireless drivers and not mix in any 802.11 base kernel drivers.

For this description, I used Atheros AR9271 chip set which supports IEEE 802.11bgn, packaged in a TP-Link TL-WN722N USB dongle.


insmod $COMPAT_KDIR/compat/compat.ko
insmod $COMPAT_KDIR/compat/compat_firmware_class.ko
insmod $COMPAT_KDIR/net/wireless/cfg80211.ko
insmod $COMPAT_KDIR/net/mac80211/mac80211.ko
insmod $COMPAT_KDIR/drivers/net/wireless/ath/ath.ko
insmod $COMPAT_KDIR/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
insmod $COMPAT_KDIR/drivers/net/wireless/ath/ath9k/ath9k_common.ko
insmod $COMPAT_KDIR/drivers/net/wireless/ath/ath9k/ath9k_htc.ko

Then I connect the TP-Link TL-WN722N USB dongle and dmesg reports:

usb 1-1.1: new high speed USB device using musb_hdrc and address 3
usb 1-1.1: configuration #1 chosen from 1 choice
usb 1-1.1: ath9k_htc: Firmware htc_9271.fw requested
usb 1-1.1: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
ath9k_htc 1-1.1:1.0: ath9k_htc: HTC initialized with 33 credits
ath9k_htc 1-1.1:1.0: ath9k_htc: FW Version: 1.3
ieee80211 phy0: Atheros AR9271 Rev:1

Starting up the wireless network

Once you have your wifi dongle's driver installed successfully the next step is to get it up and begin the wireless transmission.

Configuring for ad-hoc mode

For battery powered video capture systems, it is convenient to be able to use ad-hoc WiFi so that the camera doesn't have to be configured to attach to a Wireless Access Point (WAP). This also means you may not need any wifi security either.

iwconfig wlan0 mode Ad-Hoc
iwconfig wlan0 essid "Camera"

Powering on WiFi

You can start up the wireless interface and assign an IP address by doing

ifconfig wlan0 up
ifconfig wlan0 netmask

So, once you type the ifconfig wlan0 again you will see your wireless interface up. In order to get your wireless interface running automatically each time your board starts with a specific wireless network you can modify the wpa_supplicant.conf and interfaces files as is shown next.

/ # ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 64:66:B3:21:0C:F2  
          inet addr:  Bcast:  Mask:
          RX packets:48 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:12489 (12.1 KiB)  TX bytes:0 (0.0 B)

Configuring DHCP server

To eliminate reconfiguration of a laptop or smartphone that is connecting to the camera, we will run a DHCP server on the wireless interface.

cat <<EOF > /etc/dhcpd.conf
subnet netmask {
  default-lease-time 600;
  max-lease-time 7200;

touch /var/run/dhcpd.leases
dhcpd -cf /etc/dhcpd.conf -lf /var/run/dhcpd.leases wlan0