practical development with yocto - intel® software · pdf filepractical development with...
TRANSCRIPT
Practical Development with Yocto
Jiajun Xu
Intel Corporation
Agenda
• Basic background(images, recipes, etc)
• Customize images with layers
• What’s more
The Yocto Project* Upstream
Open Source Components
Customized Yocto Images
Core Recipes
Poky Build System
Yocto Metadata Layers Hosted Projects
Busybox, eglibc, udev, …
Build profiles
Feature Layers
Customization Layers
User’s Own Layers (features, BSPs,
footprint, …)
App Dev Tool for The Device
Embedded Linux Product for The device
Fetch Unpack
Compile Install Packaging Generate rootfs
Configure
Swabber
Pseudo Prelink
Eclipse/Anjuta
Plugins
The Yocto Project
Yocto
Kernel
Documentations
…
BSP Layers
The Yocto Project in a Nutshell
• Tools and metadata for creating custom embedded systems – Images are tailored to specific hardware and use cases – But metadata is generally arch-independent – Unlike a distribution, we know what we need in advance
• An image is a collection of 'baked' recipes (packages) • A 'recipe' is a set of instructions for building 'packages'
– Where to get the source and which patches to apply – Dependencies (on libraries or other recipes, for example) – Config/compile options, 'install' customization
• A 'layer' is a logical collection of recipes representing the core, a board support package (BSP), or an application stack
Recipes
• Different frameworks or toolkits in Yocto for multimedia/graphics development
OE-Core
Kernel
Core Utils/Libs
Connectivity
Graphics
Multimedia
•~800 recipes available •Extendable to port more from OE •Capable to write your own
Support Recipe Homepage
Gstreamer http://gstreamer.freedesktop.o
rg/
Clutter http://www.clutter-project.org/
Qt http://qt.nokia.com/
GTK+ http://www.gtk.org
Core Recipes
Yocto Metadata Layers
Feature Layers
BSP Layers
Customization Layers
Layers
• Stacked layers allow deep customization with low maintenance cost. – Add new recipes – Tune arch specific flags – Override package options
• A sample stack in the right side – Commercial layers from embedded
OSVs or ISVs – BSP layers from Intel or other silicon
vendors
OpenEmbedded Core Metadata
Yocto-specific Metadata
BSP Layer
UI-specific Layer
Commercial Layer
Developer-specific Layer
•A lot of layers in Yocto for you to pour them at the site.
Media Server layer on BSP layer
• Suppose we're working on a project to create a Media Server
• We're going to use the Yocto Project Build System
• Meta-esdc2012 is chosen as BSP layer
• We know we'll need a custom image definition for our product, and a layer to keep our changes in, let's start there
Media Server Layer Demo
Sugarbay Sandybridge
Rygel(uPnP)/Clutter
eMenlow Atom Z5xx MediaTomb
uPnP Content Directory Audio/Video Renderer
esdc2012 Atom Z6xx Rygel/ Sato
Control Point
uPnP Action
• Yocto running on 3 BSPs • Stream audio & video over uPnP
Media Server Layer Demo - Cont
• What to add for new layer?
Mediatomb
Write recipe from scratch Reuse in Yocto
expat
ffmpeg
glib
Rygel GUPnP
gstreamer alsa clutter
sqlite3
curl
e2fsprogs zlib
libgsm
libsoup
libgee
libxml
Gtk+
Core Recipes
Yocto Metadata Layers
Feature Layers
Customization Layers
meta-esdc2012 libva
x11-sato
BSP Layers
Media Server Layer Demo - Cont
• Media Server layer – Mediatomb: uPnP AV MediaServer for
Linux
– Rygel: Collection of DLNA(UPnP AV) devices, implemented through a plug-in mechanism
– GUPnP: GUPnP is an elegant, object-oriented open source framework for creating UPnP devices and control points.
• BSP layer – esdc2012
• Feature layer – x11-sato
• Core Recipes – meta
– meta-yocto
Mediatomb
Write recipe from scratch Reuse in Yocto
expat
ffmpeg
glib
Rygel GUPnP
gstreamer alsa clutter
sqlite3
curl
e2fsprogs zlib
libgsm
libsoup
libgee
libxml
Gtk+
meta-esdc2012 libva
x11-sato
Media Server Layer Demo - Cont
|-- conf/ | `-- layer.conf |-- images/ | |-- demo-image-mediatomb.bb | |-- demo-image-rygel.bb |-- recipes-bsp/ |-- recipes-connectivity/ | `-- gupnp/ | |-- gupnp-av_0.7.1.bb | |-- gupnp-dlna_0.5.0.bb | |-- gupnp-tools_0.8.1.bb | `-- gupnp_0.15.0.bb |-- recipes-graphics/ |-- recipes-multimedia/ | |-- mediatomb/ | | `-- mediatomb_0.12.1.bb | |-- rygel/ | | `-- rygel_0.8.3.bb |-- recipes-networking/ `-- recipes-support/
conf/layer.conf
# We have a conf and classes directory, add to BBPATH BBPATH := "${BBPATH}:${LAYERDIR}" # We have an images and various recipe-* directories, add to BBFILES BBFILES := "${BBFILES} ${LAYERDIR}/images/*.bb
${LAYERDIR}/images/*.bbappend ${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "demo" BBFILE_PATTERN_demo := "^${LAYERDIR}/" BBFILE_PRIORITY_demo = "6"
gupnp-tools_0.8.1.bb
DESCRIPTION = "Tools for GUPnP"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
file://src/av-cp/main.c;beginline=6;endline=19;md5=957b9dd69975d5414473b1251aab0d8e”
DEPENDS = "gupnp gtk+ libglade gnome-icon-theme" PR = "r0"
SRC_URI = "http://gupnp.org/sites/all/files/sources/${PN}-${PV}.tar.gz"
SRC_URI[md5sum] = "d8a44a8c19b1cc10b8e5508448d8493f"
SRC_URI[sha256sum] = "3b46a76fcbb0188b8d2c406e514edc7662d65f48774c81e5a19f93d7706db302"
inherit autotools pkgconfig
Specify build dependencies
Where to fetch source
Inherit internal classes: autotools/pkgconfig Then Poky takes care of all the rest of the build tasks in the background: compile install packaging sysroot population …
demo-image-mediatomb.bb require recipes-core/images/core-image-minimal.bb
SRC_URI = "file://interfaces \
file://fstab \
file://config.xml"
IMAGE_INSTALL += "dropbear mediatomb task-core-nfs-server"
LICENSE = "MIT"
PR = "r2"
ROOTFS_POSTPROCESS_COMMAND += "setup_target_image ; "
setup_target_image() {
# Configure mediatomb to autoscan /media/storage
install -m 0644 ${WORKDIR}/config.xml ${IMAGE_ROOTFS}/etc/mediatomb/config.xml
}
Inherit existing image profile
Declare extra packages to be installed
Extra operations after image rootfs is created
task-core-nfs.bb* DESCRIPTION = "NFS tasks for Poky"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
PR = "r1"
PACKAGES = "\
task-core-nfs-server \
task-core-nfs-server-dbg \
task-core-nfs-server-dev \
"
ALLOW_EMPTY = "1"
RDEPENDS_task-core-nfs-server = "\
nfs-utils \
nfs-utils-client \
" # rpcinfo can be useful but only with glibc images
GLIBC_DEPENDENCIES = "glibc-utils"
RRECOMMENDS_task-core-nfs-server_append_libc-glibc = " ${GLIBC_DEPENDENCIES}"
Specify the name of packages
Packages needed for runtime, will be automatically installed in image
*: exists in core recipes
Configure bblayers.conf
• The build/conf/bblayers.conf needs to know where to find the new layer
# LCONF_VERSION is increased each time build/conf/bblayers.conf # changes incompatibly LCONF_VERSION = "4" BBFILES ?= "" BBLAYERS = " \ /yocto/esdc/meta \ /yocto/esdc/meta-yocto \ /yocto/esdc/meta-intel \ /yocto/esdc/meta-intel/meta-esdc2012 \ # BSP Layer /yocto/esdc/meta-demo \ # Demo Layer "
Then you get…
• Image recipe built for any architecture
• All share same set of recipes, just compiled for the target
• Created Layer which contains
– Recipes
– Tasks
– Images
• http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-contrib/log/?h=esdc2012/meta-demo
What’s More • core-image-minimal, core-image-sato, core-
image-lsb, core-image-clutter, core-image-gtk-directfb, etc…
• Specifies the packages to install
• alsa, bluetooth, ext2, irda, keyboard, pci, pcimcia, usbgadget, usbhost, wifi, ipsec, touchscreen, serial, etc…
• apps-console-core, x11-sato, apps-x11-games, tools-sdk, tools-debug, tools-profile, etc…
DISTRO_FEATURES
IMAGE_INSTALL
FEATURES
MACHINE_FEATURES
IMAGE_FEATURES
IMAGES
Examples
• IMAGE_INSTALL: – In local.conf
######
IMAGE_INSTALL_append = " package-name“ ######
– Others: ########## (core-image-minimal.bb) DESCRIPTION = "A small image just capable of allowing a device to boot."
IMAGE_INSTALL = "task-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
IMAGE_LINGUAS = " " LICENSE = "MIT" inherit core-image IMAGE_ROOTFS_SIZE = "8192" # remove not needed ipkg informations ROOTFS_POSTPROCESS_COMMAND += "remove_packaging_data_files ; “ ###########
Examples
• DISTRO_FEATURES: ########## (default-distrovars.inc) ….. IMAGE_LINGUAS ?= "en-us en-gb" LIMIT_BUILT_LOCALES ?= "POSIX en_US en_GB" ENABLE_BINARY_LOCALE_GENERATION ?= "1" LOCALE_UTF8_ONLY ?= "0" DISTRO_FEATURES_LIBC ?= "ipv4 ipv6 libc-backtrace libc-big-macros libc-bsd libc-cxx-tests libc-catgets libc-charsets libc-
crypt \ libc-crypt-ufc libc-db-aliases libc-envz libc-fcvt libc-fmtmsg libc-fstab libc-ftraverse \ libc-getlogin libc-idn libc-inet-anl libc-libm libc-libm-big libc-locales libc-locale-code \ libc-memusage libc-nis libc-nsswitch libc-rcmd libc-rtld-debug libc-spawn libc-streams libc-
sunrpc \ libc-utmp libc-utmpx libc-wordexp libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-
glibc \ libc-posix-wchar-io"
DISTRO_FEATURES ?= "alsa argp bluetooth ext2 irda largefile pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g x11 ${DISTRO_FEATURES_LIBC}"
IMAGE_FEATURES ?= "" ###########
Examples
• MACHINE_FEATURES: ########## (ia32-base.inc) …
MACHINE_FEATURES += "kernel26 screen keyboard pci usbhost ext2 ext3 x86 \ acpi serial usbgadget alsa"
MACHINE_EXTRA_RRECOMMENDS += "kernel-modules eee-acpi-scripts" MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "grub" IMAGE_FSTYPES += "ext3 cpio.gz live" KERNEL_IMAGETYPE ?= "bzImage" SERIAL_CONSOLE ?= "115200 ttyS0" # # glibc-related variables # GLIBC_ADDONS ?= "nptl" GLIBC_EXTRA_OECONF += "--with-tls" # # kernel-related variables PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto" PREFERRED_VERSION_linux-yocto ?= "3.0%" PREFERRED_PROVIDER_linux-libc-headers ?= "linux-libc-headers-yocto" ###########
Examples
• IMAGE_FEATURES: ########## (core-image-base.bb)
DESCRIPTION = "A console-only image that fully supports the target device \
hardware."
IMAGE_FEATURES += "apps-console-core"
LICENSE = "MIT"
inherit core-image
###########
Reference
• Mediatomb: http://mediatomb.cc/
• GStreamer: http://gstreamer.freedesktop.org/
• Clutter: http://www.clutter-project.org/
• GTK+: http://www.gtk.org
• Rygel: http://live.gnome.org/Rygel
• GUPnP: http://gupnp.org/
• libva: http://www.freedesktop.org/wiki/Software/vaapi
• ffmpeg: http://ffmpeg.mplayerhq.hu/
• libgee: http://live.gnome.org/Libgee
• expat: http://expat.sourceforge.net/
• curl: http://curl.haxx.se/
• libxml: http://www.xmlsoft.org/
• sqlite3: http://www.sqlite.org
• zlib: http://zlib.net/
• e2fsprogs: http://e2fsprogs.sourceforge.net/
• libsoup: http://www.gnome.org/
Legal Information
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL® PRODUCTS. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY RELATING TO SALE AND/OR USE OF INTEL PRODUCTS, INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT, OR OTHER INTELLECTUAL PROPERTY RIGHT.
Intel may make changes to specifications, product descriptions, and plans at any time, without notice.
All dates provided are subject to change without notice.
Intel is a trademark of Intel Corporation in the U.S. and other countries.
*Other names and brands may be claimed as the property of others.
Copyright © 2012, Intel Corporation. All rights reserved.