Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

WL18xx System Build Scripts

From Texas Instruments Wiki
Jump to: navigation, search

Introduction

A short introduction to our build scripts and an explanation on how they operate.
We will refer to the System Build Scripts as build-scripts from now on.

Overview

  • The build scripts are an easy way for the user to build, update and eventually integrate WL18xx modules.
  • This page assumes the proper DTB file has been installed.
  • To build the WL18xx modules, it is required to have a pre complied Linux kernel (more information can be found here)
  • The build script will work with any Linux kernel version > 3.12, using standard backports methodology.


Capabilities

For the most part, the build scripts can :

  • Build WL18xx modules that are required for the WL18xx to operate.
  • Build additional applications such as hostap and wpa_supplicant for example.
  • Integrate scripts, tools and firmware into the file system.
  • Provide options to choose what goes into the file system (e.g build components seperatly).
  • Get the latest software release and build it.

Operation

The build scripts contain directories that are managed by git.
When a new version is out, all git repositories will have the version tag (e.g "R8.7_SP3")

After initializing the build scripts, a directory called src is created. This directory contains all of the source code for the relevant components:

backports a tool that allows for the usage of different kernel versions as stated before.
driver this directory contains the kernel source code that the latest driver is based on. 
kernel this directory contains a reference Processor SDK kernel, and in most cases can be ignored.
hostap source code for wpa_supplicant and hostapd.
iw source code for iw tool.
ti_utils different utilities supplied by TI.
firmware will be downloaded according to the tag specified.
scripts an assortment of scripts to operate the WL18xx.

There are more directories (e.g libnl, openssl etc.), some of them are prerequisites for wpa_supplicant and some contain files that will be copied to the file system after compilation.

When using the build scripts, the user has basically two options: build or update and build.

  • build: - will go over the directories that were specified earlier, and build their contents.

NoteNote: In this mode, the script does not check-out any directories, it just builds the branches that are currently checked-out.

  • update: - updating requires tag parameter (R8.7_SP3 for example).

The build script will check-out all of the relevant directories to the specified tag (i.e version) and build them.


Outputs

Effectively, the outputs of the build scripts are two directories:

  • fs - installation directory for all of the compiled componenets.
  • outputs - will contain a compressed version of the fs directory content in a file called fs_skeleton.tbz2.

Extracting fs_skeleton.tbz2 onto the devices root directory will install the WL18xx modules, firmware, wpa_supplicant etc. on the device.
NoteNote: Remember, the kernel itself must be supplied by the user (TI SDK or custom).


Build Guide

Quick Overview

The script does the following:

  • Clones the relevant SW repositories
  • Builds WL18xx components
  • Installs components, scripts and utilities to the filesystem

The script will check for updates on every run. If an update exists it will notify the user.

Step 1: Download the Build Scripts

The build scripts are located in:
git://git.ti.com/wilink8-wlan/build-utilites.git

Clone the repository:

For example, if we continue the process started here then we will do all the WL18xx build inside a directory located at ~/wl8-build.

user@ubuntu:~/ti-sdk-am335x-evm-07.00.00.00$ cd ~/wl8-build/
user@ubuntu:~/wl8-build$ git clone git://git.ti.com/wilink8-wlan/build-utilites.git
Cloning into 'build-utilites'...
remote: Counting objects: 338, done.
remote: Compressing objects: 100% (261/261), done.
remote: Total 338 (delta 186), reused 152 (delta 72)
Receiving objects: 100% (338/338), 101.31 KiB | 0 bytes/s, done.
Resolving deltas: 100% (186/186), done.
Checking connectivity... done.
user@ubuntu:~/wl8-build$ cd build-utilites/
user@ubuntu:~/wl8-build/build-utilites$ ls
build_wl18xx.sh  configuration.sh  setup-env.sample
configuration    README            sudo_build_wl18xx.sh


Step 2: Create setup-env 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.

The user should edit the setup-env file to point to the correct directories where the kernel and toolchain are located.
Instructions on how to compile a kernel from a TI SDK can be found here.

Here is a typical example that would work using AM335x EVM with SDK 7.00:

#                            \\\//
#                           -(o o)-
#========================oOO==(_)==OOo=======================
# This file contains the exports needed for automating the
# build process of WLAN components.
# Place this file in the same directory with wl18xx_build.sh
# build scripts. No need to run 'source setup-env', the build
# scripts will perfom it internaly.
#===========================================================
# User specific environment settings - use full PATH

# if DEFAULT toolchain path is set toolchain will be downloaded to ./toolchain.
export TOOLCHAIN_PATH=~/ti-sdk-am335x-evm-07.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin
# if DEAFULT path to root filesystem is set ./fs folder will be used.
export ROOTFS=~/wl8-build/fs
#if DEFAULT kernel path is set - kernel will be downloaded (set branch to match kernel version)
export KERNEL_PATH=~/ti-sdk-am335x-evm-07.00.00.00/board-support/linux-3.12.10-ti2013.12.01

