Using the WL18xx Cape with BeagleBone Black

From Texas Instruments Wiki
Jump to: navigation, search

Read this first!

Note: This page was created as an early effort to get the WL18xx cape operational with the BeagleBone Black. This capability is now supported officially in the following wiki page:

There are several pages that now provide complete build scripts for BeagleBoneBlack + WL1835 Capes

It is recommended to reference the page above for integrating WL18xx with BeagleBone Black.

Linux and WL18xx Sources

The Linux kernel sources for the Beagle Bone Black is maintained on

The TI Openlink wl18xx sources for the Beagle Bone Black are maintained on and respectively.

The production and validation of these kernels is done with the Angstrom Distribution and meta-beagleboard with the OpenEmbedded build system. The sources shared here are done for convenience for those familiar with the git version control system.

The Beagleboneblack patches and build scripts are stored above git reposities.

Use following command to install git:

   ~$sudo apt-get install git

Installing ARM Cross Compiler Toolchain

To compile the linux kernel for the BeagleBone Black, you must first have an ARM cross compiler installed. Use gcc-4.7-arm-linux-gnueabi-base that comes with Ubuntu 12.04. To install the compiler run:

~$sudo apt-get install gcc-arm-linux-gnueabi

       Cross-compiler is installed under /usr/bin.


~$wget ~$sudo tar -C / -xjf angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2 ~$export PATH=/usr/local/angstrom/arm/bin:$PATH

Build procedure for BeagleBone Black 3.8.13 Angstrom Linux Kernel

Environment Variables


1) To keep cleaner and simple build process for WiLink8 support on Beaglebone Black, create "BUILD_DIR" envrionment variable which contains source folder for kernel and wl18xx modules.

2) For example "ti-wl18xx" is the workspace source directory under $HOME contains sub-folder as "kernel" and "wl18xx", which contains sources for kernel and wl18xx components. export "ti-wl18xx" as "BUILD_DIR". For ex:

$export BUILD_DIR=/ti-wl18xx

3) Create partial "partial_rootfs" folder in $BUILD_DIR to keep and install Angstrom kernel modules and all wl18xx compat-wireless modules. Export WILINK8_PARTIAL_ROOTFS_DIR to this newly created directory. For example:

$mkdir -p $BUILD_DIR/partial_rootfs

$export WILINK8_PARTIAL_ROOTFS_DIR=$BUILD_DIR/partial_rootfs

Download Kernel sources with WL18xx patch for BBB

Change into $BUILD_DIR


Checkout updated kernel source for Beaglebone Black from below github

~$git clone git:// && cd kernel ~/kernel$git checkout wl18xx_bbb_support ~/kernel$./


1) LZO compression is being used for the uImage. Use following command to install LZO.

~kernel$sudo apt-get install lzop

2) mkimage is being used for the uImage. Use following command to install mkimage.

~kernel$sudo apt-get install ubuntu-mkimage

Building Kernel sources with WL18xx patch for BBB

1) Copy configs file to kernel

~/kernel$cp configs/beaglebone kernel/arch/arm/configs/beagleboneblack_defconfig

2) Copy firmware.bin to kernel

~/kernel$wget\;a=blob_plain\;f=bin/am335x-pm-firmware.bin\;hb=HEAD -O kernel/firmware/am335x-pm-firmware.bin

3) Building kernel and modules

~/kernel$ cd kernel

Build the config

~/kernel/kernel$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- beagleboneblack_defconfig

Build uImage and dtb

~/kernel/kernel$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4 uImage dtbs

Build modules

~/kernel/kernel$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4 modules

4) Install kernel modules into rootfs

~/kernel/kernel$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=$WILINK8_PARTIAL_ROOTFS_DIR modules_install

5) Build uImage-dtb

~/kernel/kernel$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage-dtb.am335x-boneblack

Build procedure for BeagleBone Black WL18XX Components

Download components and checkout appropriate commit.

$ git clone git:// && cd wl18xx && git checkout ol_r8.a7.01 -b working-branch && cd ..
$ git clone git:// && cd hostap && git checkout ol_r8.a7.01 -b working-branch && cd ..
$ git clone git:// && cd compat-wireless && git checkout ol_r8.a7.01 -b working-branch && cd ..
$ git clone git:// && cd 18xx-ti-utils && git checkout ol_r8.a7.01 -b working-branch && cd ..
$ git clone git:// && cd wl18xx_fw && git checkout ol_r8.a7.01 -b working-branch && cd ..
$ git clone git:// && cd wl12xx_target_scripts && git checkout ol_r8.a7.01 -b working-branch && cd ..
$ git clone git:// && cd compat && git checkout wl18xx_bbb_support && git reset --hard 5cc37a00cc395a59f54344b04c86aa3e322c0117 && cd ..

