7

Thanks for your time and support

I am planning to use swupdate for updates. 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.

How can I override this class in my own BSP layer, I don't want to touch poky source code..

md.jamal
  • 4,067
  • 8
  • 45
  • 108

3 Answers3

13

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:

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:

$ 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:

$ 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-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:

$ 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)
Sebastián
  • 397
  • 2
  • 7
lukaszgard
  • 891
  • 8
  • 16
2

It was dicussed in 2012 on yocto mailing group: https://lists.yoctoproject.org/pipermail/yocto/2012-January/004379.html

Only creating the same class and reordering layers as astor555 wrote. That your BSP layer will be parsed/used first.

0

Another option is to copy the original image-live.bbclass into your own existing layer and rename it to something meaningful (my-image-live.bbclass) and then simply inherit it where you need as inherit my-image-live

User3219
  • 88
  • 1
  • 8