# if KERNEL_VARIANT below is set the build script will look for kernel specific
# patches under the patches directory:
# - patches under the pathces/driver_patches/$KERNEL_VARIANT directory would be
#   applied during "modules" build.
# - patches under the patches/kernel_patches/$/$KERNEL_VARIANT directory would
#   be applied to the kernel pointed by KERNEL_PATH in case the "patch_kernel"
#   command is used.
#   Note: the kernel is not built automatically after the patches are applied
export KERNEL_VARIANT=DEFAULT

export CROSS_COMPILE=arm-linux-gnueabihf-
export ARCH=arm
[ "$TOOLCHAIN_PATH" != "DEFAULT" ] && export PATH=$TOOLCHAIN_PATH:$PATH

setup-env file should to be placed in the same directory together with build scripts (wl18xx_build.sh,wl18xx_build_bt.sh etc.).

Step 3: Download the source

NoteNote: Don't use the "sudo" version of the script for this step or you'll end up with directories owned by root instead of user.

user@ubuntu:~/wl8-build/build-utilites$ ./build_wl18xx.sh init

This step takes a very long time (particularly the cloning of "driver"). Future updates will be very fast.


Step 4: Build & Update

The release notes for a given release will specify a tag name. For example, R8.7_SP3 is the latest as of this writing.

To checkout that release, build it, and install to the file system you would use the following command (assuming root privileges required for file system access):

user@ubuntu:~/wl8-build/build-utilites$ ./build_wl18xx.sh update R8.7_SP3


Step 5: Install

Now that we have compiled a kernel and built the required wireless modules we need to install everything on our device.

We now have 2 files that we need:

zImage - located in <SDK directory>/board-support/Linux-xyz/arch/arm/boot/zImage
 
A compressed file system - located in <build-utilities>/outputs/fs_skeleton.tbz2

NoteNote: If the fs_skeleton.tbz2 file is not present, try adjusting the permissions of the files present in the build-utilities directory and go back to Step 3 to download the source again.

At this point we need to copy the files to the device:

  • Copy the fs_skeleton.tbz2 file into the root directory e.g /
  • Copy the zImage file into /boot directory.

Enter the following commands:

cd /
tar -xvf fs_skeleton.tbz2
sync
reboot

This will effectively install the kernel modules required for the WiLink8 to operate properly.


Step 6: Configure The WLAN Device

Once you boot your board for the first time you are required to use a script to configure the chip appropriately.
The script is installed, as part of the release, in the target filesystem in /usr/sbin/wlconf.  Download Script
For more information please refer to  wlconf_Overview


Advanced Build Options

the KERNEL_VARIANT mechanism

Some kernels require certain patches to be applied on top of them.

This is usually in the case of:

  • A kernel that is lacking device tree support for reading wilink8 platform data
  • Bug fixes that have been done to internal kernel drivers that wilink8 is using (such as mmc, sdio, ti_st etc)

For such kernels that we have worked with and have a known list of patches for them they are provided with the build script. These patches are located inside the patches/kernel_patches/'KERNEL VARIANT' directory

When your setup_env has the KERNEL_VARIANT variable set for example:

...
export KERNEL_VARIANT=imx-3.14.28
...

and you use the command:

./build_wl18xx.sh patch_kernel

The build script will look for kernel_patches available for this KERNEL_VARIANT and if such exist they will be applied to the kernel pointed by the KERNEL_PATH variable in your setup-env file<

Note: after applying the patches the kernel will not be built automatically and the user has to build it prior to using the build script for doing a full or modules build.


KERNEL_VARIANT and drivers specific patches

building the modules with some kernels, mainly ones that are not "valilla" kernels and may have some patches/fixes either back ported from upstream or have other fixes may fail. For such known kernel when your setup_env has the KERNEL_VARIANT variable set and patches are available for this KERNEL_VARIANT under patches/driver_patches/'KERNEL VARIANT' directory, those patches will be applied to the wilink8 drivers during the modules build process.

Clean, Build, and Install a Specific Component

If you only wish to clean, build, and install one specific component rather than everything, the script can be invoked as:

./sudo_build_wl18xx.sh <module>

The above assumes you need root permission to install into the file system. You can simply use the build_wl18xx.sh script if that is not necessary. For the above <module> can be any of:

  • hostapd
  • wpa_supplicant
  • modules
  • kernel (*)
  • kernel_modules (*)
  • utils
  • iw
  • openssl
  • libnl
  • crda
  • uim
  • bt-firmware

(*) The kernel & kernel_modules options are valid only if DEFAULT was configured in the setup-env file.


Install Firmware or Scripts

To install the firmware to the file system you would execute:

./sudo_build_wl18xx.sh firmware

To install the scripts to the file system you would execute:

./sudo_build_wl18xx.sh scripts

Update to Specific Tag and Build

./sudo_build_wl18xx.sh update R8.7_SP3



Troubleshoot

Q: Driver isn't loaded properly and I get the following: "wlcore: ERROR configuration binary file size is wrong..."
A: By default the build script does not installs the default wl18xx-conf-default.bin from /usr/sbin/wlconf to /lib/firmware/ti-connectivity.
This is because we do not want to override the existing one with the user configuration.
Any change in the file size (mostly due to version changes) will fail the driver from loading.
Please make sure that you use the default file from the build script and make your changes on top of it.