Yocto Build Guidline BSP7

From WIKI SECO

Introduction

This guideline provides instructions to setup and build Yocto 2.4(Rocko) for SECO boards only with SECO BSP. The guideline is not valid using the community BSP.

Host Setup

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 is provided, which is enough to compile any backend.

The recommended minimum Ubuntu version is 14.04 but builds for Rocko 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. See The Yocto Project reference manual for more information.

Ubuntu Distro release Supported/Unsupported
Ubuntu Release 12.04 (precise) Supported
Ubuntu Release 14.04 (Trusty) Supported
Ubuntu Release 16.04 (Xenial) Supported *
Ubutnu Release 18.04 (Bionic) supported *

Note:Ubuntu 16.04 users have commented on errors during build for SDL. To fix this comment out in local.conf the following lines as such adding # character

#PACKAGECONFIG_append_pn-qemu-native = " sdl"
#PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"

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 Quick Start 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 libsdl1.2-dev

i.MX layers host packages for a Ubuntu 12.04,14.04,16.04 host setup:

$ 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:

$ sudo apt-get install uboot-mkimage

i.MX layers host packages for a Ubuntu 14.04,16.04 host setup only are:

$ sudo apt-get install u-boot-tools

The configuration tool uses the default version of grep that is on your build machine. If there is a different version of grep in your path, it may cause builds to fail. One workaround is to rename the special version to something not containing "grep".

Setting up the repo utility

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 complements very well the layered nature of the Yocto Project, making it easier for customers to add their own layers to the BSP.

To install the “repo” utility, perform these steps:

1. Create a bin folder in the home directory.

$ mkdir ~/bin (this step may not be needed if the bin folder already exists)
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

2. 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 following example shows how to download the Freescale Yocto Project Community BSP recipe layers. Exit from the root and create a home directory For example, a directory called fsl-release-bsp is created for the project.

$ mkdir ~/fsl-release-bsp
$ cd ~/fsl-release-bsp
$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"
$ git config --list
$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-rocko -m imx-4.9.88-2.0.0_ga.xml
$ repo sync -j8
$ cd sources
$ git clone https://git.seco.com/arm/nxp/imx6/bsp7/release/meta-seco-bsp-release-bsp7-rel.git
$ cp meta-seco-bsp-release-bsp7-rel/seco-setup-release.sh ../
$ cp meta-seco-bsp-release-bsp7-rel/seco-yocto-configurator.sh ../
$ cd ..

when this sync is completed , you can launch the seco-yocto-configurator.sh script to compile the yocto image for respective boards like uQSEVEN-962,SBC-A62.

Please Refer the Configurations_and_build section to compile the yocto Image for your board accordingly.

Choosing a Freescale Yocto Project image

The Yocto Project provides some images which are available on different layers. Poky provides some images, meta-fsl-arm and meta-fsl-demos provide others, and additional image recipes are provided in the meta-fsl-bsp-release layer. The following table lists various key images, their contents, and the layers that provide the image recipes.

Image Name Target Provided By Layer
core-image-minimal A small image that only allows a device to boot. poky
core-image-base A console-only image that fully supports the target device hardware. poky
core-image-sato An image with Sato, a mobile environment and visual style for mobile devices. The image supports X11 with a Sato theme, Pimlico applications. It contains a terminal, an editor and a file manager. poky
fsl-image-machine-test An FSL Community i.MX core image with console environment - no GUI interface. meta-freescale-distro
fsl-image-validation-imx Builds an i.MX image with a GUI without any Qt content. meta-fsl-bsp-release/imx/meta-sdk
fsl-image-qt5-validation-imx Builds an opensource Qt 5 image. These images are only supported for i.MX SoC with hardware graphics. meta-fsl-bsp-release/imx/meta-sdk

Configurations and build

The following chapters describes the manual steps and automatic steps which you have to follow for configure and build yocto manually as well automatically.

Automatic

The Seco Yocto Project provided a tools called "seco-yocto-configurator.sh" that you can launch from command line in this way:

$ ./seco-yocto-configurator.sh -c

Once you entered the command, the configuration dialogue will be appear,

800px]

Now, you have to configure the hardware requirements accordingly. The requirements to set the correct configuration which you are having.

>>> DDR Size  --> Select the DDR size tab and  There is only one option to set the RAM size because One Default DRAM option to act as all size for your seco hardware.
>>> Board Type  --> Then click the board type tab and  choose the board which board you using.
>>> CPU type  --> Click the CPU type and there is only one option for all cpu type (Q/D,DL,S)
>>> Environment device --> Go to the environment device and select what device you going to use.
>>> Yocto build directory  --> This device contains some specific final image of the board like Uboot,Linux_kernel and File system.
>>> Yocto backend option  --> Select the tab and set the back end option for your requirements.
>>> Yocto image type  --> Go to the tab and accordingly click the image type which you are going to use.

Once you done the configure then press the exit tab ,the dialogue box will appear and choose the option Yes with compilation.Once you compiled successfully you can get the whole Yocto image,if you are getting error you find it and clear the error then do the steps again.

Manual

The following section will describes the manual steps that you have to follow for configure and build Yocto manually.

In the meta-fsl-bsp-release layer, Freescale provides new or updated machine configurations that overlay the meta-fsl-arm machine configurations. These files are copied into the meta-fsl-arm/conf/machine directory by the fsl-setup-release.sh script.

Note: Before using the setup-environment we have to run the seco-yocto-configurator.sh script for required seco board that will add the machine definition under the meta-seco-bsp-release-bsp7-rel/conf/machine.

