简体   繁体   English

"如何在 Yocto 中启用\/禁用特定机器的特定 bbappend"

[英]How to enable/disable a particular bbappend for a specific MACHINE in Yocto

I'm trying to understand the mechanism Yocto provides to enable/disable a particular bbappend for a specific MACHINE.我试图了解 Yocto 为特定机器启用/禁用特定 bbappend 提供的机制。 I read this link (Modifying Variables to Support a Different Machine):我读了这个链接(修改变量以支持不同的机器):

https://www.yoctoproject.org/docs/1.5/dev-manual/dev-manual.html#best-practices-to-follow-when-creating-layers https://www.yoctoproject.org/docs/1.5/dev-manual/dev-manual.html#best-practices-to-follow-when-creating-layers

And also found some information related here on stack overflow:并且还发现了一些与堆栈溢出相关的信息:

Machine specific layers in yocto 在 yocto 中加工特定层

I have tried putting all this information into practice without any success.我尝试将所有这些信息付诸实践,但没有任何成功。 This is my particular problem:这是我的特殊问题:

A BSP layer for a "x" platform provides a qtbase_%.bbappend that modifies qtbase recipe from meta-qt5. “x”平台的 BSP 层提供了一个 qtbase_%.bbappend,它从 meta-qt5 修改 qtbase 配方。 I need this qtbase_%.bbappend only applying when building for MACHINE="x", but not for other different machines.我需要这个 qtbase_%.bbappend 仅在为 MACHINE="x" 构建时应用,但不适用于其他不同的机器。

This is the content of the original qtbase_%.bbappend defined on the x-bsp-layer:这是在x-bsp-layer上定义的原始qtbase_%.bbappend的内容:

PACKAGECONFIG_GL   = "gles2"
PACKAGECONFIG_FONTS = "fontconfig"
PACKAGECONFIG_APPEND = " \
${@bb.utils.contains("DISTRO_FEATURES", "wayland", "xkbcommon-evdev", \
   bb.utils.contains("DISTRO_FEATURES", "x11", " ", "libinput eglfs gbm", d), d)} \
"
PACKAGECONFIG_append = " ${PACKAGECONFIG_APPEND} kms accessibility sm"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
PACKAGECONFIG_remove = "evdev"

Whenever I try to build an image for a PLATFORM different from "x", the compilation is broken:每当我尝试为不同于“x”的平台构建图像时,编译就会中断:

| ERROR: Feature 'opengles2' was enabled, but the pre-condition 'config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)' failed.
| ERROR: Feature 'eglfs' was enabled, but the pre-condition '!config.android && !config.darwin && !config.win32 && features.egl' failed.
| ERROR: Feature 'gbm' was enabled, but the pre-condition 'libs.gbm' failed.

Removing the x-BSP-layer from bblayers.conf solves the problem, but that's not the kind of solution I am looking for.从 bblayers.conf 中删除 x-BSP 层可以解决问题,但这不是我正在寻找的解决方案。

I tryied fixing this using information provided in previous links.我尝试使用先前链接中提供的信息来解决此问题。 I modified qtbase_%.bbappend recipe in this way:我以这种方式修改了 qtbase_%.bbappend 配方:

PACKAGECONFIG_GL_x   = "gles2"
PACKAGECONFIG_FONTS_x = "fontconfig"
PACKAGECONFIG_APPEND_x = " \
${@bb.utils.contains("DISTRO_FEATURES", "wayland", "xkbcommon-evdev", \
   bb.utils.contains("DISTRO_FEATURES", "x11", " ", "libinput eglfs gbm", d), d)} \
"
PACKAGECONFIG_append_x = " ${PACKAGECONFIG_APPEND} kms accessibility sm"
FILESEXTRAPATHS_prepend_x := "${THISDIR}/${PN}:"
PACKAGECONFIG_remove_x = "evdev"

As you can see, I appended "_x" suffix to all recipe variables.如您所见,我在所有配方变量中附加了“_x”后缀。 It's supposed (at least that it's what I understand) those "_x" make the variable being assigned just in case the PLATFORM="x" is defined.假设(至少这是我所理解的)那些“_x”使变量被分配,以防万一 PLATFORM="x" 被定义。 Right?对? But it doesn't work as expected, it generates the same problem.但它没有按预期工作,它会产生同样的问题。 So, in practice, this means I don't undestand even the basics of this mechanism.因此,在实践中,这意味着我什至不了解这种机制的基础知识。

Can some of you provide a good explanation on this?你们中的一些人可以对此提供一个很好的解释吗? I think it should be helpful for others with same issue outthere.我认为它应该对其他有同样问题的人有所帮助。 Thanks a lot for your time!非常感谢您的时间! :-) :-)

Just add COMPATIBLE_MACHINE = "x" in .bbappend file. 只需在.bbappend文件中添加COMPATIBLE_MACHINE =“ x”。

As you can see, I appended "_x" suffix to all recipe variables 如您所见,我在所有配方变量后均附加了“ _x”后缀

Remove all "_x" suffix in .bbappend file. 删除.bbappend文件中的所有“ _x”后缀。

Note adding COMPATIBLE_MACHINE as suggested would change the signatures of the original recipe, which is bad practice, and would result in your layer failing the compatibility test carried out by the yocto-check-layer script.请注意,按照建议添加COMPATIBLE_MACHINE会更改原始配方的签名,这是不好的做法,并且会导致您的层无法通过yocto-check-layer脚本执行的兼容性测试。 Consult this for details.有关详细信息,请参阅

The correct way of making a .bbappend file machine-specific is through overrides, as you're already doing in your proposal.制作特定于机器的.bbappend文件的正确方法是通过覆盖,正如您已经在提案中所做的那样。 Why it still fails is a different question.为什么它仍然失败是一个不同的问题。 I suggest you to inspect the variables of the recipe through bitbake, and switch machines to verify they change accordingly.我建议您通过 bitbake 检查配方的变量,并切换机器以验证它们是否相应更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM