Amf Aut t2310
Amf Aut t2310
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
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)
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
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
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?
22 PUBLIC
Yocto Project : Repo
Installing 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
27 PUBLIC
Yocto Project : Repo Initialization
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<default sync-j="2"/>
</project>
</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
32 PUBLIC
Yocto Project : Sourcing a Build
user@machine:~/projects/fsl/yocto$ MACHINE=imx6qsabreauto source fsl-setup-release.sh -b build-imx6qsabreauto -e fb
http://yoctoproject.org/documentation
http://www.openembedded.org/
core-image-minimal
meta-toolchain
meta-toolchain-sdk
adt-installer
meta-ide-support
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"
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"
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)
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
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
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.
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
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
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
54 PUBLIC
Yocto Project : Layers in NXP Yocto Release
These layers are present after you setup the NXP Yocto Release on your host
machine:
55 PUBLIC
Yocto Project : Layer Management
• The BitBake layer management tool provides a view into the structure of recipes across a
multi-layer project
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:
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]
59 PUBLIC
Yocto Project : Layer Layout After Creation
Here is the tree of the new layer that we have created:
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}"
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:
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
IMAGE_FEATURES += "splash"
LICENSE = "MIT"
inherit core-image
inherit distro_features_check
WEB = "web-webkit"
EXTRA_IMAGE_FEATURES += " \
nfs-server \
tools-debug \
tools-profile \
ssh-server-dropbear \
"
SOC_IMAGE_INSTALL = ""
IMAGE_INSTALL += " \
${SOC_IMAGE_INSTALL} \
cpufrequtils \
nano \
packagegroup-fsl-tools-testapps \
packagegroup-fsl-tools-benchmark \
"
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:
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
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
# This points to where our extra files are like patches and kernel config files
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
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
• 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
# This points to where our extra files are like patches and kernel config files
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
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
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"
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
IMAGE_FEATURES += "splash"
LICENSE = "MIT"
inherit core-image
inherit distro_features_check
WEB = "web-webkit"
EXTRA_IMAGE_FEATURES += " \
nfs-server \
tools-debug \
tools-profile \
ssh-server-dropbear \
"
SOC_IMAGE_INSTALL = ""
IMAGE_INSTALL += " \
${SOC_IMAGE_INSTALL} \
cpufrequtils \
nano \
moon-buggy \
packagegroup-fsl-tools-testapps \
packagegroup-fsl-tools-benchmark \
"
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