CL-SOM-iMX7: Yocto Linux: Building
Overview
The Yocto Project is an open-source collaboration focused on embedded Linux development.
The purpose of this article is to show how to get Yocto Image with CL-SOM-iMX7 system-on-module (SoM) support, which includes following derived devices built around the CL-SOM-iMX7 SoM:
- SBC-iMX7 Single Board Computer
- SBC-IOT-iMX7 Internet of Things Single Board Computer
- IOT-GATE-iMX7 Internet of Things Gateway
Build CL-SOM-iMX7 Yocto Image
Yocto Environment Setup
This section describes the Yocto environment setup and build procedure.
Host Setup
This subsection describes a Linux Host Machine setup required for building images for an NXP i.MX based boards using the Yocto Project build environment.
General Requirements
To get the Yocto Project expected behavior in a Linux Host Machine, the packages and utilities described below must be installed. An important consideration is the hard disk space required in the host machine. For example, when building on a machine running Ubuntu, the minimum hard disk space required is about 50 GB for the X11 backend. It is recommended that at least 120 GB be provided, which is enough to compile any backend. The recommended minimum Ubuntu version is 14.04 but builds for Jethro works on 12.04 or later. Earlier versions may cause the Yocto Project build setup to fail, because it requires python versions only available starting with Ubuntu 12.04.
Host Packages
A Freescale Yocto Project Community BSP build requires that some packages be installed for the build that are documented under the Yocto Project. You can go to Yocto Project Reference Manual and check for the packages that must be installed for your build machine.
- Essential Yocto Project host packages:
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat
- i.MX layers host packages for Ubuntu 12.04 or 14.04 host setup are:
$ sudo apt-get install libsdl1.2-dev xterm sed cvs subversion coreutils texi2html \ docbook-utils python-pysqlite2 help2man make gcc g++ desktop-file-utils \ libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff curl lzop asciidoc
- i.MX layers host packages for a Ubuntu 12.04 host setup only are:
$ sudo apt-get install uboot-mkimage
- i.MX layers host packages for a Ubuntu 14.04 host setup only are:
$ sudo apt-get install u-boot-tools
Setting up the repo utility
This section describes installing and setting up a repo tool.
repo is a tool built on top of git that makes it easier to manage projects that contain multiple repositories, which do not need to be on the same server.
repo is not meant to replace git, but it complements very well the layered nature of the Android or the Yocto Project, making it easier to work with them.
To install the repo utility, perform these steps:
- Create a bin folder in the home directory (not required if the ~/bin folder already exists):
$ mkdir ~/bin
- Download the repo utility, setup permissions:
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo
- Add the following line to the .bashrc file to ensure that the ~/bin folder is in your PATH variable.
$ export PATH=~/bin:$PATH
Yocto Project Setup
The instructions below assume that the /home/development/cl-som-imx7/yocto directory has been created for CL-SOM-iMX7 Yocto development.
Getting NXP i.MX Yocto Project Community BSP sources
First, get NXP Community Yocto Project BSP for i.MX based boards:
cd /home/development/cl-som-imx7/yocto mkdir fsl-arm-yocto-bsp cd fsl-arm-yocto-bsp repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-4.1-krogoth repo sync
Getting Compulab i.MX support meta layer
Next step is getting Compulab meta-layer.
git clone https://github.com/compulab/yocto-compulab-layer.git sources/meta-compulab
The Compulab meta-layer consists of meta-compulab directory, that provides support for CL-SOM-iMX7 and other Compulab i.MX based machines and contains recipes for U-boot and Linux kernel.
Image Build
This section provides the detailed information about building CL-SOM-iMX7 images.
Setting up build configuration
The NXP Yocto Project BSP Release directory contains a sources directory, which contains recipes used to build, one or more build directories, and a set of scripts used to set up the environment. The recommended script is fsl-setup-release.sh, that simplifies the setup for i.MX machines. To use the script, the name of the specific machine to be built for needs to be specified as well as the graphical backend desired. The script sets up a directory and the configuration files for the specified machine and backend:
DISTRO=<distro name> MACHINE=<machine name> source fsl-setup-release.sh -b <build dir>
MACHINE has to be set to cl-som-imx7. The CL-SOM-iMX7 machine configuration is found in the sources/meta-compulab/conf/machine directory.
DISTRO parameter defines the graphical backend desired. Recommended DISTRO value for CL-SOM-iMX7 is fsl-imx-x11. Available DISTRO configuration files are found in the meta-fsl-bsp-release/imx/meta-sdk/conf/distro directory.
- Create Build Environment
cd /home/development/cl-som-imx7/yocto/fsl-arm-yocto-bsp
- Select the required machine:
export MACHINE=cl-som-imx7
- Select the required distro:
export DISTRO=fsl-imx-x11
- Issue NXP Setup Script:
source fsl-setup-release.sh -b build-${MACHINE}-${DISTRO}
- Issue Compulab Setup Script:
source ../sources/meta-compulab/bb-tools/setup-compulab-env
Building images
The Yocto Project build uses the bitbake command. To build a Freescale image with a GUI please use the command below:
bitbake fsl-image-gui