Chapter 2: Baking Our First Poky-Based System
让我们动手实践吧!在本章中,我们将了解 Poky 工作流程中涉及的基本概念。我们将介绍下载、配置和准备 Poky 构建环境的步骤,并烘焙出可用的东西。这里涉及的步骤在测试和开发中很常见。它们将为我们提供一些使用 Poky 的经验,并让我们领略到它的能力。
Let’s get our hands dirty! In this chapter, we will understand the basic concepts involved in the Poky workflow. We will cover the steps to download, configure, and prepare the Poky build environment and bake something usable. The steps covered here are common for testing and development. They will give us some experience using Poky and a taste of its capabilities.
1, Preparing the build host system
本节介绍如何准备 Windows 和 Linux 分发版主机系统。虽然我们将介绍 Windows 的步骤,但重点是使用 Linux 分发版主机系统。
This section describes how to prepare Windows and Linux distribution host systems. Although we will describe the Windows steps, we will focus on using a Linux distribution host system.
Tip/提示
使用 macOS 作为主机系统是可能的。不过,这需要使用 CROss PlatformS (CROPS) 框架,该框架利用 Docker,允许使用包括 macOS 在内的外来操作系统。更多信息,请参阅《Yocto 项目开发任务手册》(https://docs.yoctoproject.org/4.0.4/dev-manual/start.html#setting-up-to-use-cross-platforms-crops)中的 “设置使用 CROss PlatformS (CROPS)” 部分。
The use of macOS as a host system is possible. Still, it involves using the CROss PlatformS (CROPS) framework, which leverages Docker, allowing the use of foreign operating systems, including macOS. For more information, you can refer to the Setting Up to Use CROss PlatformS (CROPS) section from the Yocto Project Development Tasks Manual (https://docs.yoctoproject.org/4.0.4/dev-manual/start.html#setting-up-to-use-cross-platforms-crops).
接下来,我们将提供启动构建主机系统准备工作所需的信息。
Next, we will provide the necessary information to start the build host system preparation.
Using Windows Subsystem for Linux (WSLv2)
如果你是 Windows 用户,可以在 Windows 上安装 Linux 分发版。WSLv2 仅适用于大于 18917 的 Windows 10+ 版本。WSLv2 允许使用 Yocto 项目进行开发。你可以从 Microsoft Store 安装 Linux 发行版。
You can set up a Linux distribution on Windows if you are a Windows user. WSLv2 is only available for Windows 10+ builds greater than 18917. WSLv2 allows development using the Yocto Project. You can install the Linux distribution from the Microsoft Store.
请参阅《Yocto 项目开发任务手册》(
Yocto Project Development Tasks Manual — The Yocto Project ® 4.0.4 documentation) 中的 “设置使用 Windows Linux 子系统 ”部分 (
2 Setting Up to Use the Yocto Project — The Yocto Project ® 4.0.4 documentation)。一旦设置好 WSLv2,就可以像在本地 Linux 机器上运行一样执行接下来的章节。
Please refer to the Setting Up to Use Windows Subsystem For Linux session (
2 Setting Up to Use the Yocto Project — The Yocto Project ® 4.0.4 documentation ) from the Yocto Project Development Tasks Manual (
Yocto Project Development Tasks Manual — The Yocto Project ® 4.0.4 documentation ). Once you have WSLv2 set up, you can follow the next sections as if you were running on a native Linux machine.
Preparing a Linux-based system
设置主机系统所需的过程取决于我们使用的 Linux 发行版。Poky 有一套支持的 Linux 发行版。假设我们是嵌入式 Linux 开发的新手。在这种情况下,建议使用其中一个受支持的 Linux 发行版,以免浪费时间调试与主机系统支持相关的问题。
The process needed to set up our host system depends on the Linux distribution we use. Poky has a set of supported Linux distributions. Let’s suppose we are new to embedded Linux development. In that case, it is advisable to use one of the supported Linux distributions to avoid wasting time debugging issues related to the host system support.
如果你使用的是下列发行版之一的当前版本,你就可以在你的机器上开始使用 Yocto 项目了:
If you use the current release of one of the following distributions, you should be good to start using the Yocto Project on your machine:
* Ubuntu
* Fedora
* CentOS
* AlmaLinux
* Debian
* OpenSUSE Leap
要确认你的版本是否受支持,建议你在线查看 “构建主机所需软件包 ”部分的官方文档 (
1 System Requirements — The Yocto Project ® 4.0.4 documentation)。
To confirm whether your version is supported, it is advisable to check the official documentation online in the Required Packages for the Build Host section (