简体   繁体   English

yocto中的机器特定层

[英]Machine specific layers in yocto

I want to add some layers fetch from upstream for a new machine (call it A) mainly just to use the machine A configure file, kernel and u-boot provided from those layers. 我想从上游为新机器添加一些层提取(称之为A),主要是为了使用机器从这些层提供的配置文件,内核和u-boot。 However, the new layers have several bbappend files (with bb files as well) that the version is different with other machines' layers in my yocto project. 但是,新图层有几个bbappend文件(也包含bb文件),该版本与我的yocto项目中的其他机器图层不同。

For example, machine A has its own gstreamer1.0_1.8.1.bb and bbappend file. 例如, 机器A有自己的gstreamer1.0_1.8.1.bb和bbappend文件。 Other machines are using gstreamer1.0_1.6.1.bb . 其他机器正在使用gstreamer1.0_1.6.1.bb What happens when I build the image for the other machine is that it builds the version 1.8.1 because Yocto will always look for the newest compatible version of package and build it. 当我为其他机器构建映像时会发生什么,它构建了1.8.1版本,因为Yocto将始终寻找最新的兼容版本的包并构建它。 However, the gstreamer1.0_1.8.1.bbappend file is written specifically for machine A, does not apply to others and causing errors. 但是,gstreamer1.0_1.8.1.bbappend文件是专门为机器A编写的,不适用于其他人并导致错误。 Not only the gstreamer, there are more. 不仅是gstreamer,还有更多。

I got an idea like BBLAYERS_A += "new_layers \\ ..." in the bblayers.conf file, but unfortunately it does not work the way I want it to. 我在bblayers.conf文件中得到了类似BBLAYERS_A += "new_layers \\ ..."的想法,但遗憾的是它不能按照我想要的方式工作。

Another idea I have is like: 我的另一个想法是:

BBMASK_B = "new_layers \ ..."
BBMASK_C = "new_layers \ ..."
BBMASK_D = "new_layers \ ..."
BBMASK_E = "new_layers \ ..."
BBMASK_F = "new_layers \ ..."
BBMASK_G = "new_layers \ ..."
BBMASK_H = "new_layers \ ..."
BBMASK_I = "new_layers \ ..."
...

It doesn't look good to me and I doubt it won't work as well. 它对我来说并不好看,我怀疑它不会起作用。 I think the build procedure is to load the bblayers.conf file first, then the local.conf. 我认为构建过程首先加载bblayers.conf文件,然后加载local.conf。 Therefore, before knowing what machine it is going to build, the layers are deployed. 因此,在了解要构建的机器之前,将部署层。

My question is how can I make those newly added layers that work with machine A only, but won't get used by the other machines . 我的问题是如何才能使这些新添加的图层仅与机器A一起使用,但不会被其他机器使用

You should try to make a BSP-layer to only cause any effects if any of the machines in that layer is being used. 如果正在使用该层中的任何机器,您应该尝试使BSP层仅产生任何效果。

In your example, gstreamer1.0_1.8.1.bb , you should add 在您的示例中, gstreamer1.0_1.8.1.bb ,您应该添加

COMPATIBLE_MACHINE = "^machinea$"

note, it's a regular expression, so by omitting the leading ^ and ending $ , you can by mistake match similar named machines. 注意,它是一个正则表达式,因此通过省略前导^和结束$ ,您可以错误地匹配类似的命名机器。

Also note, I changed your example of machine name A to machinea , as machines needs to be small letters. 另请注意,我将机器名A示例更改为machinea ,因为机器需要是小写字母。

If you're adding .bbappend files, you typically have them modify the build by eg. 如果您要添加.bbappend文件,通常.bbappend他们通过例如修改构建。

SOME_VAR_machinea

If you're overriding files, you typically put them in a structure like: 如果您要覆盖文件,通常将它们放在如下结构中:

recipes-support/myrecipe/myrecipe/machinea/some-file

In this case, note the extra subdirectory machinea , which will ensure that some-file is only being used for that particular machine. 在这种情况下,请注意额外的子目录machinea ,它将确保some-file仅用于该特定计算机。

The solution that works for me is to use DISTRO feature from yocto. 适合我的解决方案是使用yocto的DISTRO功能。 It is flexible. 它很灵活。 What I did is to use different DISTRO for machine_A (meaning using a different configuration file for A), then include a MACHINE_A.inc with BBMASK = "" (or BBMASK = "layers that not for A" ). 我所做的是为machine_A使用不同的DISTRO (意味着为A使用不同的配置文件),然后包括带有BBMASK = ""MACHINE_A.inc (或BBMASK = "layers that not for A" )。

In the default Poky DISTRO , inside the bblayers.conf file, I block all layers introduced by machine_A by using BBMASK = "all machine_A's layers" . 在默认的Poky DISTRO ,在bblayers.conf文件中,我使用BBMASK = "all machine_A's layers"BBMASK = "all machine_A's layers" machine_A引入的BBMASK = "all machine_A's layers"

In the local.conf, I set DISTRO_machine_A = "MACHINE_A" , so when building the image for machine_A , bitbake will look into DISTRO and find the configuration file for machine_A , which will reset the global BBMASK to enable layers for machine_A itself (or even to block other layers). 在local.conf中,我设置了DISTRO_machine_A = "MACHINE_A" ,因此在为machine_A构建映像时,bitbake将查看DISTRO并找到machine_A的配置文件,它将重置全局BBMASK以启用machine_A本身的层(甚至阻止其他层)。

By using DISTRO , I am able to get a separate build environment for different machines while introducing new layers into the project. 通过使用DISTRO ,我可以为不同的机器获得单独的构建环境,同时在项目中引入新层。 Kind of like BBMASK_machine_A ( BBMASK_machine_A won't actually work as my question described). 有点像BBMASK_machine_ABBMASK_machine_A实际上不会像我描述的问题那样工作)。

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

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