The following are all the machine configuration files that can be selected:

$ source setup-environment

Usage: source setup-environment <build-dir>

<build-dir>: specifies the build directory location (required).

If undefined, this script will set as $MACHINE to 'imx6qsabresd'.

Use the machine configuration for the board that is being used and specify the graphical backend desired.

The backend can be fsl-imx-x11, fsl-imx-fb (Frame Buffer), fsl-imx-wayland or fsl-imx-xwayland. Note that DirectFB is no longer supported.

Freescale uses this to build a common image with all the device trees for i.MX 6Quad, 6DualLite, and Solo (not SoloLite) in one image for testing. Do not use this image for a real build.

The command below is used to set up a directory and configuration files for the specified board and backend. After this step,

the build environment is initialized and configured for building an image.

800px]
$ DISTRO=<backend_option> MACHINE=<machine name> source seco-setup-release.sh -b <build dir>

The EULA must be accepted the first time. After that, the acceptance is logged and EULA acceptance is not required again.

MACHINE= <machine configuration name> is the machine name which points to the configuration file for e.g in this case 'seco-imx6-a62'.The setup script checks for a valid machine before doing manual compilation it's necessary to do run the seco-yocto-configurator.sh script , so only it will add the required machine in the setup environment. The i.MX machine files are provided in meta-fsl-arm/conf/machine and meta-fsl-bsp-release/imx/meta-fsl-arm/conf/machine.The MACHINE configuration can also be changed in <build_dir>/conf/local.conf.

The following is a part of a local.conf created from the setup-environment script:

MACHINE ??= 'imx6qdl-seco_sbc_a62'

DISTRO ?= 'fsl-imx-x11'

ACCEPT_FSL_EULA = "1"

The seco-setup-release.sh script integrates the Yocto Project release layer into the Yocto Project build by inserting the layer into the <build dir>/conf/bblayers.conf file.

This setup script has the following optional parameters:

*-b sets the build directory.
-b <build dir >
* <backend_option> sets the graphical back end for frame buffer image.
* fsl-imx-fb
* fsl-imx-wayland
* fsl-imx-xwayland
* fsl-imx-x11

ACCEPT_FSL_EULA in the local.conf file indicates that you have accepted the conditions of the EULA.

Build Image

The Yocto Project build uses the bitbake command. For example, bitbake <component> builds the named component.

Each component build has multiple tasks, such as fetching, configuration, compilation, packaging, and deploying to the target rootfs.

The bitbake image build gathers all the components required by the image and build in order of the dependency per task.

The first build is the toolchain along with the tools required for the components to build.

The following command is an example on how to build an image:

$ bitbake core-image-minimal

Locating the images and installing to a microSD card

Once the image is built successfully, there are several target images that are built by default. One of these is an image suitable for loading directly into an SD card. It contains all of the required binaries (bootloader, kernel, filesystem) in a preformatted binary image.

You can find the image at:

build/tmp/deploy/images/<MACHINE>/core-image-minimal-<MACHINE>.sdcard

The .sdcard image can be directly copied to an SD card with the dd command:

$ sudo dd if=tmp/deploy/images/<MACHINE>/core-image-minimal-<MACHINE>.sdcard of=/dev/sd<N> bs=1MB conv=fsync

NOTE: <MACHINE> in the above corresponds to the MACHINE name provided to bitbake (e.g. seco-imx6-a62, seco-imx6-uqseven). "N" in the above command is the letter assigned to the SD card. This will vary depending on your host machine configuration.

Adding meta-java layer

The java layer provides recipes related to java. Most layers are registered at openembedded.org

For meta-java layer, we have to refer the link to clone the source using below command to the yocto source.

 
git clone --no-checkout http://git.yoctoproject.org/git/meta-java

Example: Here you need to find the branch which Yocto versionyou are using and the same java branch version to clone the layer.

 
http://git.yoctoproject.org/cgit/cgit.cgi/meta-java

Note:Then find the branch, If you are in Yocto Release L4.9.88_2.0.0-ga is released for Yocto Project 2.4 (Rocko). So you need to clone the meta-java layer in the below,

 
git clone -b rocko http://git.yoctoproject.org/git/meta-java

eg:Then Rocko meta-java layer is ready to use

After the cloning source need to added java layer to build/conf/bblayers.conf :

 
BBLAYERS += " ${BSPDIR}/sources/meta-java "

And need to be provide the package in local.conf as per java versions,Here with providing the example of building openjdk-7 as follow the below configuration to build.

 
# [JDK]
# Possible provider: cacao-initial-native and jamvm-initial-native
PREFERRED_PROVIDER_virtual/java-initial-native = "cacao-initial-native"
# Possible provider: cacao-native and jamvm-native
PREFERRED_PROVIDER_virtual/java-native = "jamvm-native"
# Optional since there is only one provider for now
PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"

IMAGE_INSTALL += "openjdk-7-jre \
                        jamvm \
"

then we add the local.conf, then we can build the yocto as following below,

 
mathan@mathan:~/fsl-release-rocko$ MACHINE=imx6qdl-seco_sbc_a62: bitbake openjdk-7

Once get build yocto, you can find the Java file in usr/bin/java..

Eg: As result expected

 
root@imx6qdl-seco_sbc_a62:~# java -version
java version "1.7.0_99"
OpenJDK Runtime Environment (IcedTea 2.6.5) (99b00-2.6.5)
OpenJDK Zero VM (build 24.95-b01, mixed mode)