System Build Scripts:

The build script located in github and can be cloned as follows:

user@ubuntu:/home/usr/ti-wl18xx# mkdir utility
user@ubuntu:/home/usr/ti-wl18xx# cd utility
user@ubuntu:/home/usr/ti-wl18xx/utility#git clone git://
user@ubuntu:/home/usr/ti-wl18xx/utility#cd build-utilites/

Here's what the directory looks like:

 |-- functions
 |-- patches
 |-- scripts
 |-- setup-env
 |-- setup-env.sample


Build script Enviroment file 'setup-env.sample' file is used as base of "setup-env" that includes user specific environment variables. User should copy the setup-env.sample to setup-env and edit the variables according to user specific environment Typical file will be as follows:

# User specific environment settings
# Change 'CROSS_COMPILE=arm-none-linux-gnueabi-' to 'CROSS_COMPILE=arm-linux-gnueabi-'
export CROSS_COMPILE="arm-linux-gnueabi-"
export PATH=$PATH:/usr/bin
export WORK_SPACE=/home/user/ti-wl18xx
export KLIB_BUILD=$BUILD_DIR/kernel/kernel
# MACHINE_TYPE - The target machine type. Can have one of the following values: "am1808" ,"omap3evm" , "am335x",beaglebone black
# This is needed to build bluetooth components.
# This parameter is not relevant for ti814x board.
export MACHINE_TYPE="am335x"
export BUILD_VERSION="r8"
export ARCH="arm"
export MY_PREFIX="/usr"
export MY_SYSCONFDIR="/etc"
export MY_LOCALSTATEDIR="/var"
export CC="${CROSS_COMPILE}gcc"
export CXX="${CROSS_COMPILE}g++"
export AR="${CROSS_COMPILE}ar"
export RANLIB="${CROSS_COMPILE}ranlib"
export CFLAGS="${CFLAGS} -I${ROOTFS}${MY_PREFIX}/include"
export PKG_CONFIG_PATH="${ROOTFS}${MY_PREFIX}/lib/pkgconfig:${ROOTFS}/lib/pkgconfig"

The main settings user should provide are: ROOTFS - path to target root file system PATH - add to the PATH environment variable toolchain path (after "$PATH:"). KLIB_BUILD - Path to the kernel sources CROSS_COMPILE - the begin part of cross compiler executable name, for example "arm-none-linux-gnueabi-" WORK_SPACE - Work directory for download and build process Note: 1) setup-env file should to be placed in the same directory together with build scripts(, etc.) 2) On some Ubuntu systems,if not already installed install following packages

	~$sudo apt-get install corkscrew
	~$sudo apt-get install python-m2crypto

Build wl18xx_modules using below command

	~$./ wl18xx_modules build
	~$sudo ./ wl18xx_modules install

Building WLAN - file This script compiles one of following utilities: libnl, openssl, hostapd, wpa_supplicant,wl18xx_modules,firmware,crda,calibrator,wlconf by calling specific utility name and action.

	~$./ <utility-name> <action>

where available utility-name is:

  • libnl
  • openssl
  • iw
  • hostapd
  • wpa_supplicant
  • crda
  • ti-utils
  • wl18xx-firmware
  • compat-wireless
  • wlconf


  1. By default sources for 'openssl', 'libnl', 'crda', 'hostapd', 'iw' and 'wpa_supplicant' are exists as part of git checkout. It will be downloaded before it gets builds.
  2. For the first time, make sure you build all the components and install. Later, specific components can be build.

After building and installing all modules, check rootfs directory contains all modules which are build for wl18xx. Enter into rootfs for wl18xx modules, which is referring $WILINK8_PARTIAL_ROOTFS_DIR

root@xxxx:/home/usr#cd WILINK8_PARTIAL_ROOTFS_DIR

