The objective of this post is to install wpa_supplicant on the ARM target running Linux.
wpa_supplicant is a WPA Supplicant for Linux, BSD, Mac OS X, and Windows with support for WPA and WPA2 (IEEE 802.11i / RSN). It is suitable for both desktop/laptop computers and embedded systems. Supplicant is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.
wpa_supplicant is designed to be a "daemon" program that runs in the background and acts as the backend component controlling the wireless connection. wpa_supplicant supports separate front-end programs and a text-based front-end (wpa_cli) and a GUI (wpa_gui) are included with wpa_supplicant. wpa_supplicant uses a flexible build configuration that can be used to select which features shall be included and that allows to generate minimal code size binary.
Refer to WPA_Supplicant page for more information on the features supported. Also, refer to the attached developer's document on Supplicant and Hostapd which might be a helpful reference.
The following dependent libraries need to be installed on the target in order to run HostApd.
The installation steps for Libnl and OpenSSL is same as written for Hostapd. Check this blog to setup the dependencies before proceeding to the following section.
Install wpa_supplicant sources
1. Download the wpa_supplicant open-source package. Extract the file and go to root folder of the package.
$ tar -xzf wpa_supplicant-2.6.tar.gz
$ cd wpa_supplicant-2.6/wpa_supplicant
2. Copy the existing "defconfig" file to ".config". Edit the .config as shown below.
$ cp defconfig .config
$ vi .config
Now edit .config and make sure to set the following:
CFLAGS += -I/usr/include/libnl3
3. Export the "pkgconfig" location.
$ export PKG_CONFIG_PATH=/usr/arm-linux-gnueabi/lib/pkgconfig
4. Cross-compile the sources and install the binaries to destination folder.
$ make CC=arm-linux-gnueabi-gcc
$ make install DESTDIR=<target_rootfs>
Start the WPA_Supplicant
wpa_supplicant runs as a daemon and requires a configuration file. Create a file called /etc/wpa_supplicant.conf with the following contents:
- Make sure the following kernel drivers are installed before starting the supplicant. Follow the Getting started on Linux Driver Backporting - FMAC blog to bringup the target with necessary drivers.
Module Size Used by
brcmfmac 209662 0
brcmutil 8504 1 brcmfmac
cfg80211 236740 1 brcmfmac
compat 2028 2 brcmfmac,cfg80211
- Start the supplicant to run in background. Basically the below command takes driver(nl80211), interface(wlan0), configuration file(/etc/wpa_supplicant).
$ wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B