bitbake: how to add package depending on MACHINE?

走远了吗. 提交于 2019-11-30 19:01:58

问题


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).

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. 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?


回答1:


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)}" where:

variable-name This is the name of a variable to check.

value This is the value to compare the variable against.

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



来源:https://stackoverflow.com/questions/35767329/bitbake-how-to-add-package-depending-on-machine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!