1 Introduction to Yocto
1.1 What is the Yocto Project?
The Yocto Project is a working group of the Linux Foundation, an open-source collaboration project that helps developers create custom systems based on Linux, specifically designed for embedded products and independent of the hardware architecture of the products. The Yocto Project provides a flexible toolset and development environment that enables embedded device developers worldwide to create these customized Linux images through shared technologies, software stacks, configurations, and best practices.
Thousands of developers globally have found that the Yocto Project offers advantages in system and application development, archiving and management, and customization for speed, footprint, and memory utilization. The project serves as a standard for providing embedded software stacks. It allows for software customization and build interchange across multiple hardware platforms and enables maintenance and expansion of software stacks.
Yocto provides templates, tools, and methods to help us create Linux-based custom systems for embedded products without regard to the hardware architecture. It can generate custom Linux distributions for bare-metal development based on the glibc and musl C standard libraries as well as Real-Time Operating System (RTOS) toolchains, similar to what the Zephyr project does.
The project is managed by members of the Linux Foundation, independent of member organizations, which participate in various ways and provide resources to the project.
Founded in 2010, the project was a collaborative effort among numerous hardware manufacturers, open-source operating systems, vendors, and electronics companies aimed at reducing duplication of effort and providing resources and information for both new and existing users. These resources include core system components provided by the OpenEmbedded project, known as OpenEmbedded Core.
The Yocto Project brings together multiple companies, communities, projects, and tools, all with the same goal—building Linux-based embedded products. These stakeholders work together in harmony, driven by community needs.
To help us understand the roles and outcomes of the Yocto Project, we can use a calculator analogy. The input is a set of data describing what we want, our specifications. The output is the Linux-based embedded product we desire. The output consists of various parts of the operating system, including the Linux kernel, bootloader, and root filesystem (rootfs), which are bundled and organized to work together.
The tools of the Yocto Project are used for all intermediate steps to generate rootfs bundles and other deliverables. Previously built software components can be reused across different build processes (applications, libraries, or any software components).
If reuse is not possible, software components are built in the correct order and with the required configurations, including fetching the necessary source code from their respective repositories (such as the Linux kernel archive (www.kernel.org), GitHub, BitBucket, and GitLab).
The tools of the Yocto Project prepare the build environment, utilities, and toolchains, reducing dependencies on host software. These utilities, versions, and configuration options are independent of the host Linux distribution while maximizing the number of host utilities that need to be depended upon, thus greatly improving determinism, reducing dependence on the build host, and increasing the success rate of first builds.
BitBake and OpenEmbedded Core belong to the OpenEmbedded project, while some projects like Poky belong to the Yocto project. They complement each other and play specific roles within the system. We will explore in detail how they work together in this chapter and throughout this book.
1.2 Alliance between OpenEmbedded Project and Yocto Project
The OpenEmbedded project was created around January 2003 when some core developers from the OpenZaurus project began using a new build system. From the very start, the OpenEmbedded build system was a task scheduler inspired by the Gentoo Portage package system, known as BitBake. Consequently, the project’s software collection and list of supported machines grew rapidly.
Due to a chaotic and uncoordinated development process, using OpenEmbedded in products that require a more stable and refined codebase was quite challenging, which led to the emergence of the Poky distribution. Poky was initially a subset of the OpenEmbedded build system, offering a more refined and stable codebase within a limited architecture. Additionally, with its reduced scale, Poky was able to develop some highlight technologies such as integrated development environment plugins and fast emulator (QEMU) integration, which are still in use today.
The Yocto Project and the OpenEmbedded project are integrated on a core build system called OpenEmbedded Core. It adopts the essence of Poky and OpenEmbedded, emphasizing the use of additional components, metadata, and subsets. Around November 2010, the Linux Foundation announced that the Yocto Project would continue this work under the sponsorship of the Linux Foundation.
1.3 Understanding Poky
Poky is the default reference distribution of the Yocto Project, utilizing OpenEmbedded build system technology. It consists of a collection of tools, configuration files, and recipe data (known as metadata). It is platform-independent and performs cross-compilation using the BitBake tool, OpenEmbedded Core, and the default metadata set, as shown in the figure below. Additionally, it provides a mechanism for building and combining thousands of distributed open-source projects, forming a fully customizable, complete, and coherent Linux software stack.
The primary goal of Poky is to provide all the functionality needed by embedded developers.
1.3.1 BitBake
BitBake is a task scheduler and execution system that parses Python and Shell script code. The parsed code generates and runs tasks, which are a series of steps ordered according to their dependencies.
BitBake evaluates all available metadata, manages dynamic variable expansion, dependencies, and code generation. Moreover, it tracks all tasks to ensure their completion, maximizing processing resource utilization, shortening build times, and improving predictability. Development of BitBake occurs in the bitbake-devel mailing list, with the source code located in the bitbake subdirectory of Poky.
1.3.2 OpenEmbedded Core
The OpenEmbedded Core metadata set provides the engine for the Poky build system. It offers core functionalities and strives to be as general and minimal as possible. It supports seven different processor architectures (ARM, ARM64, x86, x86-64, PowerPC, PowerPC 64, MIPS, MIPS64, RISC-V32, and RISC-V 64), and only supports QEMU emulated platforms. Development work is focused on the openembedded-core mailing list, with its metadata stored in the meta subdirectory of Poky.
1.3.2 Metadata
Metadata includes recipes and configuration files. It comprises a mix of Python and Shell Script text files, providing very flexible tools. Poky utilizes it to extend OpenEmbedded Core and includes two different layers, which are subsets of additional metadata, as follows:
-
meta-poky
This layer provides default and supported release policies, visual branding, and metadata tracking information (maintainers, upstream status, etc.). This layer serves as a curated template for distribution builders to seed their custom distributions.
-
meta-yocto-bsp
Provides Board Support Packages (BSP) as reference hardware for the Yocto Project’s development and quality assurance (QA) processes. Chapter 9, “Developing with the Yocto Project,” will explore metadata in more detail and serve as a reference when we write recipes.
References
-
Software Testing Boutique Documentation Download Continues to Update https://github.com/china-testing/python-testing-examples Please like, thank you!
-
This article involves Python testing development libraries Thank you for liking! https://github.com/china-testing/python_cn_resouce
-
Python Boutique Book Download https://github.com/china-testing/python_cn_resouce/blob/main/python_good_books.md
-
Linux Boutique Book Download https://www.cnblogs.com/testing-/p/17438558.html
1.4 Yocto Project Releases
The project releases a version every six months, in April and October. This release cycle ensures a continuous development process while providing more testing points and focusing on stability. Once a version is ready, it becomes a stable release or a Long-Term Support (LTS) version.
The support period for stable and Long-Term Support versions varies significantly. The support period for stable versions is 7 months, with a 1-month overlapping support period for each stable release. The minimum support period for LTS versions is 2 years, with the option to extend it. After the official support period ends, the project transitions to community support, ultimately reaching the End of Life (EOL).
After the official release support period ends, if community members join as community maintainers, the release version can transition to community-supported versions. Finally, when the source code has no changes for two months, or the community maintainers are no longer active members, the release version will transition to EOL.
The figure below shows the two release cycles:
The table below provides the Yocto Project’s versions, codenames, release dates, and current support levels, as shown below. Updated tables can be found at https://wiki.yoctoproject.org/