Yocto - 使用Yocto开发嵌入式Linux系统_05 认识Bitbake工具

news2024/10/2 11:05:12
Meeting the BitBake Tool
通过本章,我们将开始学习 Yocto 项目引擎如何在幕后工作的旅程。正如每一段旅程一样,沟通是至关重要的,因此我们需要理解 Yocto 项目工具所使用的语言,并学习如何充分利用这些工具来实现我们的目标。
With this chapter, we will now begin our journey of learning how the Yocto Project’s engine works behind the scenes. As is the case with every journey, communication is critical, so we need to understand the language used by the Yocto Project’s tools and learn how to get the best out of these tools to accomplish our goals.
前面几章向我们介绍了创建和仿真镜像文件的标准 Yocto Project 工作流程。在本章中,我们将探讨元数据的概念,以及 BitBake 如何读取这些元数据来收集内部数据。
The preceding chapters introduced us to the standard Yocto Project workflow for creating and emulating images. Now, in this chapter, we will explore the concept of metadata and how BitBake reads this metadata to make its internal data collections.
1,Understanding the BitBake tool
BitBake 任务调度程序是从 Gentoo 发行版中使用的软件包管理系统 Portage 分支而来的。然而,由于使用情况不同,这两个项目出现了很大的分歧。Yocto 项目和 OpenEmbedded 项目是 BitBake 的密集用户。BitBake 仍是一个独立的项目,有自己的开发周期和邮件列表 ( bitbake-devel@lists.openembedded.org)。
The BitBake task scheduler started as a fork from Portage, the package management system used in the Gentoo distribution. However, the two projects diverged significantly due to different use cases. The Yocto Project and the OpenEmbedded Project are intensive users of BitBake. It remains a separate and independent project with its own development cycle and mailing list (bitbake-devel@lists.openembedded.org).
BitBake 是一个类似于 GNU Make 的工具。正如第 1 章 “认识 Yocto 项目 ”中所述,BitBake 是一个任务执行器和调度器,可以解析 Python 和 Shell Script 混合代码。
BitBake is a tool similar to GNU Make. As discussed in Chapter 1, Meeting the Yocto Project, BitBake is a task executor and scheduler that parses Python and Shell Script mixed code.
因此,BitBake 负责并行运行尽可能多的任务,同时确保它们在运行时尊重各自的依赖关系。
Therefore, BitBake is responsible for running as many tasks as possible in parallel while ensuring they are run respecting their dependencies.
2,BitBake metadata collections
对于 BitBake 来说,所有元数据都属于某个元数据集合。而且,元数据集合有一个唯一的名称,Yocto 项目对这些集合使用的通用术语是 “层”。
For BitBake, there is no metadata outside a metadata collection. Instead, a metadata collection has a unique name, and the common term the Yocto Project uses for those collections is Layer.
在第 1 章 “认识 Yocto 项目 ”中,我们介绍了以下几个层:
Chapter 1, Meeting the Yocto Project, explains that we have the following layers:
* OpenEmbedded Core: This is inside the meta directory
* Poky distribution: This is inside the meta-poky directory
* Yocto Project reference BSP: This is inside the meta-yocto-bsp directory
前面的列表描述了层的实际示例。每个层都包含一个名为 conf/layer.conf 的文件。该文件定义了几个层属性,如元数据集合的名称和优先级。下图显示了 meta-poky 图层的 conf/layer.conf 文件:
The preceding list describes real examples of layers. Every layer contains a file called conf/layer.conf. This file defines several layer properties, such as the collection name and priority. The following figure shows the conf/layer.conf file for the meta-poky layer:
[ Figure 4.1 – The conf/layer.conf file for the meta-poky layer ]
前面的示例相对简单,但可以作为我们说明 conf/layer.conf 文件原理的基础。
The preceding example is relatively simple but serves as a base for us to illustrate the conf/layer.conf file principles.
在第 8 行 BBFILE_COLLECTIONS 中,我们告诉 BitBake 创建一个名为 yocto 的新元数据集合。接下来,在第 9 行 BBFILE_PATTERN_yocto,我们定义了匹配所有以 LAYERDIR 变量开头的路径的规则,以识别属于 yocto 集合的元数据。最后,在第 10 行,BBFILE_PRIORITY_yocto 确定了 yocto 元数据集相对于其他元数据集的优先级(数字越大,优先级越高)。
In line 8, BBFILE_COLLECTIONS, we tell BitBake to create a new metadata collection called yocto. Next, in line 9, BBFILE_PATTERN_yocto, we define the rule to match all paths starting with the LAYERDIR variable to identify the metadata belonging to the yocto collection. Finally, in line 10, BBFILE_PRIORITY_yocto establishes the priority (the higher the number, the higher the priority) of the yocto collection against the other metadata collections.
层与层之间的依赖关系至关重要,因为它可以确保所有需要的元数据都可以使用。以第 18 行为例,在conf/layer.conf 文件中为 LAYERDEPENDS_yocto 添加了一个和 core的依赖关系,core表示OpenEmbedded Core层。
The dependency relation between the layers is vital as it ensures that all required metadata is available for use. An example is in line 18 as LAYERDEPENDS_yocto, from the conf/layer.conf file, adds a dependency to the core, provided by the OpenEmbedded Core layer.
图 4.2 显示了 Poky 使用 bitbake-layers 命令创建的图层,如下所示:
Figure 4.2 shows Poky’s layers using the bitbake-layers command, as follows:
[ Figure 4.2 – Results of bitbake-layers show-layers for Poky ]
3, Metadata types
我们可以将 BitBake 使用的元数据分为三大类。它们如下:
There are three major areas where we can classify the metadata used by BitBake. They are as follows:
* Configuration (the .conf files)
* Classes (the .bbclass files)
* Recipes (the .bb and .bbappend files)
配置文件定义全局内容,以提供信息,并配置配方的工作方式。配置文件的一个典型例子是机器文件,其中包含描述硬件的设置列表。
The configuration files define the global content to provide information and configure how the recipes work. One typical example of a configuration file is the machine file, which has a list of settings that describes the hardware.
整个系统都使用这些类,配方可以根据自己的需要继承这些类,或者 默认情况下就继承。它们定义了常用的系统行为,并提供了基本方法。例如,kernel.bbclass 抽象了与构建和打包 Linux 内核相关的任务,不受版本或供应商变更的影响。
The whole system uses the classes that recipes can inherit according to their needs or by default. They define the commonly used system’s behavior and provide the base methods. For example, kernel.bbclass abstracts tasks related to building and packaging the Linux kernel independently of version or vendor changes.
注释
配方和类混合了 Python 和 Shell 脚本代码。
Note
The recipes and classes mix Python and Shell Script code.
类和配方描述要运行的任务,并提供所需信息,以便 BitBake 生成所需的任务列表及其依赖关系。继承机制允许一个配方继承一个或多个类,以促进代码重用、提高准确性并简化维护。Linux 内核配方的一个例子是 linux-yocto_5.15.bb,它继承了一组类,包括 kernel.bbclass。
The classes and recipes describe the tasks to be run and provide the information needed to allow BitBake to generate the required task list and its dependencies. The inheritance mechanism permits a recipe to inherit one or more classes to promote code reuse, improve accuracy, and make maintenance easier. A Linux kernel recipe example is linux-yocto_5.15.bb, which inherits a set of classes, including kernel.bbclass.
第 5 章 “掌握 BitBake 工具 ”介绍了 BitBake 所有元数据类型(.conf、.bb 和 .bbclass)中最常用的方面,第 8 章 “深入了解 BitBake 元数据 ”详细介绍了元数据语法和句法。
BitBake’s most commonly used aspects across all types of metadata (.conf, .bb, and .bbclass) are covered in Chapter 5, Grasping the BitBake Tool, while the metadata grammar and syntax are detailed in Chapter 8, Diving into BitBake Metadata.
考虑到图 4.1,我们需要注意另外两个变量--BBPATH 和 BBFILES。
Taking Figure 4.1 into consideration, we need to pay attention to two other variables – BBPATH and BBFILES.
第 2 行的 BBPATH 类似于 PATH,但在元数据文件的搜索列表中添加了一个目录;第 5 行的 BBFILES 变量列出了用于索引配方文件集合的模式。
BBPATH, on line 2, is analogous to PATH but adds a directory to the search list for metadata files; the BBFILES variable, on line 5, lists the pattern used to index the collection recipe files.
4, Summary
在本章中,我们了解了元数据、元数据集合概念以及 conf/layer.conf 的重要性,这些都是理解 Yocto 项目的基础。在下一章中,我们将学习元数据知识,了解配方如何相互依赖,以及 BitBake 如何处理依赖关系。此外,我们还将更好地了解 BitBake 所管理的任务,下载所有需要的源代码,构建和生成软件包,并了解这些软件包如何与生成的映像相匹配。
In this chapter, we learned about metadata, metadata collection concepts, and the importance of conf/layer.conf, which are the base for the understanding of the Yocto Project. In the next chapter, we will examine metadata knowledge, understand how recipes depend on each other, and how BitBake deals with dependencies. Additionally, we will also get a better view of the tasks managed by BitBake, download all the required source code, build and generate packages, and see how these packages fit into generated images.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2184269.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