Here xxxx - Host Name of the Ubuntu machine Contains below top-level directories

 |-- etc
 |   `-- libnl
 |-- include
 |   `-- netlink
 |-- lib
 |   |-- modules
 |   `-- pkgconfig
 `-- usr
     |-- bin
     |-- include
     |-- lib
     |-- local
     `-- sbin

Note: At this stage, you have the sd-card pre-built image with Angstrom and BEAGLE_BONE partition created. Pre-built image can be downloaded from either

  1. or

Copying Build Files to SD card

Baseline file system image

We're going to start with a known good Angstrom image and then update/replace some of the files to add the WL18xx support.

First, you'll want to download the uSD card image from This validation used the 2013-06-20 4GB SD card image for BeagleBone Black.

Directions for writing the image to an SD card can be found here in the section where Image Writer is discussed.

Once you've flashed the baseline image to your card then you can proceed to the next steps to update the necessary files.

Updating kernel in file system

Following procedures explains on setting up rootfs (Root File System) with newly build kernel and compat-wireless modules Connect SD card with card-reader on the host machine and check whether its mounted properly. For Example: /media/Angstrom path for Angstrom partition which has the root filesystem for Angstrom Linux Flashing kernel build files Note: Following 'cp' command must be executed with 'sudo' admin privilages, since the root file system is all owned by root. Copy newly build kernel image on to SD Card with following commands. Change into sudo mode

igx@xxxx:~$sudo su

Note: Export same BUILD_DIR and WILINK8_PARTIAL_ROOTFS_DIR environment variables for admin mode.

$export BUILD_DIR=/ti-wl18xx
$export WILINK8_PARTIAL_ROOTFS_DIR=$BUILD_DIR/partial_rootfs

Change in to kernel folder

root@xxxx:/home/usr#cd $BUILD_DIR/kernel/kernel

Note: Before copying uImage on boot folder, remove softlink for uImage exists with default pre-build image (i.e rm uImage) and copy newly build uImage to sdcard '/media/Angstrom/boot' folder.

root@xxxx:/home/usr/kernel/kernel# rm -f /media/Angstrom/boot/uImage

copy uImage to sdcard

root@xxxx:/home/usr/kernel/kernel#cp arch/arm/boot/uImage /media/Angstrom/boot/

copy am335x-bone.dtb to sdcard

root@xxxx:/home/usr/kernel/kernel#cp arch/arm/boot/dts/am335x-bone.dtb /media/Angstrom/boot/

copy am335x-boneblack.dtb to sdcardcp

root@xxxx:/home/usr/kernel/kernel#cp arch/arm/boot/dts/am335x-boneblack.dtb /media/Angstrom/boot/

copy kernel modules to sdcard

root@xxxx:/home/usr/kernel/kernel#cp -rf $WILINK8_PARTIAL_ROOTFS_DIR/lib/modules/3.8.13-dirty /media/Angstrom/lib/modules/

Flashing Wl18xx build files

Enter into wl18xx modules rootfs

root@xxxx:/home/usr/kernel/kernel#cd $WILINK8_PARTIAL_ROOTFS_DIR

copy compat-wireless(wl18xx) modules to sdcard using below commands Note: To keep newly build wl18xx modules, create a separate folder "wl18xx_modules" on the target root filesystem and copy compat-wireless modules in it.

root@xxxx:/home/usr/ti-wl18xx/rootfs#mkdir -p /media/Angstrom/home/root/wl18xx_modules/
root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf lib/modules/3.8.13-00726-gda51976-dirty/updates/* /media/Angstrom/home/root/wl18xx_modules/

Finally after copy, following directories exits under 'wl18xx_modules' directory

   |-- compat
   |   `-- compat.ko
   |-- drivers
   |   `-- net
   |       `-- wireless
   |           `-- ti
   |               |-- wl18xx
   |               |   `-- wl18xx.ko
   |               `-- wlcore
   |                   |-- wlcore.ko
   |                   |-- wlcore_sdio.ko
   |                   `-- wlcore_spi.ko
   `-- net
       |-- mac80211
       |   `-- mac80211.ko
       |-- rfkill
       |   |-- rfkill-gpio.ko
       |   `-- rfkill-regulator.ko
       |-- wireless
           `-- cfg80211.ko

Copy firmware into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs# mkdir -p /media/Angstrom/lib/firmware/ti-connectivity
root@xxxx:/home/usr/ti-wl18xx/rootfs# cp -rf $BUILD_DIR/wl18xx_fw/*.bin /media/Angstrom/lib/firmware/ti-connectivity
root@xxxx:/home/usr/ti-wl18xx/rootfs# cp usr/sbin/wlconf/wl18xx-conf-default.bin /media/Angstrom/lib/firmware/ti-connectivity/wl18xx-conf.bin

