4: Prepare Your Dev Machine For Legato Development

In this chapter, you will prepare your dev machine for Legato application development by setting up the development environment with required applications and packages.

Important:   To install and use the development environment, your dev machine must meet the requirements in Table 1-1.

4.1 Prepare Dev Machine For Application Development

After preparing your mangOH Red hardware in Set Up Your mangOH Red, you can prepare your dev machine for application development:

Important:   Download, installation and use of Legato Application Framework and Platform Services is subject to the Legato License and Open Source Licenses. (Note: These links automatically download the licenses as PDF files.)

4.2 Build and Install the Development Environment

In this section you will build and install the environment to develop applications for the CF3 module used in your mangOH Red. The environment includes:

Legato toolchain  Tools and libraries used to build the Legato Platform for your CF3 module. The Legato toolchain is module-specific; you must make sure you install the toolchain designed for your module.

mangOH Red platform  Drivers for on-board components, and a basic device-to-cloud application.

To build and install the development environment on your dev machine:

1.Open a terminal window.

2.Make sure you are running Ubuntu 16.04.0 or higher (these instructions will not work on older versions)  display your Ubuntu version:

$ lsb_release -d 



3.Check whether your dev machine is 32-bit or 64-bit:

$ uname -m 



The dev machine’s hardware type appears   e.g. "x86_64" is a 64-bit system.

4.Optionally, make sure your Ubuntu release is up-to-date:

$ sudo apt-get update       (Check to see which packages need to be updated)

$ sudo apt-get upgrade      (Installs the latest updates)



5.Install required packages (’dependencies’) for the Legato AF and the mangOH Red platform:

$ sudo apt-get install -y \
cmake \
git \
repo \
python-jinja2 \

Note:   The ’\’ at the ends of the lines tells the system that the command continues on the next line. When you run this command (and any others in this guide that use the ’\’), you can copy and paste the full command (including ’\’ characters) in your terminal window. If you type the command manually all on one line, do not type the ’\’ characters.



Tip:   The output you see when you run some commands in the terminal window on the Linux system or the mangOH Red may differ from the examples shown. To check if a command succeeded or failed, enter the following command:
   $ echo $?
If the value returned is ’0’, the command succeeded. If it is any other value, the command failed.

6.Confirm the CF3 module type that is in your mangOH Red:

a.Connect to the mangOH Red using your terminal emulator:

$ ssh root@ 

b.The following message appears if you are using your CF3 module for the first time (modules are shipped without a password).



For now, type 3 and press Enter, then type Y and press Enter to be reminded the next time you connect. (During this tutorial, do this each time you open an SSH connection to the mangOH Red.)

Note:   After completing this tutorial, you should select an appropriate login authentication method (ssh keys or password) from this menu  see legato.io/legato-docs/latest/basicTarget.html for details.

c.Display information about the CF3 module and note your module type (Device) and Firmware Version:

# cm info 



d.Disconnect from the mangOH Red:

# exit 

7.Install the Legato toolchain (SDK):

a.Go to your CF3 module’s device page at http://source.sierrawireless.com. (Select AirPrime > WP Series > (your module type).

b.If you already have a Source account, log in.

Otherwise, register for a Source account, which is required to download files.

c.In the Software Download section, click Firmware.

d.In a later step (in the next chapter), you will do a firmware update to make sure your module is up to date  download the firmware file now.

In the Firmware Update Instructions table’s Instructions for Legato CLI Users (Linux) row, click the Generic firmware link to download the file. (If there is more than one Generic, click the Generic GCF link.)



e.In the Release Content section, click the firmware components link.



f.In the Rebuild Linux Distribution section, click the toolchain link for your system (32-bit or 64-bit) to download the Legato toolchain.



g.Make a note of the Legato Distro Source version.

h.Make the downloaded toolchain file executable:

$ chmod a+x ~/Downloads/poky*.sh 

i.Install the toolchain (replace <toolchain> with the downloaded file (e.g. poky-swi-ext-glibc-x86_64-meta-toolchain-swi-ext-armv7a-neon-toolchain-swi-ext-2.2.2.sh):

$ sudo ~/Downloads/<toolchain> 



j.When prompted for the installation directory, append the version number from Step g to the default directory name:

For example, "/opt/swi/y22-ext-SWI9X07Y_02.14.04.00".



k.Create a symlink (symbolic link) that points to the toolchain installation directory. The link is used by the Legato makefile and must include the module type in the name (e.g. wp750x, wp76xx, wp85, wp77xx):. Replace <toolchain_install_dir> and <symlink> as shown in the example below:

$ cd /opt/swi && sudo ln -f -s <toolchain_install_dir> <symlink> 



l.If the module is a WP7502, WP7504, or WP8548 that has Release 15 firmware, additional scripts must be built:

(Note: Replace "y17-ext-wpXXXX" in these commands with the <symlink> from the previous step.)

$ export \

$ cd \

$ sudo chown -R $USER . 

$ ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- make scripts 

$ sudo chown -R root . 

8.To support multiple module types if needed (e.g. wp750x, wp85, wp76xx, wp77xx), repeat Step 7 for each required type.


Now that the Legato development environment is installed, you can Prepare Your mangOH Red For DevelopmentPrepare Your mangOH Red For Development.