网页前端开发之Javascript入门篇(3/9):条件控制

Javascript条件控制 什么是条件控制? 答:其概念跟 Python教程 介绍的一样,只是语法上有所变化。 参考流程图如下: 其对应语法: var button false; // 开关状态 console.log("检查开关.."); if(bu…

一文掌握Harbor镜像同步公有云镜像仓库实践

一文掌握Harbor镜像同步公有云镜像仓库实践 目录 1 引言2 概念 2.1 Harbor2.2 阿里云的镜像仓库ACR2.3 华为云的镜像仓库SWR2.4 Harbor复制管理同步镜像 2.4.1 复制管理的工作原理 2.5 Harbor同步镜像到公有云镜像仓库的优势 3 实验:通过Harbor 将容器镜像同步到公…

刷题系统小程序的设计

管理员账户功能包括:系统首页,个人中心,用户管理,知识点管理,科目类型管理,试题管理,试卷管理,系统管理 微信端账号功能包括:系统首页,我的 开发系统&#…

vulnhub-W34kn3ss 1靶机

vulnhub:https://www.vulnhub.com/entry/w34kn3ss-1,270/ 导入靶机,扫描 靶机开在192.168.81.7.扫描端口 扫到三个端口,存在网站服务,访问 80端口没什么东西,443似乎访问到的是同一个界面,这种情况下一般是…

