简体   繁体   English

通过元层覆盖Yocto类

[英]Overwriting Yocto Classes through meta-layer

Thanks for your time and support 感谢您的时间和支持

I am planning to use swupdate for updates. 我打算使用swupdate进行更新。 So, I need to create an additional partition in which I need to store the recovery partition. 所以,我需要创建一个额外的分区,我需要在其中存储恢复分区。

poky/meta/classes/image-live.bbclass

is the class which creates partitions and flashes the root file system. 是创建分区并闪烁根文件系统的类。 I have updated the above file to create one more partition and store the swupdate root filesystem. 我已经更新了上面的文件以创建另一个分区并存储swupdate根文件系统。

How can I override this class in my own BSP layer, I don't want to touch poky source code.. 如何在我自己的BSP层中覆盖此类,我不想触及poky源代码..

Generally in Yocto there is no way to override .bbclass files like with .bb files (using .bbappend ), to archive that it is needed to copy whole class file and move to another layer, I was able to manage that with this configuration: 通常在Yocto中 ,没有办法覆盖.bbclass文件,如.bb文件(使用.bbappend ),归档需要复制整个类文件并移动到另一层,我能够通过这种配置来管理它:

layer structure: 层结构:

$ tree ../meta-test/
../meta-test/
├── classes
│   └── image-live.bbclass
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-example
    └── example.bb

3 directories, 5 files

content of example.bb recipe: example.bb配方的内容:

$ cat ../meta-test/recipes-example/example/example.bb 
LICENSE = "CLOSED"
inherit image-live

and finally really important thing* , the configuration file conf/bblayers.conf needs to be configured with this order meta-test/ above meta/ layer: 最后非常重要* ,配置文件conf / bblayers.conf需要使用此订单元测试/上面的元/层配置:

$ tail -n6 conf/bblayers.conf 
BBLAYERS ?= " \
  /home/user/poky/meta-test \
  /home/user/poky/meta \
  /home/user/poky/meta-poky \
  /home/user/poky/meta-yocto-bsp \
  "

$ bitbake -e example -D | grep ^DEBUG:\\sInheriting\\s.*image-live.bbclass\\s\(from
DEBUG: Inheriting /home/user/poky/meta-test/classes/image-live.bbclass (from /home/user/poky/meta-test/recipes-example/example/example.bb:3)

*I don't know why bitbake layer priority doesn't work here, only modifying layers order in conf/bblayers.conf allows me to achieve the main goal: *我不知道为什么bitbake 图层优先级在这里不起作用,只有在conf / bblayers.conf中修改图层顺序才能让我实现主要目标:

$ bitbake-layers show-layers
NOTE: Starting bitbake server...
layer                 path                                      priority
==========================================================================
meta                  /home/user/poky/meta        5
meta-test             /home/user/poky/meta-test   10
meta-poky             /home/user/poky/meta-poky   5
meta-yocto-bsp        /home/user/poky/meta-yocto-bsp  5

layer meta-test/ below meta/ in conf/bblayers.conf : layer meta-test /下面的meta /conf / bblayers.conf中

$ tail -n6 conf/bblayers.conf 
BBLAYERS ?= " \
  /home/user/poky/meta \
  /home/user/poky/meta-test \
  /home/user/poky/meta-poky \
  /home/user/poky/meta-yocto-bsp \
  "    

$ bitbake -e example -D | grep ^DEBUG:\\sInheriting\\s.*image-live.bbclass\\s\(from
DEBUG: Inheriting /home/user/poky/meta/classes/image-live.bbclass (from /home/user/poky/meta-test/recipes-example/example/example.bb:3)

It was dicussed in 2012 on yocto mailing group: https://lists.yoctoproject.org/pipermail/yocto/2012-January/004379.html 2012年yocto邮件组讨论了这个问题: https ://lists.yoctoproject.org/pipermail/yocto/2012-January/004379.html

Only creating the same class and reordering layers as astor555 wrote. 只创建与astor555相同的类和重新排序图层。 That your BSP layer will be parsed/used first. 您的BSP层将首先被解析/使用。

另一个选择是将原始image-live.bbclass复制到您自己的现有图层中,并将其重命名为有意义的内容( my-image-live.bbclass ),然后只需将其继承到您需要的地方inherit my-image-live

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

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