KEMBAR78
Yocto - Embedded Linux Distribution Maker | PDF
Embedded Linux @ Information Technology Institute 1
Embedded Linux
Yocto
Information Technology Institute
Sherif Mousa
Embedded Linux @ Information Technology Institute 2
Agenda
●
What is Yocto?
●
Why Yocto?
●
Yocto Project Overview
●
Yocto Key Concept (recipe)
●
Yocto Workflow
●
Yocto Member Organizations
●
Working with Yocto
Embedded Linux @ Information Technology Institute 3
What is Yocto?
It's not an embedded Linux distribution -
It creates a custom one for you.
●
www.yoctoproject.org
●
The Yocto Project is an open-source collaboration project. It
provides templates, tools and methods to help you create custom
Linux-based systems for embedded products regardless of
hardware architecture.
●
Yocto Project uses a build system based on the OpenEmbedded
(OE) project, which uses the BitBake tool, to construct complete
Linux images. The BitBake and OE components are combined
together to form Poky, a reference build system.
Embedded Linux @ Information Technology Institute 4
Why Yocto?
●
Develop using one common Linux OS for different
architectures.
●
Re-use your software stack with future devices.
●
Changing hardware platforms with updating just one line
in a config file and rebuild.
●
Base your work on a validated collection of software and
libraries.
Developers spend lots of time porting or making build systems, leaves
less time and resources to develop value-adding software features.
Embedded Linux @ Information Technology Institute 5
Yocto Project Overview
●
OpenEmbedded (OE) – The overall build architecture
used by the Yocto Project.
●
BitBake – Task executor and scheduler.
●
Metadata – Task definitions.
●
Configuration (*.conf) – global definitions of variables.
●
Classes (*.bbclass) – encapsulation and inheritance of
build logic, packaging, etc.
●
Recipes (*.bb) – the logical units of software/images to
build.
Embedded Linux @ Information Technology Institute 6
Yocto Project Overview (cont'd)
●
OpenEmbedded Core (oe-core) – A core set of
metadata shared by the OpenEmbedded and the
Yocto Project.
●
meta-yocto – Reference policy/distro configuration
and reference hardware support layer.
●
Poky – A pre-prepared combination of the build
system components needed; also the name of our
reference distro in meta-yocto
Poky = Bitbake + OE-core + meta-yocto + docs
Embedded Linux @ Information Technology Institute 7
Yocto Key Concept (recipe)
●
The Yocto Project provides tools and metadata for
creating custom Linux images.
●
These images are created from a repository of 'baked'
recipes.
●
A recipe is a set of instructions for building packages:
– Where to obtain the upstream sources and which patches to
apply
– Dependencies (on libraries or other recipes)
– Configuration/compilation options
– Define which files go into what output packages
Embedded Linux @ Information Technology Institute 8
Yocto Workflow
Embedded Linux @ Information Technology Institute 9
Yocto Member Organizations
Embedded Linux @ Information Technology Institute 10
Working with Yocto
Embedded Linux @ Information Technology Institute 11
Yocto First Shot
●
Download Yocto source
– All releases: http://downloads.yoctoproject.org/releases/yocto/
– Current final release: poky-dizzy-12.0.1.tar.bz2
●
Untar the downloaded file
$ tar xvf poky­dizzy­12.0.1.tar.bz2
●
Go inside the project directory: $ cd poky­dizzy­12.0.1
●
Source the poky default environment script
$ source oe­init­build­env 
●
Configure (if you want) your conf ile: $ vim conf/local.conf
●
Start the build process (and wait ….)
bitbake core­image­minimal
●
Run Qemu emulator with output image
runqemu qemux86
Embedded Linux @ Information Technology Institute 12
Poky Directory Structure
●
bitbake: the BitBake utility itself.
●
documentation: documentation sources.
●
scripts: various support scripts (e.g, runqemu)
●
meta/conf: important configuration files,
bitbake.conf, reference distro config, machine
configs for QEMU architectures.
●
meta/classes: BitBake classes.
●
meta/recipes-* : recipes for all packages & libs
Embedded Linux @ Information Technology Institute 13
Recipe Skeleton
●
Example of a recipe
SUMMARY = “”
DISCRIPTION = “”
HOMEPAGE = “”
LICENSE = “”
SRC_URI = “”
SRC_URI[md5sum] = “”
inherit stuff
don't edit the poky default recipes, but create
your own recipes & layers
Embedded Linux @ Information Technology Institute 14
Yocto Configuration Files
●
Build directory files
●
conf/bblayers.conf
– Contains locations for all layers needed for your build process.
BBLAYERS ?= "  
  /home/user/yocto/poky/meta­yocto  ............
●
conf/local.conf
– Set your build options, choose target machine, add or remove features
from your build image
BB_NUMBER_THREADS = "threads"
PARALLEL_MAKE = "­j threads"
MACHINE ?= "qemuarm"
DL_DIR ?= <download­dir­path>
Embedded Linux @ Information Technology Institute 15
Recipe build steps
●
Building recipes involves executing the following
functions, which can be overridden when needed for
customizations.
– do_fetch
– do_unpack
– do_patch
– do_configure
– do_compile
– do_install
– do_package
Embedded Linux @ Information Technology Institute 16
Layers
●
The Yocto Project build system is composed of
layers.
●
A layer is a logical collection of recipes
representing the core, a Board Support
Package (BSP), or an application stack.
●
All layers have a priority and can override policy
and config settings of the layers beneath it.
Embedded Linux @ Information Technology Institute 17
Board Support Package (BSP)
●
BSPs are layers to enable support for specific
hardware platforms.
●
Defines machine configuration for the “board”.
●
Adds machine-specific recipes and
customizations.
– Kernel config
– Graphics drivers (e.g, Xorg)
– Additional recipes to support hardware features
Embedded Linux @ Information Technology Institute 18
Yocto Layers Stacking
Developers-Specific Layer
Commercial Layer
UI - Optional Layer
Hardware Specific BSP
Yocto Layer Metadata (meta-yocto)
OpenEmbedded Core Metadata (oe-core)
Embedded Linux @ Information Technology Institute 19
Useful Links
●
Yocto Project quick start guide
– yocto-project-qs
●
Bitbake user manual
– bitbake-user-manual
●
Yocto Project development manual
– dev-manual
Embedded Linux @ Information Technology Institute 20
Embedded Linux @ Information Technology Institute 21
sherif.e.mousa@gmail.com
http://about.me/shatrix

Yocto - Embedded Linux Distribution Maker

  • 1.
    Embedded Linux @Information Technology Institute 1 Embedded Linux Yocto Information Technology Institute Sherif Mousa
  • 2.
    Embedded Linux @Information Technology Institute 2 Agenda ● What is Yocto? ● Why Yocto? ● Yocto Project Overview ● Yocto Key Concept (recipe) ● Yocto Workflow ● Yocto Member Organizations ● Working with Yocto
  • 3.
    Embedded Linux @Information Technology Institute 3 What is Yocto? It's not an embedded Linux distribution - It creates a custom one for you. ● www.yoctoproject.org ● The Yocto Project is an open-source collaboration project. It provides templates, tools and methods to help you create custom Linux-based systems for embedded products regardless of hardware architecture. ● Yocto Project uses a build system based on the OpenEmbedded (OE) project, which uses the BitBake tool, to construct complete Linux images. The BitBake and OE components are combined together to form Poky, a reference build system.
  • 4.
    Embedded Linux @Information Technology Institute 4 Why Yocto? ● Develop using one common Linux OS for different architectures. ● Re-use your software stack with future devices. ● Changing hardware platforms with updating just one line in a config file and rebuild. ● Base your work on a validated collection of software and libraries. Developers spend lots of time porting or making build systems, leaves less time and resources to develop value-adding software features.
  • 5.
    Embedded Linux @Information Technology Institute 5 Yocto Project Overview ● OpenEmbedded (OE) – The overall build architecture used by the Yocto Project. ● BitBake – Task executor and scheduler. ● Metadata – Task definitions. ● Configuration (*.conf) – global definitions of variables. ● Classes (*.bbclass) – encapsulation and inheritance of build logic, packaging, etc. ● Recipes (*.bb) – the logical units of software/images to build.
  • 6.
    Embedded Linux @Information Technology Institute 6 Yocto Project Overview (cont'd) ● OpenEmbedded Core (oe-core) – A core set of metadata shared by the OpenEmbedded and the Yocto Project. ● meta-yocto – Reference policy/distro configuration and reference hardware support layer. ● Poky – A pre-prepared combination of the build system components needed; also the name of our reference distro in meta-yocto Poky = Bitbake + OE-core + meta-yocto + docs
  • 7.
    Embedded Linux @Information Technology Institute 7 Yocto Key Concept (recipe) ● The Yocto Project provides tools and metadata for creating custom Linux images. ● These images are created from a repository of 'baked' recipes. ● A recipe is a set of instructions for building packages: – Where to obtain the upstream sources and which patches to apply – Dependencies (on libraries or other recipes) – Configuration/compilation options – Define which files go into what output packages
  • 8.
    Embedded Linux @Information Technology Institute 8 Yocto Workflow
  • 9.
    Embedded Linux @Information Technology Institute 9 Yocto Member Organizations
  • 10.
    Embedded Linux @Information Technology Institute 10 Working with Yocto
  • 11.
    Embedded Linux @Information Technology Institute 11 Yocto First Shot ● Download Yocto source – All releases: http://downloads.yoctoproject.org/releases/yocto/ – Current final release: poky-dizzy-12.0.1.tar.bz2 ● Untar the downloaded file $ tar xvf poky­dizzy­12.0.1.tar.bz2 ● Go inside the project directory: $ cd poky­dizzy­12.0.1 ● Source the poky default environment script $ source oe­init­build­env  ● Configure (if you want) your conf ile: $ vim conf/local.conf ● Start the build process (and wait ….) bitbake core­image­minimal ● Run Qemu emulator with output image runqemu qemux86
  • 12.
    Embedded Linux @Information Technology Institute 12 Poky Directory Structure ● bitbake: the BitBake utility itself. ● documentation: documentation sources. ● scripts: various support scripts (e.g, runqemu) ● meta/conf: important configuration files, bitbake.conf, reference distro config, machine configs for QEMU architectures. ● meta/classes: BitBake classes. ● meta/recipes-* : recipes for all packages & libs
  • 13.
    Embedded Linux @Information Technology Institute 13 Recipe Skeleton ● Example of a recipe SUMMARY = “” DISCRIPTION = “” HOMEPAGE = “” LICENSE = “” SRC_URI = “” SRC_URI[md5sum] = “” inherit stuff don't edit the poky default recipes, but create your own recipes & layers
  • 14.
    Embedded Linux @Information Technology Institute 14 Yocto Configuration Files ● Build directory files ● conf/bblayers.conf – Contains locations for all layers needed for your build process. BBLAYERS ?= "     /home/user/yocto/poky/meta­yocto  ............ ● conf/local.conf – Set your build options, choose target machine, add or remove features from your build image BB_NUMBER_THREADS = "threads" PARALLEL_MAKE = "­j threads" MACHINE ?= "qemuarm" DL_DIR ?= <download­dir­path>
  • 15.
    Embedded Linux @Information Technology Institute 15 Recipe build steps ● Building recipes involves executing the following functions, which can be overridden when needed for customizations. – do_fetch – do_unpack – do_patch – do_configure – do_compile – do_install – do_package
  • 16.
    Embedded Linux @Information Technology Institute 16 Layers ● The Yocto Project build system is composed of layers. ● A layer is a logical collection of recipes representing the core, a Board Support Package (BSP), or an application stack. ● All layers have a priority and can override policy and config settings of the layers beneath it.
  • 17.
    Embedded Linux @Information Technology Institute 17 Board Support Package (BSP) ● BSPs are layers to enable support for specific hardware platforms. ● Defines machine configuration for the “board”. ● Adds machine-specific recipes and customizations. – Kernel config – Graphics drivers (e.g, Xorg) – Additional recipes to support hardware features
  • 18.
    Embedded Linux @Information Technology Institute 18 Yocto Layers Stacking Developers-Specific Layer Commercial Layer UI - Optional Layer Hardware Specific BSP Yocto Layer Metadata (meta-yocto) OpenEmbedded Core Metadata (oe-core)
  • 19.
    Embedded Linux @Information Technology Institute 19 Useful Links ● Yocto Project quick start guide – yocto-project-qs ● Bitbake user manual – bitbake-user-manual ● Yocto Project development manual – dev-manual
  • 20.
    Embedded Linux @Information Technology Institute 20
  • 21.
    Embedded Linux @Information Technology Institute 21 sherif.e.mousa@gmail.com http://about.me/shatrix