简体   繁体   English

bitbake:如何根据MACHINE添加软件包?

[英]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.

相关问题 用java电子书怎么打包? - Electron with java how to package? 如何根据操作系统动态继承? - How to dynamically inherit depending on operating system? 无法将Xamarin.Essentials包添加到项目 - Unable to add Xamarin.Essentials package to project 你如何让机器保持清醒? - How do you keep the machine awake? 如何从远程机器获取 ip 地址? - How do you get the ip address from a remote machine? 如何在Kony应用中执行逻辑,具体取决于它是在iOS,Android还是网络浏览器上运行 - How to execute logic in a Kony app depending on whether it runs on iOS, Android or a web browser 如何根据当前的键盘布局从 QKeyEvent 捕获 QKeySequence? - How can I capture QKeySequence from QKeyEvent depending on current keyboard layout? 如果蛋糕在 Windows 中运行,如何添加特定的包 - How to addin specific package if cake running in windows 如何为ARM交叉编译并在NetBeans的另一台计算机上调试? - How do I cross-compile for ARM and debug on another machine in NetBeans? 如何使用 Xamarin 在 xaml 中创建自定义字体大小,以便您可以根据设备更改字体大小? - How to create a custom font size in xaml using Xamarin, so that you can change font sizes depending on device?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM