首页 > 解决方案 > 在尝试使用 Bitbake 构建时,用 python 编写的 Yocto 食谱给了我一个错误

问题描述

这是我第一次遇到用 python 编写的配方文件,它给了我一个错误。错误是:

../meta-intel/recipes-rt/images/core-image-rt.bb: Error executing a python function in <code>:

这是来自元英特尔分支“[master] intel-vaapi-driver: 2.1.0 -> 2.2.0”的配方。

我的 poky 版本是“[morty] 文档:更新了 2.2.4 发布日期的手动修订表。

我的 BITBAKE 版本是:“BitBake Build Tool Core version 1.32.0”

core-image-rt.bb 的内容是:

    require recipes-core/images/core-image-minimal.bb

# Skip processing of this recipe if linux-intel-rt is not explicitly specified as the
# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying
# to build multiple virtual/kernel providers.
python () {
    if d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-intel-rt":
        raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-intel-rt to enable it")
}

DESCRIPTION = "A small image just capable of allowing a device to boot plus a \
real-time test suite and tools appropriate for real-time use."
DEPENDS += "linux-intel-rt"

IMAGE_INSTALL += "rt-tests hwlatdetect"

LICENSE = "MIT"

如果您需要任何其他信息,请告诉我,我会尽力提供。

我通常可以在我的 ubuntu 机器上构建图像,但不相信曾经必须构建一个用 python 编写食谱的图像

标签: pythonyoctorecipe

解决方案


您正在使用g.getVar方法的不兼容 API。在morty release 作为最后一个使用第二个参数的旧方式,仍然需要提供布尔参数:

...
if d.getVar("PREFERRED_PROVIDER_virtual/kernel", True) != "linux-intel-rt":
...

请查看其中一个commit,它将在下一个版本中删除。


推荐阅读