Yocto - Image

本文介绍了OpenEmbedded构建系统提供的各种镜像示例,重点讲解了如何在构建过程中处理包含GPLv3及类似许可证组件的问题,以及如何在core-image-minimal等不同类型的镜像中设置兼容性限制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

10 Images (镜像或映像)

OpenEmbedded 构建系统提供了多个示例映像,以满足不同的需求。当你使用 bitbake 命令时,你将提供一个 "顶层 "配方,该配方基本上可以开始构建您想要的映像类型。

The OpenEmbedded build system provides several example images to satisfy different needs. When you issue the bitbake command you provide a “top-level” recipe that essentially begins the build for the type of image you want.

注意

构建不包含 GNU General Public License Version 3 (GPLv3)、GNU Lesser General Public License Version 3 (LGPLv3) 和 GNU Affero General Public License Version 3 (AGPL-3.0) 组件的镜像仅适用于 core-image-minimal 镜像。此外,如果您想构建映像并验证它不包含 GPLv3 和类似许可的组件,则必须在使用 BitBake 命令构建映像之前,在映像配方文件中做出以下更改:

    INCOMPATIBLE_LICENSE = “GPL-3.0* LGPL-3.0*”

或者,您也可以调整 local.conf 文件,为所有必须适用许可证限制的镜像都加上这一行:

    INCOMPATIBLE_LICENSE:pn-your-image-name = “GPL-3.0* LGPL-3.0*”

Note

Building an image without GNU General Public License Version 3 (GPLv3), GNU Lesser General Public License Version 3 (LGPLv3), and the GNU Affero General Public License Version 3 (AGPL-3.0) components is only tested for core-image-minimal image. Furthermore, if you would like to build an image and verify that it does not include GPLv3 and similarly licensed components, you must make the following changes in the image recipe file before using the BitBake command to build the image:

    INCOMPATIBLE_LICENSE = “GPL-3.0* LGPL-3.0*”

Alternatively, you can adjust local.conf file, repeating and adjusting the line for all images where the license restriction must apply:

    INCOMPATIBLE_LICENSE:pn-your-image-name = “GPL-3.0* LGPL-3.0*”

在 poky Git 仓库中,可以使用以下命令显示源代码目录中包含镜像配方文件的目录列表:

From within the poky Git repository, you can use the following command to display the list of directories within the Source Directory that contain image recipe fil

### 如何在Yocto项目中构建或安装镜像 在Yocto项目中,构建或安装镜像是通过一系列命令完成的。这些操作涉及定义目标图像、配置文件以及最终生成可部署的映像文件。 #### 定义并构建自定义镜像 要创建一个新的镜像,通常需要编写一个`.bb`(BitBake)配方文件来描述该镜像的内容。此过程可以通过继承核心镜像类实现,并指定所需的软件包集合[^1]。例如: ```bash SUMMARY = "Custom Yocto Image" DESCRIPTION = "A custom image built with specific packages." inherit core-image IMAGE_INSTALL += "packagegroup-core-full-cmdline \ vim \ nano \ openssh-server" LICENSE = "MIT" ``` 上述代码片段展示了如何扩展默认的核心镜像以包含额外的应用程序(如 `vim`, `nano`, 和 `openssh-server`)。保存这个文件到适当目录下后,可以使用以下命令进行编译: ```bash bitbake your-custom-image-name ``` 这一步骤会触发整个构建流程,包括但不限于引导加载程序(u-boot)[^2]、内核及其模块的组装,最后形成完整的根文件系统(rootfs),其产物位于 `<build-directory>/tmp/deploy/images/` 路径之下[^3]。 #### 使用包管理工具处理已存在的镜像中的软件 对于已经生成好的镜像而言,在某些情况下可能希望动态调整其中所含有的组件而不重新完全重建一次新的版本。虽然Yocto本身并不提供类似于Ubuntu APT那样的交互式前端界面来进行实时增删改查工作,但它确实支持几种不同的打包格式(OPKG, RPM 或 DEB),允许用户借助对应的客户端实用程序执行相似功能。 比如如果选择了OPKG作为目标平台上的包管理系统,则可以在设备上运行如下命令添加新应用或者移除现有的一: ```bash opkg update && opkg install some-package opkg remove another-package ``` 需要注意的是,这种灵活性取决于最初设计阶段是否启用了相应的选项;如果没有特别设置,默认生成的只读型rootfs可能无法直接修改。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜流冰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值