Note: Cross verify once under ti-connectivity directory wl18xx-fw-2.bin should be there. Copy libnl into sdcard using below command

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf etc/libnl/* /media/Angstrom/etc/libnl

Copy libnl library files into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf lib/libnl* /media/Angstrom/lib/

Copy udev rules to SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp etc/udev/rules.d/85-regulatory.rules /media/Angstrom/etc/udev/rules.d/

Copy crda and regdbdump into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf sbin/* /media/Angstrom/sbin/

Copy crda regulatory.bin into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf usr/lib/crda /media/Angstrom/usr/lib/

Copy crda man page into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf usr/share/man/man8 /media/Angstrom/usr/share/man/

Copy iw into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp usr/sbin/iw /media/Angstrom/usr/sbin/

Copy wpa_supplicant into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp usr/local/sbin/wpa_supplicant /media/Angstrom/usr/sbin/

Copy hostapd into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf usr/local/bin/hostapd /media/Angstrom/usr/sbin/


  1. Unmount the SD card safely.
  2. Insert sdcard into beaglebone black uSD card slot.
  3. To boot the board, simply apply power to the Beaglebone black by plugging in the 5V Power Supply. If the USB cable is plugged in and the serial port is configured correctly you should see output on your serial terminal(will take 1-2 min to load). You will see the board reach u-boot, and then automatically boot into the Linux kernel,BF_EN LED also should glow on Wi-Link8 cape.
  4. When prompted for a login use root.

Testing Custom Build

After successfully boot with newly build kernel, check and make sure following files/directory are available on the target

  1. wl18xx_modules directory in /home/root : contains compat wireless modules
  2. wl18xx-fw-2.bin and wl18xx-conf.bin in /lib/firmware/ti-connectivity - TI Wilink8 Firmware files

Connect to a Wi-Fi Access-point

The following instructions will guide you how to configure the station mode and connect to non secured AP using IW commands. Connect to AP procedure - using IW commands.

First run dmesg to look at the boot log:

root@beaglebone:~# dmesg

You should see something such as this in your output:

[   13.228022] wlcore: wl18xx driver version: ol_r8.a7.01-dirty
[   13.577391] wlcore: wl18xx HW: RDL 2, 1857 MIMO, PG 2.2 (ROM 0x11)
[   13.588812] wlcore: loaded
[   13.588856] wlcore: driver version: ol_r8.a7.01-dirty
[   13.588866] wlcore: compilation time: Mon Jan 13 15:33:24 2014

Bring up the WLAN:

root@beaglebone:~# ifconfig wlan0 up

Now let's scan the AP's around in order to connect the desired one. This is done by iw command:

root@beaglebone:~# iw wlan0 scan | grep SSID
    SSID: blrAirtel
    SSID: AR4100_WPA2
    SSID: Roam_Test_WPA2
    SSID: testbbb

In order to connect to AP use the command "iw wlan0 connect " In the example the SSID is testbbb.

iw wlan0 connect testbbb

We can check the connection by invoking:

iw wlan0 link

The expected result is something like:

Connected to f8:d1:11:2c:d1:78 (on wlan0)
        SSID: testbbb
        freq: 2417
        RX: 528 bytes (8 packets)
        TX: 99 bytes (2 packets)
        signal: -32 dBm
        tx bitrate: 1.0 MBit/s
        bss flags:      short-preamble short-slot-time
        dtim period:    1
        beacon int:     100

Now configure IP address using DHCP:

root@beaglebone:~# udhcpc -i wlan0

You should see something like this:

udhcpc (v1.20.2) started
Sending discover...
Sending select for
Lease of obtained, lease time 7200
/etc/udhcpc.d/50default: Adding DNS

In order to verify the connection use ping command For example, the AP IP address is, we will invoke the following command on the beaglebone black:

root@beaglebone:~# ping

We should see the an output like:

PING ( 56(84) bytes of data.
64 bytes from icmp_req=1 ttl=64 time=18.7 ms
64 bytes from icmp_req=2 ttl=64 time=2.47 ms
64 bytes from icmp_req=3 ttl=64 time=2.10 ms
64 bytes from icmp_req=4 ttl=64 time=2.11 ms
64 bytes from icmp_req=5 ttl=64 time=2.32 ms
--- ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms
rtt min/avg/max/mdev = 2.108/5.563/18.786/6.613 ms

Pressing Ctrl+C will end the loop