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 c