Build Device Tree Overlays from my layer

Hi @MariusM !

I created a layer just to test adding custom Device Tree Overlay to a Yocto build.

I just tested the same layer on BSP 6 (branch kirkstone-6.x.y of manifest tdxref/default.xml, specifically at commit b85f89d19dbf6e0c503caee6415cb11c507d77dd) and it worked. Here is how I did it:

First I created the layer and the bbappend inside it. You can use tools like bitbake-layers to create the layer and recipetool to create the bbappend targeting the specific original recipe you need. In your case (Verdin iMX8MP), the original recipe will be device-tree-overlays_git.bb, as you already correctly did and is also pointed out in our documentation Device Tree Overlays (Linux) | Toradex Developer Center.

meta-xablau
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-kernel
    └── linux
        ├── device-tree-overlays
        │   └── xablau_overlay.dts
        └── device-tree-overlays_git.bbappend

Here is the content of device-tree-overlays_git.bbappend:

FILESEXTRAPATHS:prepend := "${THISDIR}/device-tree-overlays:"

CUSTOM_OVERLAYS_SOURCE = " \
    xablau_overlay.dts \
"
CUSTOM_OVERLAYS_BINARY = " \
    xablau_overlay.dtbo \
"

SRC_URI += " \
    file://xablau_overlay.dts \
"

#TEZI_EXTERNAL_KERNEL_DEVICETREE += " \
#    ${CUSTOM_OVERLAYS_BINARY} \
#"

TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT = " \
    ${CUSTOM_OVERLAYS_BINARY} \
"

do_collect_overlays:prepend() {
    for DTS in ${CUSTOM_OVERLAYS_SOURCE}; do
        cp ${WORKDIR}/${DTS} ${S}
    done
}

Then, after executing bitbake -c compile device-tree-overlays, I can see the resulting xablau_overlay.dtbo in build/tmp/work/<machine>-tdx-linux/device-tree-overlays/toradex_5.15-2.2.x-imx+gitAUTOINC+85e4729bdd-r0/build/xablau_overlay.dtbo.

As stated in the Developer article referenced above, please check the meta-toradex-bsp-common/classes/toradex-devicetree.bbclass for more information about TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT and TEZI_EXTERNAL_KERNEL_DEVICETREE.

Let us know if this helps you.

Best regards,

1 Like