Yocto Tutorial: A Complete Guide For Beginners

In this tutorial, You will learn Yocto and all its major components like Poky, Bitbake, Yocto Recipe. You will learn the build flow of the Yocto Project and get to know about how Bitbake generates the software packages from metadata. Going deep in this tutorial, you will learn how to write the new Bitbake recipe and the Bitbake class for your project and build the image for your target board.

You will gain info on How to Generate Yocto SDK and set up the cross-toolchain on your build machine so you can test code to your target board.

What is Yocto

Yocto Project combines multiple open-source projects that help developers to create custom Linux image for target boards. A Yocto Project provides tools, metadata, and a build framework to create the custom Linux distro for your embedded and IoT devices. It automates the complete build process. Poky is the reference distribution system of the Yocto Project and It contains some metadata, OpenEmbedded core, and Bitbake. Bitbake is a task executor that executes the task according to the recipe.

What is the Bitbake Recipe and bbappend files in Yocto Project

Bitbake recipe is a set of instructions that Bitbake (build engine) takes as input and generate the packages. .bb is the recipe file's extension in the Yocto Project.
Inside the Poky directory, there are many meta-layer that contain the recipe files, and each recipe files 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.