Yocto Main Concepts

From RidgeRun Developer Wiki






Yocto Environment

As mentioned before, Yocto Project is a conjunction of diferent components. The main idea of those components is to provide the user with a set of tools and metadata that enables the creation of a customized Linux based system. The main parts are described in the diagram below:

Yocto layers diagram
Yocto components diagram

Concepts

To create a Yocto project there are several concepts the user must understand first before they start developing on their platforms.

What is OpenEmbedded?

OpenEmbedded is a build system based on "Poky" which works as a task executor for the system. OpenEmbedded essentially has two components:

BitBake

BitBake is a task execution engine that works through recipes, interpreting the metadata to decide, run and execute the tasks. BitBake is one of the most important components of the Yocto Project, so it requires external maintenance from the Yocto Project. There is a comprehensive user manual about BitBake available here: BitBake User Manual

OpenEmbedded-Core

OpenEmbedded-Core or OE-Core contains the fundamental structure to build Linux-based systems. It is a common layer of metadata composed by classes, recipes and associated files that describes how to fetch, configure, build and package the software. Below is the basic structure of oe-core

├── classes
├── classes-global
├── classes-recipe
├── conf
├── COPYING.MIT
├── files
├── lib
├── recipes-bsp
├── recipes-connectivity
├── recipes-core
├── recipes-devtools
├── recipes-extended
├── recipes-gnome
├── recipes-graphics
├── recipes-kernel
├── recipes-multimedia
├── recipes-rt
├── recipes-sato
├── recipes-support
├── recipes.txt
└── site

What is Metadata?

Metadata is the most basic data able to provide information about other data. The metadata is formed by instructions, definitions of values and modifications to building files such as: configuration files, recipes, classes, etc. Here you can see a simple example of metadata describing a dummy Linux Kernel on the system:

SUMMARY = "Dummy Linux kernel"
DESCRIPTION = "Dummy Linux kernel, to be selected as the preferred \
provider for virtual/kernel to satisfy dependencies for situations \
where you wish to build the kernel externally from the build system."
SECTION = "kernel"

What is a recipe?

Recipes are one of the most important parts of BitBake, they are files with the .bb extension. A recipe represents the most basic metadata providing: descriptive information, dependencies, fetching rules, patches, configuration and compilation instructions.

Here you can see an example:

DESCRIPTION = "Hello World"
PN = 'printhello'
PV = '1'

python do_build() {
   bb.plain("*  Hello, World!   *");
}

What is a Meta Layer?

A Meta-Layer is a group of recipes, which are usually organized by categories depending on their functionality. The meta-layers follow the syntax meta-<layername>. In Poky, you can find the following meta-layers:

tree ~/yocto-test/poky/ -L 1 | grep meta
├── meta
├── meta-poky
├── meta-selftest
├── meta-skeleton
├── meta-yocto-bsp

If you take a look to the meta-layer meta-yocto-bsp you could see this meta-layer contains the recipes associated to the Board Support Package.

poky/meta-yocto-bsp$ tree -L 1 ./
./
├── conf
├── lib
├── README.hardware.md
├── recipes-bsp
├── recipes-graphics
├── recipes-kernel
└── wic