Search code examples
raspberry-pikernelembedded-linuxyoctodevice-tree

yocto - create a meta layer with a bbappend file adding dts flle to raspberry pi kernel


I'm working with Yocto Kirkstone. My goal is to add a dts file to the raspberry pi linux kernel. I followed this answer and ended up with a new meta-layer and this directory tree:

meta-main-layer
meta-raspberrypi
meta-mydts/
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-kernel
    └── linux
        ├── linux-raspberrypi
        │   └── raspberrypi4-64
        │       └── my.dts
        └── linux-raspberrypi_5.15.bbappend

and the linux-raspberrypi_5.15.bbappend:

SRC_URI += "file://mydts.dts;subdir=git/arch/arm/boot/dts/overlays"

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

PACKAGE_ARCH = "${MACHINE_ARCH}"
KERNEL_DEVICETREE += "mydst.dtb"

meta-main-layer is the layer with image definition, it does include the meta-mydts with

IMAGE_INSTALL:append += " mydts"

but for some reason yocto complains saying that there's no target mydts as below:

ERROR: Nothing RPROVIDES 'mydts' (but meta-main-layer/recipes-core/images/image-64.bb RDEPENDS on or otherwise requires it)
NOTE: Runtime target 'mydts' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['mydts']

How can a meta-layer with linux kernel patches be turned into something that is buildable? What am I missing?


Solution

  • You should read Yocto documentation RPROVIDE.

    Basically you want Bitbake to recognize your meta-layer. IMAGE_INSTALL:append is needed when you want to deploy a package in your final target. For example you have SRC_URI += "helloword.c" in my_helloword.bb then IMAGE_INSTALL:append = my_helloworld will add your binary helloword.o in final target.

    Now you can understand trying to IMAGE_INSTALL:append a whole meta-layer is nonsense.

    The proper way to make your meta-layer "discoverable" by bitbake is to go in your build directory, add in your conf/bblayers.conf file the path of your meta-layer in the variable BBLAYERS.

    Also note that there is a syntax error in KERNEL_DEVICETREE += "mydst.dtb" It should be KERNEL_DEVICETREE += "mydts.dtb"