Yocto Tutorial: A Complete Guide For Beginners

In this tutorial, you will learn about Yocto and its major components like Poky, Bitbake, and Yocto Recipe. You will understand the build flow of the Yocto Project and how Bitbake generates software packages from metadata. As you progress through the tutorial, you will learn how to write a new Bitbake recipe and Bitbake class for your project and build the image for your target board.

You will also learn how to generate a Yocto SDK and set up the cross-toolchain on your build machine, enabling you to test code on your target board.

What is Yocto

The Yocto Project combines multiple open-source projects to help developers create custom Linux images for target boards. The Yocto Project provides tools, metadata, and a build framework to create custom Linux distributions for embedded and IoT devices. Poky is the reference distribution system of the Yocto Project and contains metadata, OpenEmbedded Core, and Bitbake. Bitbake is a task executor that runs tasks according to the recipes.

What are the Bitbake Recipe and .bbappend files in the Yocto Project ?

A Bitbake recipe is a set of instructions that the Bitbake build engine takes as input to generate packages. The .bb extension is used for recipe files in the Yocto Project. Inside the Poky directory, there are multiple meta-layers that contain recipe files, and each recipe file is associated with a particular software package.

Bitbake Steps

In this tutorial, you will learn how to set up a host system for Yocto Project development and what are the basic steps to generate an image for QEMU (Quick Emulator).
You don’t require any extra hardware for the QEMU emulator build. You need to verify the build by running the QEMU emulator on the host system only.

In this tutorial, you will learn how to create a new meta-layer and how to write a new hello world bitbake recipe in the Yocto Project. We will build the image with hello recipe for QEMU and verify this package present in the rootfs.

Beaglebone Black is a low-cost ARM Cortex-A8-based development board. it gives the flexibility to boot from an SD card or onboard emmc. Yocto Project officially supports the beaglebone black board and provides minimal bootable BSP support for beaglebone board.

Raspberry pi is a very popular development board for IoT and Industrial projects.it comes in many different versions like Raspberry pi 4, Raspberry Pi 3, and Raspberry 2, etc. Yocto is an open-source project which provides a build framework and metadata to help to create a custom image for your target board also it supports the raspberry pi BSP layer.

Yocto Project is used to create the build for a specific machine (target board). In the Yocto project, we need to provide the machine name in the configuration file and each machine refers to a development board or hardware platform.

In Yocto, bitbake is used to build the recipes. for the full clean build, it needs to rebuild all recipes from scratch.
To make a full clean build follow the below steps:

Yocto Build system takes a few hours to complete the build process. This is a major drawback of the Yocto Project build system but it provides a mechanism to reduce the build time.

Bitabke is a build-engine in Yocto Project which helps to build the custom image for your target boards
We can perform various things using the bitbake commands so in this tutorial, I am providing the useful bitbake commands which help during the Yocto build.

Packagegroup is a bundle of multiple packages. You can easily add these packages to the image using the package group name.

This tutorial provides info on Yocto SDK and how you can generate the SDK and install it on the host machine to start developing the application for your target board.

This tutorial list useful Bitbake command to help the developers.

In yocto project, the meta layer provides a kernel recipe to build the kernel using the default kernel configuration. If there is a need to add configurations or override the default kernel configuration, then the following steps should be followed.

This tutorial explains how to create and compile a Hello World recipe using makefile.