Wireless on Raspberry Pi with Buildroot


Raspberry Pi does not have Wi-Fi on board. You’ll need to use a Wi-Fi dongle and discover the driver to build into the kernel. One way to find the driver is to plug the dongle into a Raspberry Pi running Raspbian, and perform an lsmod to see which module gets loaded. The following text assumes you’re building a custom embedded Linux system using Buildroot.

Kernel Configuration

Invoke the Kernel configuration utility using make linux-menuconfig.

Enable Wireless Networking support under Networking support

Wireless

Enable cfg80211 – wireless configuration API, and Generic IEEE 802.11 Networking Stack (mac80211), under Networking Support, Wireless

cfg80211 and mac80211

Enable EEPROM 93CX6 support under Device Drivers, Misc devices, EEPROM support. Required for RTL8187 module in my Wi-Fi dongle, may not be needed for your particular adapter

EEPROM 93CX6 support

Enable Wireless LAN driver support under Device Drivers, Network device support

Wireless LAN

Enable Realtek 8187 and 8187B USB support under Device Drivers, Network device support, Wireless LAN. Select the driver appropriate for your adapter

Realtek 8187 and 8187B USB support

Package Configuration

Invoke make menuconfig within the buildroot folder from a command prompt.

Select package iw required to configure wireless networking, under Target packages, Networking applications. Enable iproute2 if you want to use the ip utility instead of ifconfig.

iw

Select package wpa_supplicant and its sub-packages for WPA/WPA2 support

wpa_supplicant

Perform the build by invoking make, copy the newly minted system to an SD card, and use it to boot up your Raspberry Pi.

Configure Wireless Networking

List your wireless interfaces

iw list

If you’ve selected the iproute2 package above, the following should list all network interfaces

ip link

Bring up the wlan0 interface

ip link set wlan0 up

Or

ifconfig wlan0 up

Find the access point you want to connect to

iw dev wlan0 scan

Assuming you’re using WPA/WPA2, invoke wpa_passphrase to create config file, and wpa_supplicant to connect to network

wpa_passphrase your_SSID your_passphrase > your_SSID.conf
wpa_supplicant -B -i wlan0 -c your_SSID.conf

Instead, if you want to connect to an open network

iw dev wlan0 connect your_SSID

Request IP address using DHCP

dhcpcd wlan0

Check link status

iw dev wlan0 link

Add nameserver entries to /etc/resolv.conf e.g.

nameserver 8.8.8.8
nameserver 8.8.4.4

Test internet connectivity using ping

ping www.google.com

3 thoughts on “Wireless on Raspberry Pi with Buildroot

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