Difference between revisions of "CL-SOM-iMX7: Yocto Linux: Building"

From Compulab Mediawiki
Jump to: navigation, search
(Building images)
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
 
The Yocto Project is an open-source collaboration focused on embedded Linux development.<br>
 
The Yocto Project is an open-source collaboration focused on embedded Linux development.<br>
The purpose of this article is to show how to get Yocto Image with CL-SOM-iMX7 system-on-module (SoM) support.
+
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 ==
 
== Build CL-SOM-iMX7 Yocto Image ==
Line 30: Line 33:
 
<pre>
 
<pre>
 
cd /home/development/cl-som-imx7/yocto/fsl-arm-yocto-bsp/sources
 
cd /home/development/cl-som-imx7/yocto/fsl-arm-yocto-bsp/sources
git clone https://github.com/compulab/yocto-compulab-layer.git meta-compulab
+
git clone https://github.com/compulab/yocto-compulab-layer.git source/meta-compulab
 
</pre>
 
</pre>
 
The Compulab meta-layer consists of {{filename|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.
 
The Compulab meta-layer consists of {{filename|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.
Line 44: Line 47:
 
{{parameter|MACHINE}} has to be set to {{parameter|cl-som-imx7}}. The CL-SOM-iMX7 machine configuration is found in the {{filename|sources/meta-compulab/conf/machine}} directory. <br>
 
{{parameter|MACHINE}} has to be set to {{parameter|cl-som-imx7}}. The CL-SOM-iMX7 machine configuration is found in the {{filename|sources/meta-compulab/conf/machine}} directory. <br>
 
{{parameter|DISTRO}} parameter defines the graphical backend desired. Recommended DISTRO value for CL-SOM-iMX7 is {{parameter|fsl-imx-x11}}. Available DISTRO configuration files are found in the {{filename|meta-fsl-bsp-release/imx/meta-sdk/conf/distro}} directory.
 
{{parameter|DISTRO}} parameter defines the graphical backend desired. Recommended DISTRO value for CL-SOM-iMX7 is {{parameter|fsl-imx-x11}}. Available DISTRO configuration files are found in the {{filename|meta-fsl-bsp-release/imx/meta-sdk/conf/distro}} directory.
The instructions below assume that the {{filename|fsl-imx-x11-cl-som-imx7}} directory is used for building CL-SOM-iMX7 Yocto Linux images.
+
* Create Build Environment
 
<pre>
 
<pre>
 
cd /home/development/cl-som-imx7/yocto/fsl-arm-yocto-bsp
 
cd /home/development/cl-som-imx7/yocto/fsl-arm-yocto-bsp
DISTRO=fsl-imx-x11 MACHINE=cl-som-imx7 source fsl-setup-release.sh -b fsl-imx-x11-cl-som-imx7
+
export DISTRO=fsl-imx-x11
 +
export MACHINE=cl-som-imx7
 +
source fsl-setup-release.sh -b build-${MACHINE}-${DISTRO}
 +
</pre>
 +
* Add the {{filename|meta-compulab}} location to the {{filename|conf/bblayers.conf}}
 +
<pre>
 +
[[ -f conf/bblayers.conf ]] && (sed -i '$aBBLAYERS += " ${BSPDIR}/sources/meta-compulab "' conf/bblayers.conf) || echo "Warning: Invalid Build Directory"
 +
</pre>
 +
 
 +
==== Building images ====
 +
The Yocto Project build uses the {{parameter|bitbake}} command. To build a Freescale image with a GUI please use the command below:
 +
<pre>
 +
bitbake fsl-image-gui
 
</pre>
 
</pre>
  
Line 53: Line 68:
 
[[Category:Yocto]]
 
[[Category:Yocto]]
 
[[Category:CL-SOM-iMX7]]
 
[[Category:CL-SOM-iMX7]]
 +
[[Category:IOT-GATE-iMX7]]
 +
[[Category:SBC-IOT-iMX7]]

Revision as of 08:15, 5 April 2017

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.

cd /home/development/cl-som-imx7/yocto/fsl-arm-yocto-bsp/sources
git clone https://github.com/compulab/yocto-compulab-layer.git source/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
export DISTRO=fsl-imx-x11
export MACHINE=cl-som-imx7
source fsl-setup-release.sh -b build-${MACHINE}-${DISTRO}
  • Add the meta-compulab location to the conf/bblayers.conf
[[ -f conf/bblayers.conf ]] && (sed -i '$aBBLAYERS += " ${BSPDIR}/sources/meta-compulab "' conf/bblayers.conf) || echo "Warning: Invalid Build Directory"

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