Embedded Linux Development Using Yocto Project: Leverage the power of the Yocto Project to build efficient Linux-based products, Third Edition
By: Otavio Salvador, Daiane Angolini
Overview of this book
Yocto 项目是开发可靠的嵌入式 Linux 项目的行业标准。与其他框架相比,Yocto Project 不仅开发省时,而且可靠性和健壮性更强。通过《使用 Yocto Project 进行嵌入式 Linux 开发》,你将了解 Yocto Project 工具,帮助你执行各种基于 Linux 的任务。你将深入了解 Poky 和 BitBake,探索构建 Linux 子系统项目的实际用例,使用可用于嵌入式 Linux 的 Yocto Project 工具,并揭开 SDK、配方工具和其他工具的秘密。新版与上述技术的最新长期支持版本保持一致,并引入了两个新章节,内容包括在 QEMU 中优化仿真以加快产品开发和最佳实践。在本书结束时,你将具备为真实硬件板生成和运行映像的能力。你将获得使用 Yocto 项目构建高效 Linux 系统的实践经验。
The Yocto Project is the industry standard for developing dependable embedded Linux projects. It stands out from other frameworks by offering time-efficient development with enhanced reliability and robustness. With Embedded Linux Development Using Yocto Project, you’ll acquire an understanding of Yocto Project tools, helping you perform different Linux-based tasks. You’ll gain a deep understanding of Poky and BitBake, explore practical use cases for building a Linux subsystem project, employ Yocto Project tools available for embedded Linux, and uncover the secrets of SDK, recipe tool, and others. This new edition is aligned with the latest long-term support release of the aforementioned technologies and introduces two new chapters, covering optimal emulation in QEMU for faster product development and best practices. By the end of this book, you’ll be well-equipped to generate and run an image for real hardware boards. You’ll gain hands-on experience in building efficient Linux systems using the Yocto Project.
Preface
Linux 一直被广泛应用于尖端产品中,嵌入式系统也是人类技术组合的重要组成部分。
Linux has been consistently used in cutting-edge products, and embedded systems have been wrought in the technological portfolio of humankind.
Yocto 项目是你项目的最佳选择。它提供了一套丰富的工具,可帮助你在产品开发过程中充分利用精力和资源,而不是重新发明轮子。
The Yocto Project is in an optimal position to be the choice for your projects. It provides a rich set of tools to help you use most of your energy and resources in your product development instead of reinventing the wheel.
本书的构思以基于嵌入式 Linux 的产品和开发团队的通常任务和要求为准则。然而,本书由活跃的社区成员撰写,采用了实用而直接的方法,是你学习曲线和产品项目的垫脚石。
The usual tasks and requirements of embedded Linux-based products and development teams were the guideline for this book’s conception. However, being written by active community members with a practical and straightforward approach is a stepping stone for both your learning curve and the product’s project.
在第 3 版中,除了全面更新以反映 Yocto 项目长期支持版本 4.0(代号为 Kirkstone)的变化外,本书还根据前几版读者的反馈意见进行了彻底修改,并扩展了内容,以方便读者理解与 Yocto 项目相关的复杂概念。
In this third edition, the book has been thoroughly reworked to incorporate the feedback from readers from previous editions and extended to facilitate the understanding of complex concepts related to the Yocto Project, in addition to being fully updated to reflect the changes made up to Yocto Project Long Term Support version 4.0 (codename Kirkstone).
此外,还增加了两个新章节,一个是关于使用 QEMU 通过仿真加速产品开发,另一个是关于 Yocto 项目和一般项目指南。
Furthermore, two new chapters have been added, one regarding using QEMU to speed product development through emulation and one about Yocto Project and general project guidelines.
Who this book is for
本书面向有嵌入式 Linux 经验的工程师和爱好者,他们愿意学习 Yocto 项目的工具,以便进行评估、比较或在项目中使用。本书旨在帮助你快速上手,避免陷入常见的学习曲线陷阱。
This book is intended for engineers and enthusiasts with embedded Linux experience, willing to learn about Yocto Project’s tools for evaluation, comparison, or use in a project. This book is aimed at helping you get up to speed quickly and to prevent you from getting trapped into the usual learning curve pitfalls.
What this book covers
第 1 章,认识 Yocto 项目,将介绍 Yocto 项目及其主要工具的概念和前提。
第 2 章,构建基于 Poky 的系统,介绍首次构建所需的环境。
第 3 章,使用 Toaster 来构建镜像,介绍了可用作配置包装器和构建工具的用户友好型网络界面。
第 4 章,认识 BitBake 工具,介绍 BitBake 元数据概念。
第 5 章,掌握 BitBake 工具,介绍它如何管理任务及其依赖关系。
第 6 章,详细介绍临时编译目录,详细介绍编译的临时输出文件夹。
第 7 章,相同机制的打包支持,解释作为创建和管理所有二进制包基础的打包机制。
第 8 章,深入了解 BitBake 元数据,详细介绍 BitBake 元数据语言,该语言将用于所有其他章节。
第 9 章,Yocto 项目的开发,演示获取开发环境所需的工作流程。
第 10 章,Yocto 项目调试,介绍如何使用 Poky 生成调试环境以及如何使用该环境。
第 11 章,探索外部层,探讨了 Yocto 项目最重要的概念之一 —— 使用外部层的灵活性。
第 12 章,创建自定义图层,介绍创建图层的步骤。
第 13 章,定制现有配方,举例说明如何定制现有配方。
第 14 章,实现 GPL 合规性,总结了符合版权法的产品所涉及的任务和概念。
第 15 章,启动我们的定制嵌入式 Linux,使用真实的硬件机器和 Yocto 项目的工具。
第 16 章,通过仿真加速产品开发--QEMU ,介绍了 QEMU 如何加速产品开发。
第 17 章,最佳实践,根据作者的经验讨论了一些与 Yocto 项目和一般项目相关的指导原则。
Chapter 1, Meeting the Yocto Project, presents the first concepts and premises to introduce parts of the Yocto Project and its main tools.
Chapter 2, Baking Our Poky-Based System, introduces the environment needed for the first build.
Chapter 3, Using Toaster to Bake an Image, shows the user-friendly web interface that can be used as a configuration wrapper and build tool.
Chapter 4, Meeting the BitBake Tool, presents the BitBake metadata concepts.
Chapter 5, Grasping the BitBake Tool, shows how it manages the tasks and their dependencies.
Chapter 6, Detailing the Temporary Build Directory, details the temporary output folder of a build.
Chapter 7, Assimilating Packaging Support, explains the packaging mechanism used as a base to create and manage all the binary packages.
Chapter 8, Diving into BitBake Metadata, details the BitBake metadata language, which will be used for all the other chapters.
Chapter 9, Developing with the Yocto Project, demonstrates the workflow needed to obtain a development environment.
Chapter 10, Debugging with the Yocto Project, shows how to use Poky to generate a debug environment and how to use it.
Chapter 11, Exploring External Layers, explores one of the most important concepts of the Yocto Project—the flexibility of using external layers.
Chapter 12, Creating Custom Layers, practices the steps for layer creation.
Chapter 13, Customizing Existing Recipes, presents examples of how to customize existing recipes.
Chapter 14, Achieving GPL Compliance, summarizes the tasks and concepts involved for a copyleft compliance product.
Chapter 15, Booting Our Custom Embedded Linux, uses real hardware machines and the Yocto Project’s tools.
Chapter 16, Speeding Up Product Development Through Emulation – QEMU, illustrates how QEMU can accelerate product development.
Chapter 17, Best Practices, discusses some Yocto Project and general project-related guidelines based on the author’s experience.
What you will learn
* 了解基本的 Poky 工作流概念,以及配置和准备 Poky 构建环境
* 借助最新版本 Yocto 项目中的最新示例进行学习
* 使用 Toaster 配置构建服务器并自定义镜像
* 使用 BitBake 生成镜像并将软件包安装到创建的镜像中
* 通过设置和使用软件包源支持开发过程
* 通过配置 Poky 调试 Yocto 项目
* 为 BeagleBone Black、RaspberryPi 4 和 Wandboard 构建镜像,并从 SD 卡启动
* Understand the basic Poky workflows concepts along with configuring and preparing the Poky build environment
* Learn with the help of up-to-date examples in the latest version of Yocto Project
* Configure a build server and customize images using Toaster
* Generate images and fit packages into created images using BitBake
* Support the development process by setting up and using Package feeds
* Debug Yocto Project by configuring Poky
* Build an image for the BeagleBone Black, RaspberryPi 4, and Wandboard, and boot it from an SD card
To get the most out of this book
要充分利用这本书
要更好地理解本书,关键是你要对文中没有涉及或只是简单提及的一些主题有一定的背景知识,例如 Git 和 Linux 内核及其基本编译过程的常识。
To understand this book better, it is crucial that you have some previous background about some of the topics that are not covered or are just briefly mentioned in the text, such as Git and general knowledge of Linux kernel and its basic compilation process.
在了解本书详述的技术概念之前,若想了解 Yocto 项目的全貌,我们推荐你阅读 https://git.io/vFUiI Git 仓库中的开源小册子《Yocto 项目的方向》;这本小册子的内容旨在帮助新人更好地理解 Yocto 项目的目标及其潜在用途。在深入探讨如何实现的技术细节之前,本手册提供了项目概览。
To understand the big picture of the Yocto Project before going to the technical concepts detailed in this book, we recommend the open sourced booklet, Heading for the Yocto Project, found in the Git repository at https://git.io/vFUiI ; the content of this booklet is intended to help newcomers to gain a better understanding of the goals of the Yocto Project and its potential uses. It provides an overview of the project before diving into the technical details of how things can be done.
需要对 GNU/Linux 环境和嵌入式 Linux 的使用有基本的了解,以及开发中使用的一般概念,如编译、调试、部署和安装。此外,会使用 shell 脚本和 Python 更佳,因为这些编程语言是 Yocto 项目工具广泛使用的核心技术。
A basic understanding of the use of the GNU/Linux environment and embedded Linux is required, as well as the general concepts used in development, such as compilation, debugging, deployment, and installation. In addition, some experience with shell script and Python is a bonus because these programming languages are core technologies used extensively by the Yocto Project’s tools.
不过,你可能更喜欢了解这些主题。在这种情况下,我们推荐 Chris Simmonds 所著的《精通嵌入式 Linux 编程》(Mastering Embedded Linux Programming - Third Edition)一书,ISBN-13 978-1789530384。
However, you may prefer to learn more about those topics. In that case, we recommend the book Mastering Embedded Linux Programming - Third Edition, ISBN-13 978-1789530384, by Chris Simmonds.
你不应该把我们上面列举的那些概念中的任何缺失视为一种阻碍,而应该把它们视为你可以学习的东西,同时,你还可以通过这本书练习使用它们。
You shouldn’t take any missing concepts – of those we enumerated above – as a deterrent but as something you can learn and, at the same time, practice their use with this book.