一般在Yocto没有办法覆盖.bbclass像这样的文件.bb文件(使用.bbappend),为了归档需要复制整个类文件并移动到另一层,我可以使用以下配置来管理它:
层结构:
$ tree ../meta-test/
../meta-test/
├── classes
│ └── image-live.bbclass
├── conf
│ └── layer.conf
├── COPYING.MIT
├── README
└── recipes-example
└── example.bb
3 directories, 5 files
内容示例.bb recipe:
$ cat ../meta-test/recipes-example/example/example.bb
LICENSE = "CLOSED"
inherit image-live
最后非常重要的事情*、配置文件conf/bblayers.conf需要用这个命令配置元测试/ above meta/ layer:
$ 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)
*我不知道为什么要bake图层优先级 https://www.yoctoproject.org/docs/2.5/mega-manual/mega-manual.html#var-BBFILE_PRIORITY在这里不起作用,只能修改图层顺序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 元测试/ below meta/ in 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)