Install the Toolchain

Toolchains are a collection of tools, libraries and programs that are needed to build a system for a target. Each module will have a different toolchain as the libraries and tools that are used are often dependent on the kernel/os version. The toolchain also includes all the kernel headers that are needed to build kernel objects and libraries used to enable additional hardware on your target.

While the toolchains are target/module specific, we will walk through installing toolchains as well as providing best practices to manage the toolchains as they are needed to build kernel modules, applications, and the runtime environment for your target. The Legato Application Framework does not maintain any of the toolchains but does test toolchains to ensure that they work with the Application Framework.

Warning
When switching between different models of targets or upgrading your firmware/OS verify that you have the matching toolchain installed and it is the right version of toolchain that you need to build for that target.

SWI WP Series Device Toolchain

Make sure that all old toolchain installers have been archived or deleted before you download a new toolchain.

$ cd ~/Downloads
$ mkdir old_toolchains
$ mv poky* old_toolchains

Each target maintains its own unique toolchain as the toolchain needs to be built as part of the OS distribution. Visit source.sierrawireless.com to download and install the toolchain for your target. Optionally Leaf can be used to download the Legato SDK.

Module Download Site
WPX5XX WPX5XX Firmware Download Page
WP76XX WP76XX Firmware Download Page
WP77XX WP77XX Firmware Download Page
AR Modules See your FAE to download and install the toolchain for your module

After downloading the toolchain installer copy it into your workspace for safe keeping:

$mv <toolchain> ~/workspace/firmware/<module>/.

You may also need to grant execute rights before the toolchain installer can be run:

$ cd ~/workspace/firmware/<module>/
$ chmod +x <toolchain>

Upon running the toolchain installer you will be prompted where you want to install the tools.

Enter:

/opt/swi/y17-ext-<legato version> 

When prompted, answer "Y" to proceed with the install.

$ ./poky-swi-ext-glibc-x86_64-meta-toolchain-swi-armv7a-neon-toolchain-swi-SWI9X07Y_02.18.06.00.sh
Poky (Yocto Project Reference Distro) SDK installer version 2.2.3
=================================================================
Enter target directory for SDK (default: /opt/swi/SWI9X07Y_02.18.06.00):
Extracting SDK...done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup
script e.g.
$ . /opt/swi/SWI9X07Y_02.18.06.00/environment-setup-armv7a-neon-poky-linux-gnueabi
Warning
If you need to move the location of the toolchain once it is installed, then you must uninstall and reinstall the toolchain. Moving the files after installation will break the toolchain.
If you use this SDK for builds other than a Legato build, you must source the appropriate environment setup script. This script sets the environment variables such as $CC for cross-compilation.

Run Kernel Build Scripts

Installing the toolchain also runs the kernel build scripts. This creates a hard link to the header files. So if you need to change/update the toolchain or switch to a different module you must manually run the kernel build setup script again.

Default path for WPX5XX, WP76XX and WP77XX: /opt/swi/ <toolchainVersion>/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi

Example for the WP76XX, WP77XX (Release 10):

$ export PATH=/opt/swi/SWI9X07Y_02.18.06.00/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$PATH

Change directory to: <toolchain path>="">/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/usr/src/kernel.

The default module path for the WPX5XX/WP76XX/WP77XX is /opt/swi/ <toolchainVersion>.

Example for WP76XX, WP77XX:

$ cd /opt/swi/SWI9X07Y_02.18.06.00/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/usr/src/kernel

Take ownership of the files in the directory and run the make scripts. When done return ownership to the root user.

Note
The root user does not know the path to the Legato compiler so file ownership must be temporarily transferred to yourself so that the scripts build properly and then given back when the script is completed.
$ sudo chown -R $USER .
$ ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- make scripts
$ sudo chown -R root .

You are now ready to build and configure the Legato Runtime Environment for your target device.

Raspberry Pi Toolchain

If you are building Legato AF directly on a Raspberry Pi, then no toolchain is needed and you only need to install native GCC. If you are cross-compiling the Legato AF on a Linux machine for use on a Raspberry Pi Device, then you will need to install Raspberry Pi's toolchain.

Raspberry Pi platforms (clone from the GitHub repo):

git clone https://github.com/raspberrypi/tools

Copy the /tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian directory to a shared location on your Linux Development Host.

Add /tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin to your $PATH

export PATH=$PATH:${PWD}/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
Note
The 64bit Raspberry Pi toolchain is located: /tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64

You are now ready to build and configure the Legato Runtime Environment for your target device.