如何使用 packagegroup 将外部配方集成到 yocto 图像中?

How to integrate external recipes into yocto image using packagegroup?

我正在使用来自 STM 的 yocto 发行版: https://wiki.st.com/stm32mpu-ecosystem-v1/wiki/STM32MP1_Distribution_Package

目录结构如下

openstlinux-20-02-19  OpenSTLinux distribution
├── layers 
│    ├── meta-openembedded                Collection of layers for the OpenEmbedded-Core universe (OpenEmbedded standard)
│    ├── meta-qt5                         QT5 layer for OpenEmbedded (standard)
│    ├── meta-st
│    │   ├── meta-st-openstlinux          STMicroelectronics layer that contains the frameworks and images settings for the OpenSTLinux distribution
│    │   ├── meta-st-stm32mp              STMicroelectronics layer that contains the description of the BSP for the STM32 MPU devices
│    │   │   ├── recipes-bsp
│    │   │   │   ├── alsa                 Recipes for ALSA control configuration
│    │   │   │   ├── drivers              Recipes for Vivante GCNANO GPU kernel drivers
│    │   │   │   ├── trusted-firmware-a   Recipes for TF-A
│    │   │   │   └── u-boot               Recipes for U-Boot
│    │   │   ├── recipes-extended
│    │   │   │   ├── linux-examples       Recipes for Linux examples for STM32 MPU devices
│    │   │   │   ├── m4coredump           Recipes for script to manage coredump of cortexM4
│    │   │   │   └── m4projects           Recipes for firmware examples for Cortex M4
│    │   │   ├── recipes-graphics
│    │   │   │   ├── gcnano-userland      Recipes for Vivante libraries OpenGL ES, OpenVG and EGL (multi backend)
│    │   │   │   └── [...]
│    │   │   ├── recipes-kernel
│    │   │   │   ├── linux                Recipes for Linux kernel
│    │   │   │   └── linux-firmware       Recipes for Linux firmwares (example, Bluetooth firmware)
│    │   │   ├── recipes-security
│    │   │   │   └── optee                Recipes for OPTEE
│    │   │   ├── recipes-st
│    │   │   │   └── images               Recipes for the bootfs and userfs partitions binaries
│    │   │   └── [...]
│    │   ├── meta-st-stm32mp-addons       STMicroelectronics layer that helps managing the STM32CubeMX integration
│    │   └── scripts
│    │       ├── envsetup.sh              Environment setup script for Distribution Package
│    │       └── [...]
│    ├── meta-timesys                     Timesys layer for OpenEmbedded (standard)
│    └── openembedded-core                Core metadata for current versions of OpenEmbedded (standard)

我已经从 openembeddedlayers 克隆了一个图层并将其添加到构建目录中的 bblayers 图层文件中... 现在,我想做的是制作一个 packagegroup.bb 文件,并将该层和所有其他层的配方添加到该包组文件中,以便在我对图像进行 bitbake 时将其添加到我的图像中。

我的包组文件如下所示

SUMMARY = "packagegroup containing packages  
client"LICENSE = "MIT"
inherit packagegroup
RDEPENDS_${PN} = "\
nano \
tmux \  
python3-pyserial \  
python3-paho-mqtt \  
python3-pymodbus \  
sqlite3 \  
python-pysqlite \  
python3-sqlite3 \  
"
现在,我应该把这个文件放在哪里,我应该把它添加到我的项目中的什么地方?我是 yocto 的新手,无法理解这一点。

包组只是用于所有意图和目的的 bitbake 食谱。因此,您可以简单地创建一个相对于图像目录的新目录,并将其放在那里。从历史上看,我已经这样做了

<path to>/recipes-images/images
<path to>/recipes-images/packagegroups

然后将您的包组文件放在包组目录中。只要你的图层和元目录配置正确,就会被找到。

编辑 我应该提一下,您也可以将 packagegroup 文件放在与图像相同的目录中。如果你只有一两个,这可能有意义。

您没有自己的元层,这意味着您要么跳过包组并将每个配方添加到您的 local.conf,要么创建您自己的元层。 local.conf 选项会 faster/easier.

食谱(或 bbappend)的所有可能位置都由 BBFILES 变量指定,该变量在您想要食谱的层的 conf/layer.conf 中找到。参见 meta-openembedded/meta-oe/conf/layer.conf [1]:

BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"

这意味着将找到名称以 recipes- 开头的任何目录的任何子目录中以 .bb 或 .bbappend 结尾的任何文件。

查找是否找到您的 bb 食谱或 bbappend 的方法是 运行 bitbake-layers show-recipesbitbake-layers show-appends.

[1] http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/conf/layer.conf#n15