Topic: Adding rt2800 wifi support to the OpenEmbedded kernel build
I'm building my kernel using the OpenEmbedded tools, so I spent some time figuring out how to incorporate RT2800 drivers into the OE build. Here is a quick summary of what worked for me.
When I bought my Chumby Hackers Board from the good folks at Adafruit, I also bought the TP-LINK TL-WN321G USB wifi dongle they recommend. The Adafruit tutorial explains that the original supply of this device used the RT73 chipset which is directly supported by the supplied kernel, but newer ones use the RT2800 chipset which requires additional drivers. Adafruit provides a binary driver update that adds rt2800 drivers to the default kernel.
The rt2800 drivers are not in the 2.6.28 kernel, but they have been backported as part of the most excellent compat-wireless project. This is the basis of the update available from Adafruit.
Add compat-wireless
The OpenEmbedded version that works with the Chumby build includes recipes for compat-wireless, but does not include a recipe for a minimal rt2x00 compat-wireless build. Creating such a recipe is trivial: create compat-wireless-rt2x00.bb in openembedded/recipes/compat-wireless with these lines:
include compat-wireless.inc
do_configure() {
cd ${S}
./scripts/driver-select rt2x00
}
and then add task-base-wifi and compat-wireless-rt2x00 to the list of IMAGE_INSTALL packages.
Add the led class module
The rt2x00 driver requires the led-class kernel module. Without this module loaded you will get an error message like this when you try to load the driver:
compat: Unknown symbol led_classdev_unregister
The led class library is enabled as a module in the falconwing Linux kernel configuration, but is not installed by the chumby-starterimage receipe. Resolve this by adding kernel-module-led-class to the list of IMAGE_INSTALL packages.
Install Ralink Firmware
The next barrier is device firmware. The rt2x00 driver needs to be able to load firmware at boot time. If the firmware is not available you will see an error message like this when the driver tries to load:
phy0 -> rt2x00lib_request_firmware: Error - Failed to request Firmware.
I believe same error appears when either the firmware file is not found, or when the udev firmware rules have not been configured.
At this point it is important to know that the USB wifi module uses the Ralink RT2870. Firmware for the RT2870 is available from the Ralink website. At the time of writing there are a couple of versions available for download. I've tested version 26 (3/31/2010) and version 2.4.0.1 (7/9/2010) and both seem to load okay. I haven't really properly tested wifi functionality, but at first glance it appears that 2.4.0.1 supports more features.
Below are the md5sum of these bin files (to help identify versions).
4613706159f1b75b9e6c040c19e09388 v2.4.0.1/rt2870.bin
2bb89af3a7d446deb4695c9a3daa7f9d v26/rt2870.bin
You need to copy the firmware bin file to /lib/firmware/rt2870.bin on your chumby root file system.
Add udev rules for compat-wireless
There is one more step. Firmware loading depends upon the rules defined in /lib/udev/rules.d/50-firmware.rules. You need a new rule to support compat-wireless. Add this to the end of 50-firmware.rules. It should look identical to the existing rule, except for the insertion of "compat_".
SUBSYSTEM=="compat_firmware", ACTION=="add", RUN+="firmware --firmware=$env{FIRMWARE} --devpath=$env{DEVPATH}"
That's it. now after booting I see:
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 74:EA:3A:89:09:FF
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 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:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0:avahi Link encap:Ethernet HWaddr 74:EA:3A:89:09:FF
inet addr:169.254.9.25 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
Once I have this rolled into my OE recipes I'll post a link to them.