Professional Documents
Culture Documents
Yocto Slides
Yocto Slides
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 1/296
Rights to copy
Your fair use and other rights are in no way aected by the above.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 2/296
Hyperlinks in the document
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 3/296
Free Electrons at a glance
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 4/296
Free Electrons on-line resources
information
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 6/296
Hardware used in this training session
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 7/296
Do not damage your BeagleBone Black!
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 8/296
Course outline - Day 1
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 9/296
Course outline - Day 2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 10/296
Course outline - Day 3
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 11/296
Participate!
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 12/296
Practical lab guidelines
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 13/296
Advise: write down your commands!
During practical labs, write down all your commands in a text le.
You can save a lot of time re-using
commands in later labs.
This helps to replay your work if Lab commands
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 14/296
Cooperate!
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 15/296
Command memento sheet
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 18/296
Introduction to embedded Linux build systems
Introduction to
embedded Linux Embedded Linux
Experts
build systems
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 19/296
Introduction to embedded Linux build systems
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 20/296
Build system denition
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 21/296
Available system building tools
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 22/296
Comparison of distribution projects
Buildroot
Simple to use.
Adapted for small embedded devices.
Not perfect if you need advanced functionalities and multiple
machines support.
http://buildroot.org/
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 23/296
Comparison of distribution projects
OpenWRT
Based on Buildroot.
Primarily used for embedded network devices like routers.
http://openwrt.org/
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 24/296
Comparison of distribution projects
Poky
Part of the Yocto Project.
Using OpenEmbedded.
Suitable for more complex embedded systems.
Allows lots of customization.
Can be used for multiple targets at the same time.
http://yoctoproject.org/
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 25/296
Introduction to embedded Linux build systems
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 26/296
Working without a build system
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 27/296
Benets
Build systems automate the process of building a target
system, including the kernel, and sometimes the toolchain.
They automatically download, congure, compile and install
all the components in the right order, sometimes after
applying patches to x cross-compiling issues.
They make sure all the application dependencies are matched.
They already contain a large number of packages, that should
t your main requirements, and are easily extensible.
The build becomes reproducible, which allows to easily change
the conguration of some components, upgrade them, x
bugs, etc.
Several congurations can be handled in the same project. It
is possible to generate the same root le system for dierent
hardware targets or to have a debug image based on the
production one, with some more ags or debugging
applications.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 28/296
Workow
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 29/296
Yocto Project and Poky reference system overview
system overview
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 30/296
Yocto Project and Poky reference system overview
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 31/296
About
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 32/296
The Yocto Project lexicon
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 33/296
The Yocto Project lexicon
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 34/296
The Yocto Project lexicon
Organization of OpenEmbedded-Core:
Recipes describe how to fetch, congure, compile and package
applications and images. They have a specic syntax.
Layers are sets of recipes, matching a common purpose. For
Texas Instruments board support, the meta-ti layer is used.
Multiple layers are used within a same distribution, depending
on the requirements.
It supports the ARM, MIPS (32 and 64 bits), PowerPC and
x86 (32 and 64 bits) architectures.
It supports QEMU emulated machines for these architectures.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 35/296
The Yocto Project lexicon
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 36/296
Example of a Yocto Project based BSP
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 37/296
Yocto Project and Poky reference system overview
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 38/296
Download the Poky reference system
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 39/296
Poky
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 40/296
Poky source tree 1/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 41/296
Poky source tree 2/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 43/296
Using Yocto Project - basics
Project - basics
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 44/296
Using Yocto Project - basics
Environment setup
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 45/296
Environment setup
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 46/296
oe-init-build-env
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 47/296
Common targets
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 48/296
Exported environment variables
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 49/296
Available commands
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 50/296
The build/ directory 1/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 51/296
The build/ directory 2/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 52/296
Using Yocto Project - basics
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 53/296
The build/conf/ directory
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 54/296
Conguring the build
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 55/296
Using Yocto Project - basics
Building an image
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 56/296
Compilation
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 57/296
Practical lab - First Yocto build
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 58/296
Using Yocto Project - advanced usage
Using Yocto
Project - advanced Embedded Linux
Experts
usage
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 59/296
Advanced build usage and conguration
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 60/296
A little reminder
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 61/296
Using Yocto Project - advanced usage
Advanced conguration
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 62/296
Overview
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 63/296
Methods and conditions 1/4
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 64/296
Methods and conditions 2/4
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 65/296
Methods and conditions 3/4
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 66/296
Methods and conditions 4/4
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 67/296
Operators 1/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 68/296
Operators 2/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 69/296
Using Yocto Project - advanced usage
Packages variants
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 70/296
Introduction to package variants
Some packages have the same purpose, and only one can be
used at a time.
The build system uses virtual packages to reect this. A
virtual package describes functionalities and several packages
may provide it.
Only one of the packages that provide the functionality will be
compiled and integrated into the resulting image.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 71/296
Variant examples
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 72/296
Package selection
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 73/296
Version selection
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 74/296
Using Yocto Project - advanced usage
Packages
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 75/296
Selection
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 76/296
Exclusion
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 77/296
Using Yocto Project - advanced usage
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 78/296
Common BitBake options
BitBake can be used to run a full build for a given target with
bitbake [target].
But it can be more precise, with optional options:
-c <task> execute the given task
-s list all locally available packages and their
versions
-f force the given task to be run by removing its
stamp le
world keyword for all packages
-b <recipe> execute tasks from the given recipe (without
resolving dependencies).
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 79/296
BitBake examples
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 80/296
shared state cache
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 81/296
Practical lab - Advanced Yocto conguration
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 82/296
Writing recipes - basics
basics
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 83/296
Writing recipes - basics
Recipes: overview
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 84/296
Recipes
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 85/296
Basics
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 86/296
Content of a recipe
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 87/296
Common variables
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 88/296
Writing recipes - basics
Organization of a recipe
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 89/296
Organization of a recipe
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 90/296
Organization of a recipe
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 91/296
The header
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 92/296
The source locations: overview
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 93/296
The source locations: remote les 1/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 94/296
The source locations: remote les 2/2
It's possible to use checksums for more than one le, using
the name parameter:
.
SRC_URI = "http://example.com/src.tar.bz2;name=tarball \
http://example.com/fixes.patch;name=patch"
SRC_URI[tarball.md5sum] = "97b2c3fb082241ab5c56..."
SRC_URI[patch.md5sum]
. = "b184acf9eb39df794ffd..."
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 95/296
The source locations: local les
All local les found in SRC_URI are copied into the package's
working directory, in build/tmp/work/.
The searched paths are dened in the FILESPATH variable.
.
FILESPATH = "${@base_set_filespath([
"${FILE_DIRNAME}/${PN}",
"${FILE_DIRNAME}/${PN}-${PV}",
"${FILE_DIRNAME}/files"], d)}"
FILESOVERRIDES
. = "${MACHINEOVERRIDES}:${DISTROOVERRIDES}"
The base_set_filespath(path) function uses its path
parameter, FILESEXTRAPATHS and FILESOVERRIDES to ll the
FILESPATH variable.
Custom paths and les can be added using FILESEXTRAPATHS
and FILESOVERRIDES.
Prepend the paths, as the order matters.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 96/296
The source locations: tarballs
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 97/296
The source locations: license les
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 98/296
Dependencies 1/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 99/296
Dependencies 2/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 100/296
Tasks
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 101/296
Writing tasks 1/3
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 102/296
Writing tasks 2/3
Example:
.
do_compile() {
${CC} ${CFLAGS} ${LDFLAGS} -o hello ${WORKDIR}/hello.c
}
do_install() {
install -d ${D}${bindir}
install -m 0755 hello ${D}${bindir}
}
.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 103/296
Writing tasks 3/3
Or using a Makele:
.
do_compile() {
oe_runmake
}
do_install() {
install -d ${D}${bindir}
install -m 0755 hello ${D}${bindir}
}
.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 104/296
Modifying existing tasks
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 105/296
Adding new tasks
addtask
. mkimage after do_compile before do_install
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 106/296
Writing recipes - basics
Applying patches
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 107/296
Patches use cases
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 108/296
The source locations: patches
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 109/296
Resolving conicts
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 110/296
Writing recipes - basics
Example of a recipe
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 111/296
Hello world recipe
.
DESCRIPTION = "Hello world program"
HOMEPAGE = "http://example.net/helloworld/"
PRIORITY = "optional"
SECTION = "examples"
LICENSE = "GPLv2"
SRC_URI = "file://hello.c"
LIC_FILES_CHKSUM = \
"file://hello.c;beginline=3;endline=21;md5=58e..."
do_compile() {
${CC} ${CFLAGS} ${LDFLAGS} -o hello ${WORKDIR}/hello.c
}
do_install() {
install -d ${D}${bindir}
install -m 0755 hello ${D}${bindir}
}
.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 112/296
Writing recipes - basics
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 113/296
tar.inc
.
SUMMARY = "GNU file archiving program"
HOMEPAGE = "http://www.gnu.org/software/tar/"
SECTION = "base"
SRC_URI = "${GNU_MIRROR}/tar/tar-${PV}.tar.bz2"
do_configure() { ... }
do_compile() { ... }
do_install()
. { ... }
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 114/296
tar_1.17.bb
.
require tar.inc
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = \
"file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
SRC_URI += "file://avoid_heap_overflow.patch"
SRC_URI[md5sum]
. = "c6c4f1c075dbf0f75c29737faa58f290"
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 115/296
tar_1.26.bb
.
require tar.inc
LICENSE = "GPLv3"
LIC_FILES_CHKSUM = \
"file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
SRC_URI[md5sum]
. = "2cee42a2ff4f1cd4f9298eeeb2264519"
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 116/296
Practical lab - Add a custom application
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 117/296
Writing recipes - advanced
advanced
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 118/296
Writing recipes - advanced
Extending a recipe
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 119/296
Introduction to recipe extensions
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 120/296
Introduction to recipe extensions
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 121/296
Extend a recipe
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 122/296
Extend a recipe
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 123/296
Extend a recipe: compatibility
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 124/296
Writing recipes - advanced
Append le example
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 125/296
Hello world append le
.
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://custom-modification-0.patch \
file://custom-modification-1.patch \
. "
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 126/296
Writing recipes - advanced
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 127/296
Advanced conguration
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 128/296
Providing virtual packages
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 129/296
Writing recipes - advanced
Classes
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 130/296
Introduction to classes
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 131/296
Common classes
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 132/296
The base class
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 133/296
The kernel class
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 134/296
The autotools class
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 135/296
Example: use the autotools class
.
DESCRIPTION = "Print a friendly, customizable greeting"
HOMEPAGE = "https://www.gnu.org/software/hello/"
PRIORITY = "optional"
SECTION = "examples"
LICENSE = "GPLv3"
SRC_URI = "${GNU_MIRROR}/hello/hello-${PV}.tar.gz"
SRC_URI[md5sum] = "67607d2616a0faaf5bc94c59dca7c3cb"
SRC_URI[sha256sum] = "ecbb7a2214196c57ff9340aa71458e1559abd38f6d8d169666846935df191ea7"
LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
.
inherit autotools
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 136/296
The update-alternative class
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 137/296
The useradd class
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 138/296
Example: use the useradd class
.
DESCRIPTION = "useradd class usage example"
PRIORITY = "optional"
SECTION = "examples"
LICENSE = "MIT"
SRC_URI = "file://file0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bc..."
inherit useradd
USERADD_PACKAGES = "${PN}"
USERADD_PARAM = "-u 1000 -d /home/user0 -s /bin/bash user0"
do_install() {
install -m 644 file0 ${D}/home/user0/
chown user0:user0 ${D}/home/user0/file0
.
}
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 139/296
Writing recipes - advanced
Binary packages
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 140/296
Specics for binary packages
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 141/296
Writing recipes - advanced
BitBake le inclusions
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 142/296
Locate les in the build system
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 143/296
The inherit keyword
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 144/296
The include and require keywords
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 145/296
Writing recipes - advanced
Debugging recipes
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 146/296
Debugging recipes
For each task, logs are available in the temp directory in the
work folder of a recipe.
A development shell, exporting the full environment can be
used to debug build failures:
.
$
. bitbake -c devshell <recipe>
To understand what a change in a recipe implies, you can
activate build history in local.conf:
.
INHERIT += "buildhistory"
BUILDHISTORY_COMMIT
. = "1"
Then use the buildhistory-diff tool to examine dierences
between two builds.
./scripts/buildhistory-diff
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 147/296
Writing recipes - advanced
Network usage
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 148/296
Source fetching
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 149/296
Mirror conguration in Poky
.
PREMIRRORS ??= "\
bzr://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
cvs://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
git://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
hg://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
osc://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
p4://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
svk://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
svn://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n"
MIRRORS =+ "\
ftp://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
http://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n \
.
https://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n"
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 150/296
Conguring the mirrors
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 151/296
Forbidding network access
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 152/296
Layers
Embedded Linux
Experts
Layers
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 153/296
Layers
Introduction to layers
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 154/296
Layers' principles
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 155/296
Layers in Poky
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 156/296
Layers in Poky
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 157/296
Poky
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 158/296
Integrate and use a layer 1/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 159/296
Integrate and use a layer 2/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 160/296
Some useful layers
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 161/296
Layers
Creating a layer
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 162/296
Custom layer
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 163/296
Create a custom layer 1/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 164/296
Create a custom layer 2/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 165/296
Use a layer: best practices
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 166/296
Practical lab - Create a custom layer
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 167/296
Practical lab - Extend a recipe
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 168/296
BSP Layers
Embedded Linux
Experts
BSP Layers
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 169/296
BSP Layers
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 170/296
BSP layers
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 171/296
Overview
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 172/296
BSP layers Specics
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 173/296
BSP Layers
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 174/296
Creating a new BSP 1/3
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 175/296
Creating a new BSP 2/3
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 176/296
Creating a new BSP 3/3
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 177/296
BSP Layers
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 178/296
Overview 1/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 179/296
Overview 2/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 180/296
Machine conguration
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 181/296
MACHINE_FEATURES
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 182/296
conf/machine/include/cfa10036.inc
.
# Common definitions for cfa-10036 boards
include conf/machine/include/imx-base.inc
include conf/machine/include/tune-arm926ejs.inc
SOC_FAMILY = "mxs:mx28:cfa10036"
PREFERRED_PROVIDER_virtual/kernel ?= "linux-cfa"
PREFERRED_PROVIDER_virtual/bootloader ?= "barebox"
IMAGE_BOOTLOADER = "barebox"
BAREBOX_BINARY = "barebox"
IMAGE_FSTYPES_mxs = "tar.bz2 barebox.mxsboot-sdcard sdcard.gz"
IMXBOOTLETS_MACHINE = "cfa10036"
KERNEL_IMAGETYPE = "zImage"
KERNEL_DEVICETREE = "imx28-cfa10036.dtb"
# we need the kernel to be installed in the final image
IMAGE_INSTALL_append = " kernel-image kernel-devicetree"
SDCARD_ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3"
SERIAL_CONSOLE = "115200 ttyAMA0"
MACHINE_FEATURES
. = "usbgadget usbhost vfat"
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 183/296
conf/machine/cfa10057.conf
.
#@TYPE: Machine
#@NAME: Crystalfontz CFA-10057
#@SOC: i.MX28
#@DESCRIPTION: Machine configuration for CFA-10057, also called CFA-920
#@MAINTAINER: Alexandre Belloni <alexandre.belloni@free-electrons.com>
include conf/machine/include/cfa10036.inc
KERNEL_DEVICETREE += "imx28-cfa10057.dtb"
.
MACHINE_FEATURES += "touchscreen"
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 184/296
BSP Layers
Formfactor
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 185/296
Overview
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 186/296
Formfactor example
.
HAVE_TOUCHSCREEN=1
HAVE_KEYBOARD=1
DISPLAY_CAN_ROTATE=0
DISPLAY_ORIENTATION=0
DISPLAY_WIDTH_PIXELS=640
DISPLAY_HEIGHT_PIXELS=480
DISPLAY_BPP=16
DISPLAY_DPI=150
DISPLAY_SUBPIXEL_ORDER=vrgb
.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 187/296
BSP Layers
Bootloader
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 188/296
Default bootloader 1/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 189/296
Default bootloader 2/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 190/296
Customize the bootloader
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 191/296
BSP Layers
Kernel
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 192/296
Linux kernel recipes in Yocto
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 193/296
Linux Yocto 1/4
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 194/296
Linux Yocto 2/4
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 195/296
Linux Yocto 3/4
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 196/296
Linux Yocto 4/4
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 197/296
Linux Yocto: Kernel Metadata 1/4
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 198/296
Linux Yocto: Kernel Metadata 2/4
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 199/296
Linux Yocto: Kernel Metadata 3/4
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 200/296
Linux Yocto: Kernel Metadata 4/4
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 201/296
Practical lab - Create a custom machine conguration
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 202/296
Distro Layers
Embedded Linux
Experts
Distro Layers
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 203/296
Distro Layers
Distro Layers
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 204/296
Distro layers
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 205/296
Distro layers
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 206/296
Best practice
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 207/296
Creating a Distro layer
DISTRO = "distro"
DISTRO_NAME = "distro description"
DISTRO_VERSION = "1.0"
.
MAINTAINER = "..."
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 208/296
Toolchain selection
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 209/296
Sample les
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 210/296
Distribute the distribution
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 211/296
Manifest example
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 212/296
Retrieve the project using repo
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 213/296
Images
Embedded Linux
Experts
Images
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 214/296
Images
Introduction to images
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 215/296
Overview 1/3
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 216/296
Overview 2/3
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 217/296
Overview 3/3
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 218/296
Organization of an image recipe
.
require recipes-core/images/core-image-minimal.bb
IMAGE_INSTALL += "ninvaders"
LICENSE
. = "MIT"
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 220/296
Images
Image types
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 221/296
IMAGE_FSTYPES
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 222/296
Creating an image type
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 223/296
wic
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 224/296
Images
Package groups
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 225/296
Overview
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 226/296
Common package groups
packagegroup-core-boot
packagegroup-core-buildessential
packagegroup-core-nfs-client
packagegroup-core-nfs-server
packagegroup-core-tools-debug
packagegroup-core-tools-prole
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 227/296
Example
./meta/recipes-core/packagegroups/packagegroup-core-
tools-debug.bb:
.
SUMMARY = "Debugging tools"
LICENSE = "MIT"
inherit packagegroup
RDEPENDS_${PN} = "\
gdb \
gdbserver \
. strace"
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 228/296
Practical lab - Create a custom image
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 229/296
Application development workow
Application
development Embedded Linux
Experts
workow
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 230/296
Recommended workows
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 231/296
Application development workow
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 232/296
Overview
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 233/296
Advantages
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 234/296
The Yocto Project SDK
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 235/296
Available SDKs
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 236/296
The generic SDK
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 237/296
The image-based SDK
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 238/296
SDK format
Both SDKs are distributed as bash scripts.
These scripts self extract themselves to install the toolchains
and the les they provide.
To install an SDK, retrieve the generated script and execute
it.
The script asks where to install the SDK. Defaults to
/opt/poky/<version>
Example: /opt/poky/2.1
.
$ ./poky-glibc-x86_64-meta-toolchain-cortexa8hf-neon-toolchain-2.1.sh
Poky (Yocto Project Reference Distro) SDK installer version 2.1
===============================================================
Enter target directory for SDK (default: /opt/poky/2.1):
You are about to install the SDK to "/opt/poky/2.1". Proceed[Y/n]?
Extracting SDK.................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source
the environment setup script e.g.
. $ . /opt/poky/2.1/environment-setup-cortexa8hf-neon-poky-linux-gnueabi
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 239/296
Use the SDK
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 240/296
SDK installation
environment-setup-cortexa8hf-neon-poky-linux-gnueabi Exports
environment variables.
site-cong-cortexa8hf-neon-poky-linux-gnueabi Variables used
during the toolchain creation
sysroots SDK binaries, headers and libraries. Contains one
directory for the host and one for the target.
version-cortexa8hf-neon-poky-linux-gnueabi Version information.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 241/296
SDK environment variables
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 242/296
Examples
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 243/296
Application development workow
Devtool
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 244/296
Overview
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 245/296
devtool usage 1/3
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 246/296
devtool usage 2/3
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 247/296
devtool usage 3/3
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 248/296
Application development workow
Quilt
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 249/296
Overview
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 250/296
Using Quilt
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 251/296
Practical lab - Create and use a Poky SDK
Generate an SDK
Compile an application for the
target in the SDK
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 252/296
Licensing
Embedded Linux
Experts
Licensing
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 253/296
Licensing
Managing licenses
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 254/296
Tracking license changes
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 255/296
Package exclusion
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 256/296
Commercial licenses
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 257/296
Writing recipes - going further
going further
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 258/296
Writing recipes - going further
Splitting packages
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 259/296
Benets
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 260/296
Example
SRC_URI[md5sum] = "b9f2a3ba0ba9c78625ee7a50532500d8"
SRC_URI[sha256sum] = "..."
FILES_kexec = "${sbindir}/kexec"
FILES_kdump
. = "${sbindir}/kdump"
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 261/296
Writing recipes - going further
Packages features
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 262/296
Benets
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 263/296
PACKAGECONFIG
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 264/296
Example: from ConnMan
.
PACKAGECONFIG ??= "wifi openvpn"
PACKAGECONFIG[wifi] = "--enable-wifi, \
--disable-wifi, \
wpa-supplicant, \
wpa-supplicant"
PACKAGECONFIG[bluez] = "--enable-bluetooth, \
--disable-bluetooth, \
bluez5, \
bluez5"
PACKAGECONFIG[openvpn] = "--enable-openvpn, \
--disable-openvpn, \
, \
. openvpn"
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 265/296
Writing recipes - going further
Conditional features
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 266/296
Conditional features
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 267/296
Writing recipes - going further
Python tasks
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 268/296
Tasks in Python
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 269/296
Accessing the datastore with Python
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 270/296
Python task example
# Anonymous function
python () {
if d.getVar("FOO", True) == "example":
d.setVar("BAR", "Hello, World.")
}
# Task
python do_settime() {
import time
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 271/296
Writing recipes - going further
Variable ags
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 272/296
Variable ags
do_settime[noexec] = "1"
do_compile[nostamp] = "1"
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 273/296
Writing recipes - going further
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 274/296
Files and directories selection
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 276/296
Example: rootfs creation with .deb packages
.
rootfs_deb_do_rootfs () {
[...]
export INSTALL_ROOTFS_DEB="${IMAGE_ROOTFS}"
[...]
apt-get update
apt-get ${APT_ARGS} install ${package_to_install} \
--force-yes --allow-unauthenticated
[...]
}.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 277/296
Runtime Package Management
Management
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 278/296
Introduction
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 279/296
Requirements
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 280/296
Runtime Package Management
Build conguration
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 281/296
Build conguration 1/2
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 282/296
Build conguration 2/2
To install the required tools on the target, there are two possible
solutions:
By adding package-management to the images features.
The required tool will be installed on the target.
The package database corresponding to the build will be
installed as well.
Or by manually adding the required tools in IMAGE_INSTALL.
For example to use the IPK format we need opkg.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 283/296
Build considerations
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 284/296
Runtime Package Management
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 285/296
Apache2 example setup
DocumentRoot /path/to/build/tmp/deploy/ipk
<Directory /path/to/build/tmp/deploy/ipk>
Options +Indexes
Order allow,deny
allow from all
</Directory>
<VirtualHost>
.
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 286/296
Runtime Package Management
Target conguration
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 287/296
The IPK runtime management software
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 288/296
opkg usage
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 289/296
opkg upgrade over an unstable network
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 290/296
Yocto Project Resources
Resources
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 291/296
Yocto Project documentation
https://www.yoctoproject.org/documentation
Wiki: https://wiki.yoctoproject.org/wiki/Main_Page
http://packages.yoctoproject.org
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 292/296
Useful Reading (1)
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 293/296
Useful Reading (2)
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 294/296
Last slides
Embedded Linux
Experts
Last slides
free electrons
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 295/296
Last slide
Thank you!
And may the Source be with you
free electrons - Embedded Linux, kernel, drivers - Development, consulting, training and support. http://free-electrons.com 296/296