[英]bitbake: how to add package depending on MACHINE?
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
). 我用bitbake
构建的映像必须包含用于不同机器的不同程序包(例如,我需要将package1
程序包package1
添加到machine1
,而不是machine2
)。
It is possible to add line 可以添加行
IMAGE_INSTALL_append_machine1 = " package1"
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. 但是我认为这是不可持续的,因为IMAGE_INSTALL_append_machine1
可能是在其他配方中定义的(不受我的控制),并且较早的定义会被较新的定义覆盖。 This is what I think Yocto Project Development manual warns about using IMAGE_INSTALL . 这是我认为Yocto Project Development手册警告使用IMAGE_INSTALL的内容 。
Is my concern valid? 我的担忧有效吗? What is the proper way to write the recipe(s) in this case? 在这种情况下,编写配方的正确方法是什么?
I believe the function you are looking for is base_contains
我相信您正在寻找的功能是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)}"
where:${@base_contains('variable-name', 'value', 'true-result', 'false-result',d)}"
,其中:variable-name This is the name of a variable to check. variable-name这是要检查的变量的名称。
value This is the value to compare the variable against. value这是比较变量的值。
true-result If the variable equals the value then this is what is returned by the function. 真结果如果变量等于该值,则此为函数返回的结果。
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 http://www.embeddedlinux.org.cn/OEManual/recipes_advanced_python.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.