Visual Studio C# 处理和修复 WinRiver II 测量项目 MMT 文件错误

Visual Studio C# 处理和修复 WinRiver II 测量项目 MMT 文件错误 前言一、WinRiver II 测量项目 MMT 文件的结构二、WinRiver II 无法打开或操作测量项目 MMT 文件2.1 无法载入船测多线法测量文件2.2 可以载入测验项目 MMT 文件,但 ADCP 后处理软件无法写入信息2.3…

基于SpringBoot+vue的监理公司信息化管理系统设计与实现

目录 1. 系统概述 2. 技术选型 3. 系统模块设计 3.1 收入支出管理 3.2 合同管理 3.3 财务统计 3.4 甲方乙方公告 4. 安全性考虑 5. 效果展示和示例代码 6. 总结 1. 系统概述 随着经济的快速发展和社会的进步,建筑行业作为国民经济的重要支柱产业之…

[MAUI]数据绑定和MVVM:MVVM的属性验证

一、MVVM的属性验证案例 Toolkit.Mvvm框架中的ObservableValidator类,提供了属性验证功能,可以使用我们熟悉的验证特性对属性的值进行验证,并将错误属性提取和反馈给UI层。以下案例实现对UI层的姓名和年龄两个输入框,进行表单提交验证。实现效果如下所示 View<ContentP…

医院体检管理系统小程序的设计

管理员账户功能包括&#xff1a;系统首页&#xff0c;个人中心&#xff0c;用户管理&#xff0c;体检分类管理&#xff0c;体检套餐管理&#xff0c;体检预约管理&#xff0c;体检报告管理&#xff0c;系统管理 微信端账号功能包括&#xff1a;系统首页&#xff0c;体检套餐&a…

Jetson 开发系列:Orin Nano 开箱!一款强大的嵌入式物联网开发板

边缘计算作为 AI 的一个重要应用场景&#xff0c;面临着前所未有的机遇与挑战。 谈及 AI&#xff0c;自然绕不开 NVIDIA 的产品&#xff1a; 其中&#xff0c;Jetson 系列均为 AIoT 设备打造&#xff0c;功耗低是其最大的特点。以我手头的 Jetson Ori Nano 为例&#xff0c;满…

