Introduction to the Yocto Project, Poky, and Bitbake
The Yocto Project combines multiple open-source projects to help developers create custom Linux images for target boards. It provides tools, metadata, and a build framework to create custom Linux distributions for embedded and IoT devices, automating the entire build process. Poky is the reference distribution of the Yocto Project and includes metadata, the OpenEmbedded core, and Bitbake. Bitbake is a task executor that runs tasks according to recipes.
What are the advantages of the Yocto Project over other build tools?
- The Yocto Project automates the build process and makes it easy to customize (add, remove, modify) the packages in a Linux distro.
- It is the most popular and widely used build tool in the semiconductor industry.
- It is easy to maintain layers and recipes.
- Very good training documentation is available.
In this Yocto tutorial, we are focusing on learning the following topics:
Overview of the Yocto Project:
- It is an open-source project for building custom Linux OS for target boards. It is a collection of build frameworks (build systems), tools, and metadata. Its major components are OpenEmbedded, Poky, and Bitbake. The Yocto Project supports many different architectures (PowerPC, ARM, x86/64, etc.) and hardware platforms.
What are the major components of the Yocto Project:
The Yocto Project has collaborated with many other open-source projects to ease the development of custom Linux images. Its core components are the Poky and OpenEmbedded build systems.
Poky
- It is the reference distribution of the Yocto Project and provides an OpenEmbedded build system (Bitbake and OpenEmbedded Core) as well as a set of metadata to help create custom distros.
- Poky =Bitbake + meta data
- It supports as a reference for the following platforms: BeagleBone Black, Raspberry Pi, QEMU (Emulator), and generic x86-64.
- Every six-month Yocto project team releases a new version of poky.
- Download the Poky from the below link:
git clone https://git.yoctoproject.org/git/poky
Downloading Poky for the remote repository
OpenEmbedded
- OpenEmbedded is a build framework that consists of OE-core metadata and Bitbake build engine.
- OE-core is the base layer of the Yocto project and contains a Bitbake layer, recipe, classes, and tools.
Bitbake
- It is the build engine in the Yocto Project. It executes tasks according to provided recipes, classes, configuration files, and metadata.
- Bitbake is a Python program that takes recipe files (.bb and .bbappend) as input and performs the following tasks –
- Fetch: Downloads the source file from a local or remote repository.
- Unpack: Extracts the source files into the source directory.
- Patch: Applies the patch to the source code.
- Configure: Sets the flags for the software being built.
- Build: Compiles the source files and generates the executable program.
- Installation: Copies the executable program and other files to the target directory.
- Package: Generates the package for the target system according to the chosen package management system.
Directory Layout of Poky in the Yocto Project:
In the Yocto Project, Directory Structure is very optimized and always follows the same. Poky directory contains meta-directory layers, Bitbake, etc.
poky directory layout
Bitbake Directory
- It is the main part of the OpenEmbedded build system that parses the Recipe and executes the tasks.
Meta Directory
- It contains recipes, class, and configuration files for many packages.
- Machine configuration: It provides information about the architecture and which kernel to build.
Yocto recipe layer directory structure
NOTE: Always start the Yocto build process without a root user.