Minnowboard:Adding USB 80211 Support To Your Kernel

The stock Minnowboard firmware provides only minimal support for Ethernet and wireless Ethernet interfaces. This guide will walk you through the steps necessary to add additional kernel modules to your Angstrom build, in order to properly support wireless Ethernet via a usb Ethernet adapter.

Requirements:
 * 1) You have made it to the "Customize Your Build" step on the Building Angstrom Linux for the MinnowBoard guide.
 * 2) A USB Ethernet adapter. I used a an LB-Link BL-LW05-AR5 802.11n adapter which is built on a "Realtek RTL8188CUS" chipset. This is a common chipset, so a model based on this chipset from a different manufacturer should work just as well for you, with this guide.

This guide can be used as an outline for almost any kind of kernel config you'd like to add support for, I simply chose the following Wireless Ethernet modules as it suited my project requirements.

Adding kernel configs to the kernel recipe
Assuming you've made it to the "Customize your build" step of the bitbake compile guide, the next step is to specify the kernel options you'd like to add to your kernel compile. In my case, we needed a number of directives related to the linux 802.11 features. Let's start by creating a kernel .config addition file to the linux yocto recipe by running: vim sources/meta-minnow/recipes-kernel/linux/linux-yocto/rtl8192.cfg This will create a new file. We'll like this file to have the following contents: CONFIG_AVERAGE=y CONFIG_CFG80211=m CONFIG_CFG80211_DEFAULT_PS=y CONFIG_MAC80211=m CONFIG_MAC80211_HAS_RC=y CONFIG_MAC80211_RC_MINSTREL=y CONFIG_MAC80211_RC_MINSTREL_HT=y CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" CONFIG_CFG80211_WEXT=y CONFIG_RTL8192CE=m CONFIG_RTL8192CU=m CONFIG_RTLWIFI=m CONFIG_RTLWIFI_DEBUG=y CONFIG_RTL8192C_COMMON=m CONFIG_RFKILL=m CONFIG_RFKILL_LEDS=y CONFIG_SENSORS_CORETEMP=m See the below section for notes on how we can determine what config options we'll need for our builds.
 * 1) Generic 802.11 Support:
 * 1) USB 802.11 Devices:
 * 1) Rfkill support (used by wireless/bluetooth devices)
 * 1) Add cpu temperature support (Not related to 802.11, but a nice thing to have)

Adding a reference to our config file in the kernel recipe
Once the config directives are in a suitable file and path, the packager needs to know to reference this file. To do so, we'll need to modify the "linux-yocto_3.8.bb" bitbake definition file by adding a reference to the newly created "rtl8192.cfg". Go ahead and "vim sources/meta-minnow/recipes-kernel/linux/linux-yocto_3.8.bb" to reflect the following changes: 7 SRC_URI = "git://git.yoctoproject.org/linux-yocto-3.8.git;protocol=git;nocheckout=1;branch=${KBRANCH},${KMETA},emgd-1.16;name=machine,meta,emgd \ 8            file://media.cfg \  9            file://staging.cfg \ 10            file://rtl8192.cfg" Note that on line 9, we removed the trailing parenthesis, and replaced it with a backslash. We then appended a new line, which added a reference to the rtl8192.cfg file, and terminated the string with a parenthesis.

Now proceed with the rest of your build
Once the above changes have been made, you can proceed onto the "Compile Time" steps in the Building Angstrom Linux for the MinnowBoard guide. When your image is running, you should see that the new modules have been compiled and installed in "/lib/modules/3.8.13-yocto-standard" (and that similarly, your kernel interfaces reflect the newly configured functionality)

Configuring wireless ethernet once your image is running
Unfortunately, it seems that the stock Angstrom environment isn't quite as polished as you'd expect when it comes to managing your wireless Ethernet adapter. Assuming you're running a "systemd-image" image, the following steps should allow you to configure a static ip address on your wireless Ethernet adapter (I haven't figured out how to get DHCP working yet).

Copy over your rtl firmware
Seemingly, Ubuntu comes with the latest firmware in its "/lib/firmware" directory, so when your minnowboard comes up for the first time, transfer the "rtlwifi" directory to the Minnowboard via your wired Ethernet adapter: scp -r /lib/firmware/rtlwifi root@192.168.1.100:/lib/firmware Be sure to replace the "192.168.1.100" with your Minnowboard address.

Create a wpa_supplicant.conf
On your minnowboard create/edit the "/etc/wpa_supplicant.conf" with a configuration similar to the following: ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=0 update_config=1 network={ scan_ssid=1 ssid="YourNetworkSSIDGoesHere" key_mgmt=NONE }

Edit the wpa_supplicant systemd service definition
Seemingly, systemd brings up wpa_supplicant on system startup. However, the command that systemd runs, doesn't help us very much. Go ahead and edit the "/lib/systemd/system/wpa_supplicant.service". Change the ExecStart line to read as follows: ExecStart=/usr/sbin/wpa_supplicant -u -c /etc/wpa_supplicant.conf -i wlan0 wlan0 is probably what your wireless Ethernet adapter is setup as. You can this this to suit your adapter if needed.

Assign an IP
At this point, you should restart your minnowboard if you haven't already to effect the wpa_supplicant changes. You can check to ensure the correct wpa_supplicant command is running by examining the output of "ps" and checking the wpa_supplicant command's options. Similarly, you can ensure that you've connected to your access point by running the "iw dev wlan0 link" command, and examining the output for the connection status.

From here, assigning an ip is as simple as typing: ifconfig wlan0 192.168.1.128 netmask 255.255.255.0 broadcast 192.168.1.255 route add default gw 192.168.1.1 wlan0

You're done!

Supplemental Notes: How to easily determine what kernel configuration parameters you need
The easiest way to see what you want and what's available is to run a 'make menuconfig'. Most of what you'd like to know about this process is detailed in the Yocto Project Linux Kernel Development Manual, but here's the quick overview: sudo apt-get install screen MACHINE=minnow ./oebb.sh bitbake -c menuconfig linux-yocto From there, the easy way to tell what you'd like to add is to "Save an Alternate Configuration File" before and after you've made your selections, and compare the diff of the before and after config files. The delta will stand out, and can be added to your .cfg file in the above "Adding kernel configs to the kernel recipe" section.