Meeting the Yocto Project
本章向你介绍 Yocto 项目。这里讨论的项目主要概念将贯穿全书。此外,我们还将简要讨论 Yocto 项目的历史、OpenEmbedded、Poky、BitBake、元数据和版本模式。系好安全带,欢迎加入我们的行列!
This chapter introduces you to the Yocto Project. The main concepts of the project discussed here are constantly used throughout the book. In addition, we will briefly discuss the history of the Yocto Project, OpenEmbedded, Poky, BitBake, metadata, and versioning schema. So, fasten your seat belt, and welcome aboard!
1, What is the Yocto Project?
Yocto 项目是 Linux 基金会的一个工作组,其定义如下:
Yocto 项目是一个开源协作项目,帮助开发人员创建基于 Linux 的定制系统,这些系统专为嵌入式产品而设计,与产品的硬件架构无关。Yocto 项目提供了一个灵活的工具集和开发环境,使世界各地的嵌入式设备开发人员能够通过共享技术、软件堆栈、配置和用于创建这些定制 Linux 映像的最佳实践进行协作。
The Yocto Project is a Linux Foundation workgroup and is defined as follows:
The Yocto Project is an open source collaboration project that helps developers create custom Linux-based systems that are designed for embedded products regardless of the product’s hardware architecture. Yocto Project provides a flexible toolset and a development environment that allows embedded device developers across the world to collaborate through shared technologies, software stacks, configurations, and best practices used to create these tailored Linux images.
全球数以千计的开发人员发现,Yocto Project 在系统和应用程序开发,存档和管理收益,以及用于速度、占用空间和内存利用的定制方面都具有优势。该项目是提供嵌入式软件栈的标准。该项目允许针对多种硬件平台进行软件定制和构建交换,并允许维护和扩展软件栈。
Thousands of developers worldwide have discovered that Yocto Project provides advantages in both systems and applications development, archival and management benefits, and customizations used for speed, footprint, and memory utilization. The project is a standard when it comes to delivering embedded software stacks. The project allows software customizations and build interchange for multiple hardware platforms as well as software stacks that can be maintained and scaled.
- Yocto Project Overview and Concepts Manual (Yocto 项目概述和概念手册)
Yocto 项目是一个开源协作项目。它提供模板、工具和方法,帮助我们为嵌入式产品创建基于 Linux 的定制系统,而不受硬件架构的限制。它可以根据 glibc 和 musl C 标准库
生成定制的 Linux 发行版,也可以为裸机开发生成实时操作系统(RTOS)工具链,如 Zephyr 项目所做的那样。
The Yocto Project is an open source collaboration project. It supplies templates, tools, and methods to help us create custom Linux-based systems for embedded products, regardless of the hardware architecture. It can generate tailored Linux distributions based on the glibc and musl C standard libraries and the Real-Time Operating System (RTOS) toolchains for bare-metal development, as done by the Zephyr Project.
该项目由 Linux 基金会成员管理,独立于成员组织,成员组织以多种方式参与该项目并为其提供资源。
Being managed by a Linux Foundation member, the project stays independent of the member organizations, which participate in many ways and supply resources to the project.
该项目成立于 2010 年,由众多硬件制造商、开源操作系统、供应商和电子公司合作完成,旨在减少重复工作,并为新老用户提供资源和信息。这些资源包括 OpenEmbedded 项目提供的核心系统组件 OpenEmbedded Core。
It was founded in 2010 as a collaboration of many hardware manufacturers, open source operating systems, vendors, and electronics companies to reduce duplication of work and supply resources and information catering to new and experienced users. Among these resources is OpenEmbedded Core, the core system component provided by the OpenEmbedded project.
Yocto 项目汇聚了多家公司、社区、项目和工具,它们都有一个共同的目标---构建基于 Linux 的嵌入式产品。这些利益相关者同舟共济,在社区需求的驱动下携手合作。
The Yocto Project aggregates several companies, communities, projects, and tools with the same purpose – to build Linux-based embedded products. These stakeholders are in the same boat, driven by their community needs to work together.
2, Delineating the Yocto Project /
Yocto 项目的概述
为了便于我们理解 Yocto 项目的职责和成果,我们可以用计算器来做类比。输入是一组描述我们所需的数据,即我们的规格。输出则是我们想要的基于 Linux 的嵌入式产品。
To ease our understanding of the duties and outcomes of the Yocto Project, we can use the analogy of a computing machine. The input is a set of data that describes what we want, that is, our specification. As an output, we have the desired Linux-based embedded product.
输出由操作系统的各个部分组成。它包括 Linux 内核、引导加载器和根文件系统(rootfs),它们被捆绑在一起并组织在一起工作。
The output is composed of the pieces of the operating system. It encompasses the Linux kernel, bootloader, and the root filesystem (rootfs) bundled and organized to work together.
Yocto 项目的工具可用于所有中间步骤,以生成 rootfs 捆绑包和其他交付成果。先前构建的软件组件可在构建过程中重复使用,包括应用程序、库或任何软件组件。
The Yocto Project’s tools are present in all intermediary steps to produce the resultant rootfs bundle and other deliverables. The previously built software components are reused across builds – applications, libraries, or any software component.
如果无法重复使用,则按照正确的顺序和所需的配置构建软件组件,包括从各自的源代码库(如 Linux 内核档案库 (
www.kernel.org)、GitHub、BitBucket 和 GitLab)获取所需的源代码。
When reuse is not possible, the software components are built in the correct order and with the desired configuration, including fetching the required source code from their respective repositories, such as The Linux Kernel Archives (www.kernel.org), GitHub, BitBucket, and GitLab.
Yocto 项目的工具为其构建环境、实用程序和工具链做好了准备,从而减少了对主机软件的依赖。这些实用程序、版本和配置选项都独立于主机 Linux 发行版,从而在产生相同结果的同时,最大限度地减少了对主机实用程序的依赖。一个微妙但重要的好处是,它大大提高了确定性,减少了对构建主机的依赖,同时提高了首次构建的成功率。
The Yocto Project’s tools prepare its build environment, utilities, and toolchains, reducing the host software dependency. The utilities, versions, and configuration options are independent of the host Linux distribution, minimizing the number of host utilities to rely on while producing the same result. A subtle but essential implication benefit is the considerable increase in determinism, reduced build host dependencies, but increased first-time builds.
BitBake 和 OpenEmbedded Core 属于 OpenEmbedded 项目,而 Poky 等一些项目则属于 Yocto 项目。它们互为补充,在系统中发挥着特定的作用。我们将在本章和本书中详细了解它们是如何协同工作的。
BitBake and OpenEmbedded Core are under the OpenEmbedded project umbrella, while some projects, such as Poky, are under the Yocto Project umbrella. They are all complementary and play specific roles in the system. We will understand exactly how they work together in this chapter and throughout this book.
3, The alliance of the OpenEmbedded project and the Yocto Project /
OpenEmbedded 项目与 Yocto 项目的联盟
OpenEmbedded 项目创建于 2003 年 1 月左右,当时 OpenZaurus 项目的一些核心开发人员开始使用新的构建系统。从一开始,OpenEmbedded 构建系统就是一个受 Gentoo Portage 软件包系统启发并基于该系统的任务调度程序,名为 BitBake。因此,该项目迅速增加了软件收藏和支持的机器列表。
The OpenEmbedded project was created around January 2003 when some core developers from the OpenZaurus project started to work with the new build system. Since its beginning, the OpenEmbedded build system has been a task scheduler inspired and based on the Gentoo Portage package system named BitBake. As a result, the project quickly grew its software collection and the supported machine list.
由于开发过程混乱且不协调,在需要更加稳定和完善的代码库的产品中使用 OpenEmbedded 十分具有挑战性,这就是 Poky 发行版诞生的原因。Poky 最初是 OpenEmbedded 构建系统的一个子集,在有限的体系结构中拥有更完善、更稳定的代码库。此外,由于规模缩小,Poky 还能开发一些亮点技术,如集成开发环境插件和快速模拟器 (QEMU) 集成,这些技术目前仍在使用中。
Due to chaotic and uncoordinated development, it was challenging to use OpenEmbedded in products that demand a more stable and polished code base, which is how Poky distribution was born. Poky started as a subset of the OpenEmbedded build system, and had a more polished and stable code base across a limited set of architectures. Additionally, its reduced size allowed Poky to develop highlighting technologies, such as IDE plugins and Quick Emulator (QEMU) integration, which are still in use.
Yocto 项目和 OpenEmbedded 项目将其工作合并到一个名为 OpenEmbedded Core 的核心构建系统上。它采用了 Poky 和 OpenEmbedded 的精华,强调更多地使用附加组件、元数据和子集。2010 年 11 月左右,Linux 基金会宣布 Yocto 项目将在 Linux 基金会赞助的项目下继续这项工作。
The Yocto Project and OpenEmbedded project consolidated their efforts on a core build system called OpenEmbedded Core. It uses the best of both Poky and OpenEmbedded, emphasizing the increased use of additional components, metadata, and subsets. Around November 2010, the Linux Foundation announced that the Yocto Project would continue this work under a Linux Foundation-sponsored project.
4, Understanding Poky
Poky 是默认的 Yocto 项目参考发行版,使用 OpenEmbedded 构建系统技术。它由一系列工具、配置文件和配方数据(称为元数据)组成。它与平台无关,使用 BitBake 工具、OpenEmbedded Core 和默认元数据集执行交叉编译,如下图所示。此外,它还提供了一种机制,用于构建和组合成千上万的分布式开源项目,形成一个完全可定制的、完整的、连贯的 Linux 软件栈。
Poky is the default Yocto Project reference distribution, which uses OpenEmbedded build system technology. It is composed of a collection of tools, configuration files, and recipe data (known as metadata). It is platform-independent and performs cross-compiling using the BitBake tool, OpenEmbedded Core, and a default set of metadata, as shown in the following figure. In addition, it provides the mechanism to build and combine thousands of distributed open source projects to form a fully customizable, complete, and coherent Linux software stack.
Poky 的主要目标是提供嵌入式开发人员所需的所有功能。
Poky’s main objective is to provide all the features an embedded developer needs.
[ Figure 1.1 – Poky main components ]
BitBake
BitBake 是一个任务调度和执行系统,可以解析 Python 和 Shell 脚本代码。解析后的代码会生成并运行任务,这些任务是根据代码的依赖关系排序的一系列步骤。
BitBake is a task scheduler and execution system that parses Python and Shell Script code. The code that is parsed generates and runs tasks, which are a set of steps ordered per the code’s dependencies.
BitBake 会评估所有可用的元数据,管理动态变量扩展、依赖关系和代码生成。此外,它还会跟踪所有任务以确保其完成,从而最大限度地利用处理资源,缩短构建时间并提高可预测性。BitBake 的开发在
bitbake-devel@lists.openembedded.org | Home 邮件列表中进行,源代码在 Poky 的 bitbake 子目录中。
BitBake evaluates all available metadata, managing dynamic variable expansion, dependencies, and code generation. In addition, it keeps track of all tasks to ensure their completion, maximizing the use of processing resources to reduce build time and predictability. The development of BitBake happens in the https://lists.openembedded.org/g/bitbake-devel mailing list, and the source code is in the bitbake subdirectory of Poky.
OpenEmbedded Core
OpenEmbedded Core 元数据集提供了 Poky 构建系统的引擎。它提供核心功能,并力求通用和尽可能精简。它支持七种不同的处理器架构(ARM、ARM64、x86、x86-64、PowerPC、PowerPC 64、MIPS、MIPS64、RISC-V32 和 RISC-V 64),仅支持 QEMU 可模拟的平台。
The OpenEmbedded Core metadata collection provides the engine of the Poky build system. It provides the core features and aims to be generic and as lean as possible. It supports seven different processor architectures (ARM, ARM64, x86, x86-64, PowerPC, PowerPC 64, MIPS, MIPS64, RISC-V32, and RISC-V 64), only supporting platforms to be emulated by QEMU.
开发工作集中在
openembedded-core@lists.openembedded.org | Home (mailto:
openembedded-core@lists.openembedded.org) 邮件列表中,并将其元数据存放在 Poky 的 meta 子目录中。
The development is centralized in the https://lists.openembedded.org/g/openembedded-core (mailto:openembedded-core@lists.openembedded.org) mailing list and houses its metadata inside the meta subdirectory of Poky.
Metadata
元数据包括配方和配置文件。它由 Python 和 Shell Script 文本文件混合组成,提供了一个非常灵活的工具。Poky 利用这一点扩展了 OpenEmbedded Core,并包括两个不同的层,即其他元数据子集,如下所示:
The metadata includes recipes and configuration files. It is composed of a mix of Python and Shell Script text files, providing a tremendously flexible tool. Poky uses this to extend OpenEmbedded Core and includes two different layers, which are other metadata subsets, shown as follows:
* meta-poky:该层提供默认和支持的发布策略、可视化品牌和元数据跟踪信息(维护者、上游状态等)。该层将作为一个精心策划的模板,供发行版构建者用于为其自定义发行版提供种子。
* meta-poky: This layer provides the default and supported distribution policies, visual branding, and metadata tracking information (maintainers, upstream status, and so on). This is to serve as a curated template that could be used by distribution builders to seed their custom distribution.
* meta-yocto-bsp:提供板级支持包(BSP),作为 Yocto 项目开发和质量保证(QA)流程的参考硬件。
* meta-yocto-bsp: This provides the Board Support Package (BSP) used as the reference hardware for the Yocto Project development and Quality Assurance (QA) process.
5, The Yocto Project releases
Yocto 项目每六个月发布一次版本,分别在四月和十月。这种发布周期确保了持续的开发流程,同时提供了更多的测试点,并将重点放在稳定性上。只要一个版本准备就绪,它就会成为稳定版或长期支持 (LTS) 版。
The Yocto Project has a release every six months, in April and October. This release cycle ensures continuous development flow while providing points of increased testing and focus on stability. A release becomes a Stable or a Long-Term Support (LTS) release whenever a release is ready.
稳定版和长期支持版的支持期有很大不同。稳定版的支持期为 7 个月,每个稳定版有 1 个月的重叠支持期。LTS 版本的最低支持期为 2 年,可选择延长。官方支持期结束后,转为社区支持,最后达到生命周期结束(EOL)。
The support period differs significantly between the stable and LTS releases. The support for the stable release is for 7 months, offering 1 month of overlapped support for every stable release. The LTS release has a minimal support period of 2 years, optionally extended. After the official support period ends, it moves to Community support and finally reaches End Of Life (EOL).
官方发布支持期结束后,如果有社区成员加入成为社区维护者,发布版本就可以转为社区支持版本。最后,当源代码在 2 个月内没有任何变化,或社区维护者不再是活跃成员时,发布版本就会转为 EOL。
When the official release support period ends, a release can be Community support if a community member steps in to become the community maintainer. Finally, a release turns EOL when there is no change in the source code by 2 months, or the community maintainer is no longer an active member.
下图显示了两个发布周期:
The following diagram shows the two release cycles:
[ Figure 1.2 – Stable or LTS release cycles
] [ 图 1.2 - 稳定版或 LTS 发布周期 ]
表 1.1 列出了 Yocto 项目的版本、代号、发布日期和当前支持级别,如下所示。更新后的表格请访问
Releases - Yocto Project :
Table 1.1 provides the Yocto Project version, codename, release date, and current support level, which can be seen as follows. The updated table is available at
Releases - Yocto Project :
Codename
|
Version
|
Release Date
|
Support Level
|
Mickledore
|
4.2
|
April 2023
|
Future (until October 2023)
|
Langdale
|
4.1
|
October 2022
|
Stable (until May 2023)
|
Kirkstone
|
4.0
|
May 2022
|
LTS (minimum April 2024)
|
Honister
|
3.4
|
October 2021
|
EOL
|
Hardknott
|
3.3
|
April 2021
|
EOL
|
Gatesgarth
|
3.2
|
Oct 2020
|
EOL
|
Dunfell
|
3.1
|
April 2020
|
LTS (until April 2024)
|
Zeus
|
3.0
|
October 2019
|
EOL
|
Warrior
|
2.7
|
April 2019
|
EOL
|
Thud
|
2.6
|
Nov 2018
|
EOL
|
Sumo
|
2.5
|
April 2018
|
EOL
|
Rocko
|
2.4
|
Oct 2017
|
EOL
|
Pyro
|
2.3
|
May 2017
|
EOL
|
Morty
|
2.2
|
Nov 2016
|
EOL
|
Krogoth
|
2.1
|
Apr 2016
|
EOL
|
Jethro
|
2.0
|
Nov 2015
|
EOL
|
Fido
|
1.8
|
Apr 2015
|
EOL
|
Dizzy
|
1.7
|
Oct 2014
|
EOL
|
Daisy
|
1.6
|
Apr 2014
|
EOL
|
Dora
|
1.5
|
Oct 2013
|
EOL
|
Dylan
|
1.4
|
Apr 2013
|
EOL
|
Danny
|
1.3
|
Oct 2012
|
EOL
|
Denzil
|
1.2
|
Apr 2012
|
EOL
|
Edison
|
1.1
|
Oct 2011
|
EOL
|
Bernard
|
1.0
|
Apr 2011
|
EOL
|
Laverne
|
0.9
|
Oct 2010
|
EOL
|
Table 1.1 – List of Yocto Project versions
6, Summary
本章概述了 OpenEmbedded 项目与 Yocto 项目的关系、组成 Poky 的组件以及项目的启动过程。下一章将介绍 Poky 工作流程,包括下载、配置和准备 Poky 构建环境的步骤,以及如何使用 QEMU 构建和运行第一个映像。
This chapter provided an overview of how the OpenEmbedded project is related to the Yocto Project, the components that form Poky, and how the project began. The next chapter will introduce the Poky workflow with steps to download, configure, and prepare the Poky build environment and how to have the first image built and running using QEMU.