Adding the WF111 Driver to the i.MX6 Yocto BSP

Document created by gusarambula Employee on Apr 3, 2017
Version 1Show Document
  • View in full screen mode

Introduction

 

This is a brief guide showing how to integrate the driver for the WF111 module to the i.MX6 BSP Release. In this case the WF111 driver is available on a repository and it’s in accordance with the Yocto Project, which allows to easily customize a linux distribution for your board.

 

Requirements

WF111 Documentation – Silicon Labs have made a great job of documenting the steps to add the WF111 driver to a Linux distribution and have created Application Note 996 (link below), which we will use as reference.

http://www.silabs.com/documents/login/application-notes/AN996.pdf

 

WF111 Driver - We will also be using the Yocto layer included on the following repository:

https://github.com/engicam-stable/meta-engicam

 

i.MX6 3.14.52 BSP Release – In out scenario the WF111 layer that will be imported includes a driver that it’s compatible with Linux Kernel 2.6.24 up to 4.1., which it’s important to keep in mind.

 

Installing the 3.14.52 BSP Release

First, setup the 3.14.52 BSP as described on the i.MX Yocto Project User’s Guide.

 

Adding the WF111 Driver Layer

Clone the WF111 Driver Layer to your sources folder inside the BSP Release directory. Since the 3.14.52 BSP Release is based on Fido we will clone the Fido branch of the driver repository.

$ cd <BSP_RELEASE_DIR>/sources
$ git clone https://github.com/engicam-stable/meta-engicam -b fido

 

 Once the layer is cloned you would need to add the new later editing the bblayers.conf file located the following path:

<BSP_RELEASE_DIR>/<BUILD_DIR>/conf/bblayers.conf

By adding the following line to add the new layer.

 

BBLAYERS += " ${BSPDIR}/sources/meta-engicam "

 

This should make the wf111-driver available through bitbake since bitbake will now look into this layer for all available recipes.

You can then add the driver to your image by adding the following line to the <BUILD_DIR>/conf/local.conf

 

IMAGE_INSTALL_append += "wf111-driver"

 

Or you may create a new image recipe that includes the wf111-driver package. However, there are certain kernel options that must be enabled for the driver to work.

 

Creating an append to configure the kernel options

Before we can bake an image with the WF111 driver we would need to edit the kernel options as mentioned on Silabs AN996. The following kernel options must be enabled:

 

CONFIG_WIRELESS_EXT

CONFIG_MODULES

CONFIG_FW_LOADER

 

We would need to add the CONFIG_WIRELESS_EXT as the other two options are enabled on the BSP by default.

 

This involves adding an addendum to the kernel recipe to change its configuration. You may either add this append to any layer. The best way to handle it would be using a new layer for all your customization. You can find how to create a new layer on the following document:

https://community.nxp.com/docs/DOC-331917

 

We’ll use a new layer called meta-newlayer for this example. It’s important that this layer has a high priority so the changes from the bbappend are not overridden.

 

The following alternative was suggested by Chris Hossack on the following thread:

https://community.nxp.com/thread/376369

 

First, run the menuconfig tool on the bitbake environment:

bitbake linux-imx -c menuconfig

Enable the necessary options:

 

Networking Support > Wireless > cfg80211 wireless extensions compatibility

 

 

Save the configuration and exit. Then run the following bitbake command, which will create a config fragment file that contains the changed made to the default kernel options.

 

 

bitbake linux-imx -c diffconfig

 

We’ll make an append file that adds the required options.

 Content of the config fragment:

 

CONFIG_WIRELESS_EXT=y
CONFIG_WEXT_CORE=y
CONFIG_WEXT_PROC=y
CONFIG_WEXT_SPY=y
CONFIG_WEXT_PRIV=y
CONFIG_CFG80211_WEXT=y
CONFIG_LIB80211=y
CONFIG_LIB80211_CRYPT_WEP=y
CONFIG_LIB80211_CRYPT_CCMP=y
CONFIG_LIB80211_CRYPT_TKIP=y
# CONFIG_LIB80211_DEBUG is not set
CONFIG_HOSTAP=y
# CONFIG_HOSTAP_FIRMWARE is not set

 

 

 Since we are appending the kernel layer we need to add the addendum on the same path as that of the original kernel recipe but within our layer and create the append file there. Also add the WF111.cfg file to the linux-imx directory:

 

We would need to copy (and you may rename it as well) to the folder where are will be creating the append recipe for the kernel.

 

Copy:

 <BSP_RELEASE>/<BUILD_DIR>/tmp/work/<MACHINE>-poky-Linux-gnueabi/linux-imx/<KERNEL_VERSION>/fragment.cfg

To:

<BSP_RELEASE>/sources/meta-newlayer/recipes-kernel/linux/linux-imx/WF111.cfg

You can do so suing the following command:

 

cp <BSP_RELEASE>/<BUILD_DIR>/tmp/work/<MACHINE>-poky-Linux-gnueabi/linux-imx/<KERNEL_VERSION>/fragment.cfg <BSP_RELEASE>/sources/meta-newlayer/recipes-kernel/linux/linux-imx/WF111.cfg

 

(Please note that the file was renamed for ease, but you may use any name for the config fragment)

 

We need to create the bbappend file on the following path (as it must be the same relative path as the original recipe it is appending)

<BSP_RELEASE>/sources/meta-newlayer/recipes-kernel/linux/linux-imx_3.14.52.bbappend

 

The linux-imx_3.14.52.bbappend file would contain the following:

 

SRC_URI += "file://WF111.cfg"
 do_configure_append() {
         #this is run from
        #./tmp/work/<MACHINE>-poky-linux-gnueabi/linux-imx/3.14.52-r0/git
         cat ../*.cfg >> ${B}/.config
 }

 

   After creating this recipe you should be able to bake any image from the BSP and see the driver there. I tested with the core-minimal-image and found that the files were indeed added to /lib/firmware.

$ bitbake core-image-minimal 
2 people found this helpful

Attachments

    Outcomes