一文彻底搞懂多模态 - 基础术语+基础知识+多模态学习

文章目录 技术交流基本术语一、数据采集与表示二、数据处理与融合三、学习与推理 基础知识一、传统机器学习二、深度学习三、优化算法四、应用领域 多模态学习一、模态表示二、多模态融合图片 三、跨模态对齐 最近这一两周看到不少互联网公司都已经开始秋招发放Offer。 不同以…

【MAUI】View和ViewModel的关联方式

方式一:创建ViewModel对象: 在View中,通过设置BindingContext为ViewModel对象,即可进行绑定。如下所示: <ContentPage......xmlns:vm="clr-namespace:MauiApp8.ViewModels"><

多模态RAG实现

在标准 RAG 中&#xff0c;输入文档包含文本数据。LLM 利用上下文学习&#xff0c;通过检索与所提查询上下文相匹配的文本文档块来提供更相关、更准确的答案。 但是&#xff0c;如果文档包含图像、表格、图表等以及文本数据&#xff0c;该怎么办&#xff1f; 不同的文档格式包…

基于 Qwen2.5-0.5B 微调训练 Ner 命名实体识别任务

一、Qwen2.5 & 数据集 Qwen2.5 是 Qwen 大型语言模型的最新系列&#xff0c;参数范围从 0.5B 到 72B 不等。 对比 Qwen2 最新的 Qwen2.5 进行了以下改进&#xff1a; 知识明显增加&#xff0c;并且大大提高了编码和数学能力。在指令跟随、生成长文本&#xff08;超过 8K…

【Maven】依赖管理,Maven仓库,Maven核心功能

Maven 是一个项目管理工具&#xff0c;基于 POM&#xff08;Project Object Model&#xff0c;项目对象模型&#xff09;的概念&#xff0c;Maven 可以通过一小段描述信息来管理项目的构建&#xff0c;报告和文档的项目管理工具软件 大白话&#xff1a;Maven 是一个项目管理工…

Spring MVC 常用注解

目录 基础概念 常用注解介绍 基础概念 1、MVC &#xff1a;代表一种软件架构设计思想&#xff0c;通俗的理解&#xff1a;客户端发送请求到后台服务器的Controller(C)&#xff0c;控制器调用Model(M)来处理业务逻辑&#xff0c;处理完成后&#xff0c;返回处理后的数据到Vie…

【CKA】七、七层负载-Ingress应用

7、七层负载-Ingress应用 1. 考题内容&#xff1a; 2. 答题思路&#xff1a; 1、要先查到集群中使用的ingressclass 2、编写yaml 我考的题只是把 hi 服务换成了 hello&#xff0c;其他都一模一样 3. 官网地址&#xff1a; https://kubernetes.io/zh-cn/docs/concepts/serv…

基于SSM的大型商场会员管理系统【附源码】

基于SSM的大型商场会员管理系统&#xff08;源码L文说明文档&#xff09; 目录 4 系统设计 4.1布局设计原则 4.2功能模块设计 4.3数据库设计 4.3.1数据库E-R图 4.3.2 数据库表结构 第五章 系统实现 5.1 管理员功能实现 5.1.1 员工管理 5.1…

基于SD卡的基因(DNA)炫酷LED桌面灯

基于SD卡的基因&#xff08;DNA&#xff09;炫酷LED桌面灯 一、介绍一个已知的问题解决办法 二、支持目录材料准备LED灯光文件&#xff08;我使用的PLA颜色&#xff09; 三、 打印部件和焊接四、拼装打印的DNA散件五、组合DNA螺旋结构六、执行DNA文件七、程序烧录八、总结及成品…

六、Drf限流组件

六、限流组件 限制某个视图在某个时间段内被同一个用户访问的次数 6.1限流组件的简单应用 1&#xff09;安装django-redis pip3 install django-redis2)在settings.py中注册cache #缓存数据库redis配置 CACHES{"default":{"BACKEND":"django_red…

AI 对话工具汇总

&#x1f423;个人主页 可惜已不在 &#x1f424;这篇在这个专栏AI_可惜已不在的博客-CSDN博客 &#x1f425;有用的话就留下一个三连吧&#x1f63c; 目录 前言: 正文: 前言: 在科技飞速发展的时代&#xff0c;AI 对话正逐渐成为我们获取信息、交流思想的新方式。它以强…