bitbake:如何根据MACHINE添加软件包? [英] bitbake: how to add package depending on MACHINE?
问题描述
使用bitbake
构建的映像必须包含用于不同计算机的不同程序包(例如,对于machine1
,我需要将程序包package1
添加到映像中,而对于machine2
,则不需要).
My images, built with bitbake
, must contain different packages for different machines (say, I need to add package package1
to image for machine1
, but not for machine2
).
可以添加行
IMAGE_INSTALL_append_machine1 = " package1"
到图像配方.但是我认为这是不可持续的,因为IMAGE_INSTALL_append_machine1
可能在其他配方中定义(不受我的控制),并且较早的定义会被较新的定义覆盖.这就是我认为Yocto Project Development手册警告的内容使用IMAGE_INSTALL .
to the image recipe. But I do not think this is sustainable, as IMAGE_INSTALL_append_machine1
may be defined in some other recipe (which is not under my control) and the earlier definition gets overwritten with the later one. This is what I think Yocto Project Development manual warns about using IMAGE_INSTALL.
我的担忧有效吗?在这种情况下,写食谱的正确方法是什么?
Is my concern valid? What is the proper way to write the recipe(s) in this case?
推荐答案
我相信您要查找的功能是base_contains
I believe the function you are looking for is base_contains
此函数用于根据以下参数将变量设置为两个值之一 第三个变量的定义.
This functions is used to set a variable to one of two values based on the definition of a third variable.
${@base_contains('variable-name', 'value', 'true-result', 'false-result',d)}"
其中:
variable-name这是要检查的变量的名称.
variable-name This is the name of a variable to check.
value这是将变量与之进行比较的值.
value This is the value to compare the variable against.
true-result如果变量等于值,那么这就是 由该函数返回.
true-result If the variable equals the value then this is what is returned by the function.
false-result如果变量不等于值,则为 函数返回什么.
false-result If the variable does not equal the value then this is what is returned by the function.
还有一件事情,您可以使用??=
提供默认值. ?=
和??=
之间的区别在于,使用??=
分配直到解析过程结束才发生.
One more thing, you could use ??=
to provide a default value. The differences between ?=
and ??=
is that with ??=
the assignment does not occur until the end of the parsing process.
您可以查看以下示例之一此处用于图像配方
You could take a look at one of the example here for image recipe
http://www.embeddedlinux.org.cn/OEManual/recipes_advanced_python.html
这篇关于bitbake:如何根据MACHINE添加软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!