0% found this document useful (0 votes)
14 views88 pages

Amf Aut t2310

Uploaded by

issam sayyaf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views88 pages

Amf Aut t2310

Uploaded by

issam sayyaf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 88

YOCTO PROJECT™ TOOLS FOR

BSP DEVELOPERS
AMF-AUT-T2310

BRYAN THOMAS
FIELD APPLICATIONS ENGINEER

PUBLIC
Agenda
• Linux Introduction
• Yocto Introduction
• NXP Yocto BSP Release
• Host Machine Setup
• Yocto Setup
• Running a Yocto Build
• Using the Results
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

1 PUBLIC
Agenda
• Linux Introduction
− What is Linux?
− Obtaining and Installing a Linux Distribution
− The terminal
• Yocto Introduction
• NXP Yocto BSP Release
• Host Machine Setup
• Yocto Setup
• Running a Yocto Build
• Using the Results
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

2 PUBLIC
Yocto Project: What is Linux?
• Linux is an operating system
• GNU/Linux is a collection of programs and the Linux kernel that forms the
Operating System
• Many of the components of are licensed under an open source license such as the
General Public License (GPL)
• The open source nature of Linux allows you to view the source code of many of the
components of the system

3 PUBLIC
Yocto Project : Obtaining and Installing a Linux Distribution
• Select a distribution that others within your company are using.
• If you are completely new to Linux then pick a distribution like Debian, Fedora, or
Ubuntu
• Distributions are distributed as iso files that can be written to a CD/DVD or USB
flash Drive

4 PUBLIC
Yocto Project : Obtaining and Installing a Linux Distribution
• Use Unetbootin to flash an iso to a USB flash drive
• Download at: http://unetbootin.sourceforge.net/

5 PUBLIC
Yocto Project : Obtaining and Installing a Linux Distribution
• Set the computer to boot from USB and insert the flash drive into one of the USB
ports
• Some distributions have LIVE preview modes that run out of RAM and allow you to
try out the distribution before installing
• Follow the installation guides available on the distribution’s homepage to install
• 500 GB is a good size for an install hard disk

6 PUBLIC
Yocto Project : The Terminal
• The terminal will be your new home!
• Cheat sheet (http://overapi.com/linux/)

7 PUBLIC
Agenda
• Linux Introduction
• Yocto Introduction
− What is the Yocto Project?
− Yocto Project Development Environment
− Yocto Project Components
− Yocto Project Documentation
• NXP Yocto BSP Release
• Host Machine Setup
• Yocto Setup
• Running a Yocto Build
• Using the Results
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

8 PUBLIC
Yocto Project: What is the Yocto Project?
• Open-source collaborative project focused on embedded Linux development
• Currently provides a build system that is referred to as OpenEmbedded build
system in the Yocto Project Documentation
• Helps developers create custom Linux-based systems for embedded products

Source: http://www.yoctoproject.org/docs/1.6.1/yocto-project-qs/yocto-project-qs.html

9 PUBLIC
Yocto Project: Yocto Project Development Environment

10 PUBLIC
Yocto Project: Yocto Project Components
Poky

• Poky is a reference system of the Yocto Project - a collection of Yocto Project tools and
metadata that serves as a set of working examples. To use the Yocto Project tools, you
can download Poky and use it to bootstrap your own distribution.
• Poky is the platform-independent, cross-compiling integration layer that utilizes
OpenEmbedded Core. It provides the mechanism to build and combine thousands of
distributed open source projects together to form a fully customizable, complete, coherent
Linux software stack.
• Poky's objective is to provide all the features and functionalities an embedded developer
needs from one solution.

Source: https://www.yoctoproject.org/tools-resources/projects/poky

11 PUBLIC
Yocto Project: Yocto Project Components
BitBake

• BitBake is a build engine that follows recipes in a specific format in order to perform
sets of tasks. BitBake is a core component of the Yocto Project.

12 PUBLIC
Yocto Project : Yocto Project Documentation
The Yocto Project documentation is available on the Yocto Project website:
(https://www.yoctoproject.org/documentation)

Recommended Reading:
1. Yocto Project Quick Start (Link)
2. BitBake User Manual (Link)
3. Yocto Project Reference Manual (Link)

13 PUBLIC
Agenda
• Linux Introduction
• Yocto Introduction
• NXP Yocto Release
− Introduction to the NXP Yocto BSP Release
− Obtaining the NXP Yocto Release
• Host Machine Setup
• Yocto Setup
• Running a Yocto Build
• Using the Results
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

14 PUBLIC
Yocto Project : NXP Yocto BSP Release
The NXP Yocto BSP Release is an extension of OpenEmbedded and Poky that
supports NXP reference boards

• NXP i.MX6Q SABRE Smart Device


• NXP i.MX6Q SABRE Auto
• NXP i.MX6DL SABRE Smart Device
• NXP i.MX6DL SABRE Auto
• NXP i.MX6SOLO SABRE Smart Device
• NXP i.MX6SOLO SABRE Auto
• NXP i.MX6 Solo Lite EVK

15 PUBLIC
Yocto Project : Obtaining the NXP Yocto BSP Release
The NXP Yocto BSP Release is available from our website under Software & Tools
Section (Link)

• Contains pre-built images for NXP reference boards


• Contains a README file that explains the procedure to download the BSP using
REPO
• Currently based on Yocto version 1.7 (Dizzy)
• Next release based on Yocto version 1.8 (Fido)

16 PUBLIC
Agenda
• Linux Introduction
• Yocto Introduction
• NXP Yocto Release
• Host Machine Setup
− Suitable Host Machines
− Supported Linux Distributions
− Required Host Packages
− Repo
• Yocto Setup
• Running a Yocto Build
• Using the Results
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

17 PUBLIC
Yocto Project : A Suitable Host Machine
• Depending on the number of processors and cores, the amount of RAM, the speed
of your Internet connection and other factors, the build process could take several
hours the first time you run it. Subsequent builds run much faster since parts of the
build are cached.
• Multiple build directories can consume large amounts of hard drive space
• Virtual Machines are not recommended for daily development

18 PUBLIC
Yocto Project : Supported Linux Distributions
Each Yocto release adds additional
supported distributions. Other
distributions can also work but are not
specifically tested by the Yocto Project.
These are supported by Dora:
• Ubuntu 12.04 (LTS)
• Ubuntu 13.10
• Ubuntu 14.04 (LTS)
• Fedora release 19 (Schrödinger's Cat)
• Fedora release 19 (Heisenbug)
• CentOS release 6.4/6.5
• Debian GNU/Linux 7.0-7.6 (Wheezy)
• openSUSE 12.2
• openSUSE 12.3
• openSUSE 13.1
• Any distro with Git 1.7.8, tar 1.24, and
Python 2.7.3+
19 PUBLIC
Yocto Project : Required Host Packages
The list of packages you need on the host development system can be large when covering
all build scenarios using the Yocto Project

Debian based distributions:


Essential packages
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo \
gcc-multilib build-essential chrpath socat
Graphical extras (host)
$ sudo apt-get install libsdl1.2-dev xterm
Documentation packages
$ sudo apt-get install make xsltproc docbook-utils fop dblatex xmlt
ADT Installer Extras:
$ sudo apt-get install autoconf automake libtool libglib2.0-dev

20 PUBLIC
Yocto Project : Required Host Packages
Fedora based distributions:

Essential packages
$ sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch \
diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath \
ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue socat \
findutils which

Graphical extras (host)


$ sudo yum install SDL-devel xterm perl-Thread-Queue

Documentation packages
$ sudo yum install make docbook-style-dsssl docbook-style-xsl docbook-dtds docbook-utils fop libxslt dblatex xmlto
xsltproc

Documentation packages
$ sudo yum install autoconf automake libtool glib2-devel

21 PUBLIC
Yocto Project : Repo
What is Repo?

• Repo is a tool that Google built on top of Git


• Repo helps manage many Git repositories
• Repo is not meant to replace Git
• The repo command is an executable Python script that you can put anywhere in
your path

Repo repository and cheat sheet: Link

22 PUBLIC
Yocto Project : Repo
Installing Repo

1. Add a bin directory to your home directory:


$ mkdir ~/bin

2. Download the script file to the bin directory:


$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

3. Add execute permissions:


$ chmod a+x ~/bin/repo

Source (Link)

23 PUBLIC
Yocto Project : Repo
Adding ~/bin directory to your path
* Debian with BASH, other distributions will vary slightly
Temporary:
$ export PATH=/home/YOURUSERNAME/bin:$PATH
$ source .bashrc

Permanent:
$ vim .profile
+ if [ -d "$HOME/bin" ] ; then
+ PATH="$HOME/bin:$PATH"
+ fi

24 PUBLIC
Agenda
• Linux Introduction
• Yocto Introduction
• NXP Yocto Release
• Host Machine Setup
• Yocto Setup
- Repo Initialization
- Repo Sync
- Sourcing a Build
• Running a Yocto Build
• Using the Results
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

25 PUBLIC
Yocto Project : Repo Initialization
• We will use repo to pull our Yocto sources from multiple Git trees based on the
manifest for the particular branch we are using. In this case we will use the current
GA release based on the previous Yocto Project release
• Git.freescale.com (Link)
$ repo init –u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git –b imx-3.14.28-1.0.1_patch
-u is the manifest url
-b is the manifest branch or revision

• If we look in the directory we only see that a hidden directory has been created
called .repo. This directory contains information that tells repo what Git repositories
and commits to pull into our directory. Repo doesn’t pull the source until we run the
sync command.

26 PUBLIC
Yocto Project : Repo Initialization
b35938@ontario ~/projects/fsl/yocto $ repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.14.28-1.0.1_patch
Get https://gerrit.googlesource.com/git-repo/clone.bundle
Get git://git.freescale.com/imx/fsl-arm-yocto-bsp.git
remote: Counting objects: 171, done.
remote: Compressing objects: 100% (170/170), done.
remote: Total 171 (delta 59), reused 0 (delta 0)
Receiving objects: 100% (171/171), 23.81 KiB | 0 bytes/s, done.
Resolving deltas: 100% (59/59), done.
From git://git.freescale.com/imx/fsl-arm-yocto-bsp
* [new branch] imx-3.10.17-1.0.0_ga -> origin/imx-3.10.17-1.0.0_ga
* [new branch] imx-3.10.17-1.0.1_ga -> origin/imx-3.10.17-1.0.1_ga
* [new branch] imx-3.10.17-1.0.2_ga -> origin/imx-3.10.17-1.0.2_ga
* [new branch] imx-3.10.53-1.1.0_ga -> origin/imx-3.10.53-1.1.0_ga
* [new branch] imx-3.10.53-1.1.1_patch -> origin/imx-3.10.53-1.1.1_patch
* [new branch] imx-3.10.53-1.1.2_patch -> origin/imx-3.10.53-1.1.2_patch
* [new branch] imx-3.14.28-1.0.0_ga -> origin/imx-3.14.28-1.0.0_ga
* [new branch] imx-3.14.28-1.0.1_patch -> origin/imx-3.14.28-1.0.1_patch
* [new branch] imx-3.14.28-7D_alpha -> origin/imx-3.14.28-7D_alpha
* [new branch] imx-3.14.38-6QP_beta -> origin/imx-3.14.38-6QP_beta
* [new branch] imx-3.14.38-6QP_ga -> origin/imx-3.14.38-6QP_ga
* [new branch] imx-3.14.38-6UL7D_beta -> origin/imx-3.14.38-6UL7D_beta
* [new branch] imx-3.14.38-6UL_ga -> origin/imx-3.14.38-6UL_ga

Your identity is: Bryan Thomas <[email protected]>


If you want to change this, please re-run 'repo init' with --config-name

27 PUBLIC
Yocto Project : Repo Initialization
<?xml version="1.0" encoding="UTF-8"?>

<manifest>

<default sync-j="2"/>

<remote fetch="git://git.freescale.com/imx" name="fsl-release" />

<remote fetch="git://git.yoctoproject.org" name="yocto"/>

<remote fetch="git://github.com/Freescale" name="freescale"/>

<remote fetch="git://git.openembedded.org" name="oe"/>

<remote fetch="git://github.com/OSSystems" name="OSSystems"/>

<remote fetch="git://github.com/meta-qt5" name="QT5"/>

<project remote="yocto" revision="f20e4c0cf6ddb29a1aad6e7b095e1472e81d330c" name="poky" path="sources/poky"/>

<project remote="yocto" revision="b74e5e690d8d4e149ea9de3f0fcca37bad93935f" name="meta-fsl-arm" path="sources/meta-fsl-arm"/>

<project remote="oe" revision="7bbacd0023fa1111da94ba0b2aafd7d872301ffe" name="meta-openembedded" path="sources/meta-openembedded"/>

<project remote="freescale" revision="89c605386ec81d64b38562acbc66942964fad971" name="fsl-community-bsp-base" path="sources/base">

<copyfile dest="README" src="README"/>

<copyfile dest="setup-environment" src="setup-environment"/>

</project>

<project remote="freescale" revision="b32528c10caac5e85f2b5efe0e5b95322dd68ace" name="meta-fsl-arm-extra" path="sources/meta-fsl-arm-extra"/>

<project remote="freescale" revision="48cb0bcdd226d2e7eee1fdc222713e1dff93342c" name="meta-fsl-demos" path="sources/meta-fsl-demos"/>

<project remote="OSSystems" revision="63963cc56c8d0291779693e62b66cb16e5c86883" name="meta-browser" path="sources/meta-browser" />

<project remote="QT5" revision="41c5daa84af4466bfc9aa61f6f772c68470a628b" name="meta-qt5" path="sources/meta-qt5" />

<project remote="fsl-release" name="meta-fsl-bsp-release" path="sources/meta-fsl-bsp-release" revision="dizzy_3.14.28-1.0.1_patch" >

<copyfile src="imx/tools/fsl-setup-release.sh" dest="fsl-setup-release.sh"/>

</project>

</manifest>

28 PUBLIC
Yocto Project : Repo Sync
• We run repo sync and this goes to each git repository that is defined in the manifest.xml
file and clones the project that is specified.
user@machine:~/projects/fsl/yocto$ repo sync
Fetching project meta-fsl-bsp-release
Fetching project fsl-community-bsp-base
remote: Counting objects: 194, done.
remote: Total 194 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (194/194), 34.57 KiB | 0 bytes/s, done.
Resolving deltas: 100% (114/114), done.
From git://github.com/Freescale/fsl-community-bsp-base
* [new branch] daisy -> freescale/daisy
Some output
*** BRANCHES AND TAGS OMMITED TO SAVE SPACE!!!! ***
* [new tag] 1.6 -> 1.6
omitted for clarity
Fetching projects: 12% (1/8) Fetching project poky
Fetching projects: 25% (2/8) Fetching project meta-browser
..
Fetching projects: 100% (9/9), done.

29 PUBLIC
Yocto Project : Repo Sync
• After the sync command completes the source directory will contain a setup script and a
sources directory.

.
├── fsl-setup-release.sh
├── README
├── setup-environment
└── sources

1 directory, 3 files

30 PUBLIC
Yocto Project : Sourcing a Build
• Now you need to pick a machine type that you want to set up to build. These machines are available in the specific
<layer>/conf/machine/*.conf files
• You can find available machines with the following command in your yocto top directory
$ ls sources/meta-fsl-*/conf/machine/*.conf
sources/meta-fsl-arm/conf/machine/imx23evk.conf
sources/meta-fsl-arm/conf/machine/imx28evk.conf
sources/meta-fsl-arm/conf/machine/imx31pdk.conf
sources/meta-fsl-arm/conf/machine/imx35pdk.conf
sources/meta-fsl-arm/conf/machine/imx51evk.conf
sources/meta-fsl-arm/conf/machine/imx53ard.conf
sources/meta-fsl-arm/conf/machine/imx53qsb.conf
sources/meta-fsl-arm/conf/machine/imx6dlsabreauto.conf
sources/meta-fsl-arm/conf/machine/imx6dlsabresd.conf
sources/meta-fsl-arm/conf/machine/imx6qsabreauto.conf
sources/meta-fsl-arm/conf/machine/imx6qsabresd.conf
sources/meta-fsl-arm/conf/machine/imx6slevk.conf
sources/meta-fsl-arm/conf/machine/imx6solosabreauto.conf
sources/meta-fsl-arm/conf/machine/imx6solosabresd.conf
sources/meta-fsl-arm/conf/machine/twr-vf65gs10.conf

31 PUBLIC
Yocto Project : Sourcing a Build
• The machine name tells setup script which board you will be using for development

$ MACHINE=<machine-name> source fsl-setup-release.sh –b <build-directory> –e <backend


fb, dfb, wayland, x11>

• Example using NXP i.MX6Q SABRE Auto and Framebuffer

$ MACHINE=imx6qsabreauto source fsl-setup-release.sh –b build-imx6qsabreauto –e fb

32 PUBLIC
Yocto Project : Sourcing a Build
user@machine:~/projects/fsl/yocto$ MACHINE=imx6qsabreauto source fsl-setup-release.sh -b build-imx6qsabreauto -e fb

Build directory is build-imx6qsabreauto

Using FB backend with FB DIST_FEATURES to override poky X11 DIST FEATURES

Configuring for imx6qsabreauto

*** EULA is Displayed ***

EULA has been accepted.

Welcome to NXP Community BSP

The Yocto Project has extensive documentation about OE including a

reference manual which can be found at:

http://yoctoproject.org/documentation

For more information about OpenEmbedded see their website:

http://www.openembedded.org/

You can now run 'bitbake <target>'

Common targets are:

core-image-minimal

meta-toolchain

meta-toolchain-sdk

adt-installer

meta-ide-support

Your build environemnt has been configured with:

MACHINE=imx6qsabreauto

SDKMACHINE=i686

DISTRO=poky

EULA=1

33 PUBLIC
Yocto Project : Sourcing a Build

• The setup script will create the conf directory and copy some files that are needed
to create the build. When the script is completed you will be placed into the build
directory that you specified. We will use bitbake to spawn off the build from inside
this directory

user@machine:~/projects/fsl/yocto/build-imx6qsabreauto$ tree
.
└── conf
├── bblayers.conf
├── bblayers.conf.org
├── local.conf
├── local.conf.org
└── local.conf.sample

34 PUBLIC
Yocto Project : Optimizing Host Machine
• <build>/conf/local.conf has a few options that you can change in order to speed up building on your host machine
MACHINE ??= 'imx6qsabreauto'
DISTRO ?= 'poky'
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES = "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K"
CONF_VERSION = "1"

BB_NUMBER_THREADS = ‘8’ <- increase to reflect the number of cores


PARALLEL_MAKE = '-j 8’ <- increase to reflect the number of cores

DL_DIR ?= "${BSPDIR}/downloads/” <- make a common directory if you have several builds
SSTATE_DIR ?= "/share/sstate-cache“ <- make a common directory to speed builds

ACCEPT_FSL_EULA = ””

35 PUBLIC
Agenda
• Linux Introduction
• Yocto Introduction
• NXP Yocto Release
• Host Machine Setup
• Yocto Setup
• Running a Yocto Build
− Using BitBake
− First Build Time
• Using the Results
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

36 PUBLIC
Yocto Project : Using BitBake
• Now we use bitbake to spawn off the build
build-imx6qsabreauto$ bitbake <image-name>

• <image-name> are images that are provided from the release. We can find
them with find . –name fsl-image* from the yocto top directory
b35938@b35938-13:~/projects/fsl/yocto$ find . -name fsl-image*
./sources/meta-fsl-arm/recipes-fsl/images/fsl-image-mfgtool-initramfs.bb
./sources/meta-fsl-demos/recipes-fsl/images/fsl-image-multimedia.bb
./sources/meta-fsl-demos/recipes-fsl/images/fsl-image-machine-test.bb
./sources/meta-fsl-demos/recipes-fsl/images/fsl-image-multimedia-full.bb
./sources/meta-fsl-bsp-release/imx/meta-fsl-demos/recipes-fsl/images/fsl-image-qt5.bb
./sources/meta-fsl-bsp-release/imx/meta-fsl-demos/recipes-fsl/images/fsl-image-gui.bb

37 PUBLIC
Yocto Project : Using BitBake
• Example command
build-imx6qsabreauto$ bitbake fsl-image-gui
b35938@b35938-13:~/projects/fsl/yocto/build-imx6qsabreauto$ bitbake fsl-image-
gui
Parsing recipes: 100%
|############################################################################|
Time: 00:00:03
Parsing of 1605 .bb files complete (0 cached,1605 parsed). 2004 targets, 160
skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: multiple providers are available for runtime libgl-mesa-dev (mesa, mesa-
gl)
NOTE: consider defining a PREFERRED_PROVIDER entry to match libgl-mesa-dev
NOTE: multiple providers are available for jpeg (jpeg, libjpeg-turbo)
NOTE: consider defining a PREFERRED_PROVIDER entry to match jpeg

38 PUBLIC
Yocto Project : Using BitBake
Output
Build Configuration:

BB_VERSION = "1.24.0"

BUILD_SYS = "x86_64-linux"

NATIVELSBSTRING = "Debian-8.2"

TARGET_SYS = "arm-poky-linux-gnueabi"

MACHINE = "imx6qsabreauto"

DISTRO = "poky"

DISTRO_VERSION = "1.7"

TUNE_FEATURES = "arm armv7a vfp neon callconvention-hard cortexa9"

TARGET_FPU = "vfp-neon"

meta

meta-yocto = "(nobranch):f20e4c0cf6ddb29a1aad6e7b095e1472e81d330c"

meta-oe

meta-multimedia = "(nobranch):7bbacd0023fa1111da94ba0b2aafd7d872301ffe"

meta-fsl-arm = "(nobranch):b74e5e690d8d4e149ea9de3f0fcca37bad93935f"

meta-fsl-arm-extra = "(nobranch):b32528c10caac5e85f2b5efe0e5b95322dd68ace"

meta-fsl-demos = "(nobranch):48cb0bcdd226d2e7eee1fdc222713e1dff93342c"

meta-fsl-arm

meta-fsl-demos = "(nobranch):126bd42a7390fe0e0deca937a40fb526dea82c8c"

meta-browser = "(nobranch):63963cc56c8d0291779693e62b66cb16e5c86883"

meta-gnome

meta-networking

meta-python

meta-ruby

meta-filesystems = "(nobranch):7bbacd0023fa1111da94ba0b2aafd7d872301ffe"

meta-qt5 = "(nobranch):41c5daa84af4466bfc9aa61f6f772c68470a628b"

meta-fsl-qt5

meta-fsl-bluez = "(nobranch):126bd42a7390fe0e0deca937a40fb526dea82c8c"

39 PUBLIC
Yocto Project : First Build Time
• The first build can take up to several hours depending on the speed of your
machine
• Subsequent builds will take much less time because the built packages are cached
to improved build times
• Only modified or added recipes will be built and deployed in the subsequent builds

40 PUBLIC
Agenda
• Linux Introduction
• Yocto Introduction
• NXP Yocto Release
• Host Machine Setup
• Yocto Setup
• Running a Yocto Build
• Using the Results
− Location of the Build Output
− Flashing SD Card Image
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

41 PUBLIC
Yocto Project : Location of the Build Output
• The build output is inside the ../tmp/deploy/images directory in the build directory
you created:

user@machine:~/projects/fsl/yocto/build-imx6qsabreauto/tmp/deploy/images/imx6qsabreauto$ ls

*** More file are in the directory but here is a sample ***
fsl-image-gui-imx6qsabreauto-20150821000528.rootfs.tar.bz2
fsl-image-gui-imx6qsabreauto-20150821000528.rootfs.sdcard
uImage
u-boot.imx
fsl-image-gui-imx6qsabreauto.sdcard

42 PUBLIC
Yocto Project : Flashing SD Card Image
• Inside the images directory there is a .sdcar image file that is a complete SD card
image that can be flashed and used on the reference board.
• Use dmesg or lsblk to find the name of your disk (sdX)

$ sudo dd if=fsl-image-fb-imx6qsabreauto.sdcard of=/dev/sdX bs=1M


516+0 records in
516+0 records out
541065216 bytes (541 MB) copied, 45.932 s, 11.8 MB/s

• Card can now be used to boot the reference platform

43 PUBLIC
Agenda
• Linux Introduction
• Yocto Introduction
• NXP Yocto Release
• Host Machine Setup
• Yocto Setup
• Running a Yocto Build
• Using the Results
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

44 PUBLIC
Yocto Project : BitBake
BitBake

• BitBake is a build engine that follows recipes in a specific format in order to perform
sets of tasks. BitBake is a core component of the Yocto Project.

45 PUBLIC
Yocto Project : BitBake Operation
bitbake must always be executed from within the <project> directory
• When bitbake runs
− parses recipes and tasks
− determines task queue dependencies
− prepares and executes a run queue of tasks, which perform the steps needed to obtain the desired
result, e.g. image generation
• Any required earlier tasks will be run first (e.g. source will be installed before compilation)
• To speed up subsequent builds, generated <pkg>.rpm's are saved to the binary cache
folders in : <project>/tmp/deploy/rpm

For more info:


http://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html#bitbake-user-manual-execution

46 PUBLIC
Yocto Project : BitBake Syntax
$ bitbake -h
Usage: bitbake [options] [recipename/target ...]

Executes the specified task (default is 'build') for a given set of target recipes (.bb files).
It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which
will provide the layer, BBFILES and other configuration information.

Options:
--version show program's version number and exit
-h, --help show this help message and exit
-k, --continue Continue as much as possible after an error. While the
target that failed and anything depending on it cannot
be built, as much as possible will be built before
stopping.
-f, --force Force the specified targets/task to run (invalidating
any existing stamp file).
-c CMD, --cmd=CMD Specify the task to execute. The exact options
available depend on the metadata. Some examples might
be 'compile' or 'populate_sysroot' or 'listtasks' may
give a list of the tasks available.
-D, --debug Increase the debug level. You can specify this more
than once.

47 PUBLIC
Yocto Project : BitBake Common Tasks
Listing Bitbake tasks for a recipe or image
$bitbake <package> -c listtasks

Useful tasks that you can run manually for most packages:
build clean cleansstate compile
configure install listtasks patch
populate_sy rm_work
sroot

• Task sequence run for generic bitbake <package> bitbake <package> :


fetch > unpack >patch > configure > compile > install > package > package_write

48 PUBLIC
Yocto Project : BitBaking an Image
Example:
b35938@b35938-13:~/projects/fsl/yocto/build-imx6qsabreauto$ bitbake fsl-image-fb
Loading cache: 100%
|################################################################################
#################################################################################
#######################################| ETA: 00:00:00
Loaded 2005 entries from dependency cache.

Build Configuration: <removed for clarity>

NOTE: Preparing runqueue


NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
Currently 1 running tasks (3851 of 4000):

49 PUBLIC
Yocto Project : BitBake to Configure the Kernel
Examples:
Bitbake linux-imx –c menuconfig

50 PUBLIC
Yocto Project : BitBake to Compile
Examples:
b35938@b35938-13:~/projects/fsl/yocto/build-imx6qsabreauto$ bitbake linux-imx -c compile
Loading cache: 100%
|##############################################################################################
###############################################################################################
###########| ETA: 00:00:00
Loaded 2005 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration: <removed for clarity>

NOTE: Preparing runqueue


NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
Currently 1 running tasks (249 of 249):
0: linux-imx-3.10.17-r0 do_compile (pid 17655)

51 PUBLIC
Yocto Project : BitBake to Start Fresh
Examples:
b35938@b35938-13:~/projects/fsl/yocto/build-imx6qsabreauto$ bitbake linux-imx -c cleansstate
Loading cache: 100%
|##############################################################################################
###############################################################################################
###########| ETA: 00:00:00
Loaded 2005 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration: <removed for clarity>

NOTE: Preparing runqueue


NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
Currently 1 running tasks (249 of 249):
0: linux-imx-3.10.17-r0 do_cleansstate (pid 18465)

52 PUBLIC
Agenda
• Linux Introduction
• Yocto Introduction
• NXP Yocto Release
• Host Machine Setup
• Yocto Setup
• Running a Yocto Build
• Using the Results
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

53 PUBLIC
Yocto Project : Layers

• Layers are a collection of metadata like


recipes, classes, and machine
configurations
• Layers allow you to partition your
development for better reuse
• A Layer that contains machine support is
referred to as a BSP Layer
• The SOURCE directory already contains
examples of both types of Layers.
• Layers are the best way to customize the
build system to meet project needs

54 PUBLIC
Yocto Project : Layers in NXP Yocto Release
These layers are present after you setup the NXP Yocto Release on your host
machine:

Layer Name Layer Function

meta-fsl-arm Provides support for NXP Reference Boards

meta-fsl-arm- Provides support for 3rd party development


extra boards
meta-fsl-demos QT Graphics and other user interface examples

meta-fsl-bsp- Provides updates to the meta-fsl-arm and meta-


release fsl-demos layers

55 PUBLIC
Yocto Project : Layer Management
• The BitBake layer management tool provides a view into the structure of recipes across a
multi-layer project

$ bitbake-layers <command> [arguments]

The following list describes the available commands:


• help: Displays general help or help on a specified command.
• show-layers: Shows the current configured layers.
• show-recipes: Lists available recipes and the layers that provide them.
• show-overlayed: Lists overlayed recipes
• show-appends: Lists .bbappend files and the recipe files to which they apply.
• show-cross-depends: Lists dependency relationships between recipes that cross layer
boundaries.

56 PUBLIC
Yocto Project : BitBake Layer Management
• Example of bitbake-layers show-layers
• Higher priority numbers take precedence over lower numbers

57 PUBLIC
Yocto Project : Layer Creation
• The Yocto Project provides a script that can be used to create a new layer called
yocto-layer
• Layers can also be created manually
• The script will walk you through setting up the new layer
− The layer priority
− Whether or not to create a sample recipe.
− Whether or not to create a sample append file.
Use the yocto-layer create sub-command to create a new general layer. In its simplest
form, you can create a layer as follows:

$ yocto-layer create mylayer

58 PUBLIC
Yocto Project : Layer Creation Example
b35938@b35938-13:~/projects/fsl/yocto/sources$ yocto-layer create dwf-layer
Please enter the layer priority you'd like to use for the layer: [default: 6]
Would you like to have an example recipe created? (y/n) [default: n] y
Please enter the name you'd like to use for your example recipe: [default: example]
Would you like to have an example bbappend file created? (y/n) [default: n] y
Please enter the name you'd like to use for your bbappend file: [default: example]
Please enter the version number you'd like to use for your bbappend file (this should match
the recipe you're appending to): [default: 0.1]

New layer created in meta-dwf-layer.

Don't forget to add it to your BBLAYERS (for details see meta-dwf-layer\README).

59 PUBLIC
Yocto Project : Layer Layout After Creation
Here is the tree of the new layer that we have created:

b35938@b35938-13:~/projects/fsl/yocto/sources$ tree meta-dwf-layer/


meta-dwf-layer/
├── conf
│ └── layer.conf
├── COPYING.MIT
├── README
├── recipes-example
│ └── example
│ ├── example-0.1
│ │ ├── example.patch
│ │ └── helloworld.c
│ └── example_0.1.bb
└── recipes-example-bbappend
└── example-bbappend
├── example-0.1
│ └── example.patch
└── example_0.1.bbappend

60 PUBLIC
Yocto Project : Layer Configuration File
Here is the configuration of the new layer that we have created:
b35938@b35938-13:~/projects/fsl/yocto/sources$ cat meta-dwf-layer/conf/layer.conf
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have recipes-* directories, add to BBFILES


BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "dwf-layer"
BBFILE_PATTERN_dwf-layer = "^${LAYERDIR}/"
BBFILE_PRIORITY_dwf-layer = "6"

61 PUBLIC
Yocto Project : Adding the Layer to bblayers.conf
Add the new layer to <build>/conf/bblayers.conf to let bitbake find the layer:
b35938@b35938-13:~/projects/fsl/yocto/build$ cat conf/bblayers.conf
LCONF_VERSION = "6"

BBPATH = "${TOPDIR}"
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"

BBFILES ?= ""
BBLAYERS = " \
${BSPDIR}/sources/poky/meta \
${BSPDIR}/sources/poky/meta-yocto \
\
${BSPDIR}/sources/meta-openembedded/meta-oe \
\
${BSPDIR}/sources/meta-fsl-arm \
${BSPDIR}/sources/meta-fsl-arm-extra \
${BSPDIR}/sources/meta-fsl-demos \
${BSPDIR}/sources/meta-dwf-layer \

62 PUBLIC
Yocto Project : Adding the Layer to bblayers.conf
Run bitbake-layers show-layers:
Higher numbers are higher priority

63 PUBLIC
Yocto Project : Change a Layer into a BSP Layer
• For a layer to be considered a BSP layer you have to add a machine folder in the
layer’s conf directory
• An example of the meta-fsl-arm directory is below:

• More files and directories are recommended in the Yocto documentation to


maintain consistency between layers

64 PUBLIC
Yocto Project : BSP Layer Directories
• A complete listing of the top directory of the meta-fsl-arm directory
• This directory contains a README file that explains how to use the Layer
• A stub README is placed when using bitbake-layer create <layer>

65 PUBLIC
Yocto Project : Working with an Empty Layer
• Use this custom layer to create a custom BSP
• Examples of items that can be done in a layer
− Create a MACHINE for custom hardware
− Create an image specific to project requirements
− Add a Linux kernel append recipe for custom hardware support
− Add a u-boot append recipe for custom hardware support
− Add a custom application recipe and include them in the image

66 PUBLIC
Yocto Project : Adding a Machine
• Use a machine from another layer that is similar to your board. Many designs are derivatives of the reference designs

b35938@b35938-13:~/projects/fsl/yocto/sources/meta-dwf-layer/conf/machine$ tree
.
├── imx6q-custom-dwf.conf
└── include
├── fsl-default-providers.inc
├── fsl-default-settings.inc
├── fsl-default-versions.inc
├── imx6sabresd-common.inc
└── imx-base.inc

1 directory, 6 files

67 PUBLIC
Yocto Project : Adding a new Image
• Create a custom image for the custom board by adding a directory called images in
a recipes folder typically named after the layer

b35938@b35938-13:~/projects/fsl/yocto/sources/meta-dwf-layer/recipes-dwf$ tree
.
└── images
└── custom-dwf-image-fb.bb

1 directory, 1 file

68 PUBLIC
Yocto Project : Image Recipe Example
• This image recipe can be borrowed from another layer and modified to meet the project needs

DESCRIPTION = “DwF Custom Image Frame Buffer Image"

IMAGE_FEATURES += "splash"

LICENSE = "MIT"

inherit core-image

inherit distro_features_check

CONFLICT_DISTRO_FEATURES = "x11 wayland directfb"

DISTRO_FEATURES += "pulseaudio "

WEB = "web-webkit"

# Add extra image features

EXTRA_IMAGE_FEATURES += " \

nfs-server \

tools-debug \

tools-profile \

ssh-server-dropbear \

"

SOC_IMAGE_INSTALL = ""

SOC_IMAGE_INSTALL_mx6 = "gpu-viv-bin-mx6q gpu-viv-g2d fsl-gpu-sdk"

IMAGE_INSTALL += " \

${SOC_IMAGE_INSTALL} \

cpufrequtils \

nano \

packagegroup-fsl-tools-testapps \

packagegroup-fsl-tools-benchmark \

"

export IMAGE_BASENAME = "custom-dwf-image-fb"

69 PUBLIC
Yocto Project : Sourcing the custom MACHINE
• Now that we have added our custom MACHINE and image recipe we can use them to create a new build directory for our custom platform:

b35938@b35938-13:~/projects/fsl/yocto$ MACHINE=imx6q-custom-dwf . fsl-setup-release.sh build-custom-dwf


Configuring for imx6q-custom-dwf

The Yocto Project has extensive documentation about OE including a


reference manual which can be found at:
http://yoctoproject.org/documentation
For more information about OpenEmbedded see their website:
http://www.openembedded.org/
You can now run 'bitbake <target>'
Common targets are:
core-image-minimal
meta-toolchain
meta-toolchain-sdk
adt-installer
meta-ide-support
Your build environemnt has been configured with:
MACHINE=imx6q-custom-dwf
SDKMACHINE=i686
DISTRO=poky
EULA=1

70 PUBLIC
Yocto Project : Building the Custom Image
• We can now build the custom image with bitbake.
• Note that we need to add the moon-buggy recipe or a layer that contains the recipe before we can successful build the new image:
b35938@b35938-13:~/projects/fsl/yocto/build-custom-dwf$ bitbake custom-dwf-image-fb
Parsing recipes: 100% |############################################################################| Time: 00:01:04
Parsing of 1608 .bb files complete (0 cached, 1608 parsed). 2007 targets, 159 skipped, 0 masked, 0 errors.
Build Configuration:
BB_VERSION = "1.20.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "Ubuntu-14.04"
TARGET_SYS = "arm-poky-linux-gnueabi"
MACHINE = "imx6q-custom-dwf"
DISTRO = "poky"
DISTRO_VERSION = "1.5.3"
TUNE_FEATURES = "armv7a vfp neon callconvention-hard cortexa9"
TARGET_FPU = "vfp-neon"
meta
meta-dwf-layer

NOTE: Preparing runqueue


NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks

71 PUBLIC
Agenda
• Linux Introduction
• Yocto Introduction
• NXP Yocto Release
• Host Machine Setup
• Yocto Setup
• Running a Yocto Build
• Using the Results
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

72 PUBLIC
Yocto Project : Adding a Custom Kernel
• Add a custom Kernel to your layer by adding a bbappend recipe that appends the 3.10.17 recipe in the NXP release layer

$ cd ../sources/meta-dwf-custom
$ mkdir –p recipes-kernel/linux/linux-imx

• This will make the folder for our recipe file and for our patches that we use for our custom board

$ cd recipes-kernel/linux
$ touch linux-imx_3.10.17.bbappend
$ vim linux-imx_3.10.17.bbappend

73 PUBLIC
Yocto Project : Adding a Custom Kernel Recipe
File: linux-imx_3.10.17.bbappend

# Linux Kernel bbappend example


# Bryan Thomas 2014 - NXP

# This points to where our extra files are like patches and kernel config files
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

# add our custom patches for our kernel build


SRC_URI += "file://0001-patch-file.patch"
SRC_URI += "file://0002-patch-file.patch"

# use our custom config for this kernel build


SRC_URI += "file://defconfig"
SRC_URI += "file://feature.conf"

74 PUBLIC
Yocto Project : Kernel Patching Workflow with GIT
• Multiple ways to work and create patches (GIT, quilt, manual diff)
• Can work inside the context of Yocto or generate tool chain to work in external directory

$ bitbake linux-imx –c patch

• This extracts the kernel sources to your work directory under your machine name

Example Path:
<build>/tmp/work/imx6-dwf-custom-poky-linux-gnueabi/linux-imx/3.10.17-r0/git/

• From here we can edit files and use GIT to generate patches using a iterative workflow

75 PUBLIC
Yocto Project : Kernel Patching Workflow with GIT

Modify Source

Add patch to
git add
bbappend file

Copy Patch to
linux-imx git commit
directory

git format-patch

76 PUBLIC
Yocto Project : Adding the Patches to Recipe
File: linux-imx_3.10.17.bbappend

# Linux Kernel bbappend example


# Bryan Thomas 2014 - NXP

# This points to where our extra files are like patches and kernel config files
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

# add our custom patches for our kernel build


SRC_URI += "file://0001-added-extra-version-information-to-makefile.patch"

# use our custom config for this kernel build


SRC_URI += "file://defconfig"

77 PUBLIC
Agenda
• Linux Introduction
• Yocto Introduction
• NXP Yocto Release
• Host Machine Setup
• Yocto Setup
• Running a Yocto Build
• Using the Results
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

78 PUBLIC
Yocto Project : Adding an Autotools Recipe
• The GNU build system, also known as the Autotools, is a suite of programming tools designed to assist in making source
code packages portable to many Unix-like systems.
• Many programs for Unix-like systems are configured and compiled with Autotools
• These programs commonly have a read me file that contains the following sequence as instructions to compile and install the
program.

$ ./configure
$ make
$ make install

79 PUBLIC
Yocto Project : Adding an Autotools Recipe
• Yocto can handle recipes that use the autotools suite
• Inherit autotools in the recipe
• For our example we will add the game moon buggy using an autotools style recipe

Moon-Buggy version 1.0, Copyright 2004 Jochen Voss <[email protected]>

80 PUBLIC
Yocto Project : Adding an Autotools Recipe
• Add recipes-games folder to our meta-dwf-custom layer

b35938@b35938-13:~/projects/fsl/yocto/sources/meta-dwf-layer/recipes-games/moon-buggy$ tree
.
├── moon-buggy
│ ├── 0001-removed-creating-highscore-on-install.patch
│ └── 0002-remove-c-from-am-file-to-stop-from-running-at-instal.patch
└── moon-buggy_1.0.bb

* We added another folder called moon-buggy for our patches needed to complete compilation on ARM.

81 PUBLIC
Yocto Project : Autotools Recipe
b35938@b35938-13:~/projects/fsl/yocto/sources/meta-dwf-layer/recipes-games/moon-buggy$ cat moon-buggy_1.0.bb
DESCRIPTION = "Moon Buggy command line game"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PV}:"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f "
PR = "r0"
SRC_URI = "http://m.seehuhn.de/programs/moon-buggy-${PV}.tar.gz"
SRC_URI[md5sum] = "4da97ea40eca686f6f8b164d8b927e38"
SRC_URI[sha256sum] = "f8296f3fabd93aa0f83c247fbad7759effc49eba6ab5fdd7992f603d2d78e51a"

SRC_URI += "file://0001-removed-creating-highscore-on-install.patch"
SRC_URI += "file://0002-remove-c-from-am-file-to-stop-from-running-at-instal.patch"

inherit autotools gettext

b35938@b35938-13:~/projects/fsl/yocto/sources/meta-dwf-layer/recipes-games/moon-buggy$

82 PUBLIC
Yocto Project : Adding our Recipe Output
• Once we create our recipe for moon-buggy we need to include into our custom image

DESCRIPTION = “DwF Custom Image Frame Buffer Image"

IMAGE_FEATURES += "splash"

LICENSE = "MIT"

inherit core-image

inherit distro_features_check

CONFLICT_DISTRO_FEATURES = "x11 wayland directfb"

DISTRO_FEATURES += "pulseaudio "

WEB = "web-webkit"

# Add extra image features

EXTRA_IMAGE_FEATURES += " \

nfs-server \

tools-debug \

tools-profile \

ssh-server-dropbear \

"

SOC_IMAGE_INSTALL = ""

SOC_IMAGE_INSTALL_mx6 = "gpu-viv-bin-mx6q gpu-viv-g2d fsl-gpu-sdk"

IMAGE_INSTALL += " \

${SOC_IMAGE_INSTALL} \

cpufrequtils \

nano \

moon-buggy \
packagegroup-fsl-tools-testapps \

packagegroup-fsl-tools-benchmark \

"

export IMAGE_BASENAME = "custom-DwF-image-fb"

83 PUBLIC
Agenda
• Linux Introduction
• Yocto Introduction
• NXP Yocto Release
• Host Machine Setup
• Yocto Setup
• Running a Yocto Build
• Using the Results
• BitBake
• Layers & BSP Layers
• Kernel Development Workflow
• Autotools Recipes
• Finding Help

84 PUBLIC
Yocto Project : Finding Help
• community.NXP.com
• meta-NXP mailing list
• Yocto Project Documentation

?
85 PUBLIC
PUBLIC USE
Company Public information is information that has been declared public knowledge by the owner and can
freely be given to anyone inside or outside NXP without any possible damage to NXP
Public information can shared with anyone but only NXP spokespersons and nominated people can
represent NXP publicly
Click here for more information on security awareness

86 PUBLIC

You might also like