Imx8mp custom device tree build

I am trying to build a custom device tree which is to be included a yocto build.
I have followed all the instructions here: https://developer.toradex.com/linux-bsp/os-development/build-yocto/custom-meta-layers-recipes-and-images-in-yocto-project-hello-world-examples/#customize-the-kernel

The device tree I am using is a copy of linux-toradex/arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi-dev.dts. The only difference to the file is that I include it on my custom layer under meta-my-layer/recipies-kernel/linux/linux-toradex/imx8mp-verdin-custom.dts and I have a bbappend with pretty much all the same details mentioned in the linked topic.
I have not added the patch file, defconfig or the u-boot bbappend changes (as I don’t need those yet).

Having run a bitbake without errors, I am unable to see final built dtb anywhere (expecting a file called imx8mp-verdin-custom.dtb somewhere on my disk. However, this is not found anywhere (not even in any of the textual build scripts/files).

The dts is copied into all locations I can find that contain the other std and dtsi files. However, it never seems to get built.
Am I missing something?

Hi @izzy_building !

Welcome to Toradex Community! :tada:
Feel free to browse around! :smiley:

Some questions:

  1. Could you please share your recipe?
  2. Also, which BSP version are you using?
  3. Did you create the extra .conf for the machine?
    3.1. Did you include it in your conf/layer.conf?

Best regards,

Unfortunately, my layer is only on my local machine while I am testing.

my initial setup is using repo and the toradex-manifest from here: https://git.toradex.com/cgit/toradex-manifest.git/log/?h=kirkstone-6.x.y

I have a layers/meta-test-drivers/conf/machine/verdin-imx8mp-extra.conf:

KERNEL_DEVICETREE:append = " freescale/imx8mp-verdin-custom.dtb"

I have a layers/meta-test-drivers/conf/layer.conf:

BBPATH .= ":${LAYERDIR}"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "meta-test-drivers"
BBFILE_PATTERN_meta-test-drivers = "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-test-drivers = "30"

LAYERSERIES_COMPAT_meta-test-drivers = "kirkstone"

include conf/machine/${MACHINE}-extra.conf

I have a layers/meta-test-drivers/recipes-kernel/linux/linux-toradex_%.bbappend:

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

CUSTOM_DEVICETREE = "imx8mp-verdin-custom.dts"
SRC_URI += " file://${CUSTOM_DEVICETREE}"
do_configure:append() {
    # For arm32 bit freescale/NXP devices
    # cp ${WORKDIR}/${CUSTOM_DEVICETREE} ${S}/arch/arm/boot/dts/freescale
    # For arm64 bit freescale/NXP devices
    cp ${WORKDIR}/${CUSTOM_DEVICETREE} ${S}/arch/arm64/boot/dts/freescale
}

My layers/meta-test-drivers/recipes-kernel/linux/linux-toradex/imx8mp-verdin-custom.dts is a copy of linux-toradex/arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi-dev.dts (retrieved from build/tmp/work/verdin....../git/arch/arm64/boot/dts/freescale of previous normal build.

I have added my meta-test-drivers layer to my build/conf/bbappend.conf.

Hopefully that is everything.
It seems to build, but I don’t see the expected dtb anywhere.

Regards,

Hi @izzy_building !

I just managed to build a custom device tree (from .dts to .dtb) following the referred Toradex Developer article with no issue.

So let’s go through a couple of checkpoints and try to find out what is missing.

Please share the output of the following commands.

Appends applied to linux-toradex

bitbake-layers show-appends linux-toradex

To be sure that your bbappend is being applied. If not, please add your layer to build/conf/bblayers.conf and check again.

Content of KERNEL_DEVICETREE

bitbake-getvar -r linux-toradex KERNEL_DEVICETREE

Your freescale/imx8mp-verdin-custom.dtb should be there.

do_configure task run

cat /path/to/build/tmp/work/verdin_imx8p-tdx-linux/linux-toradex/<version>/temp/run.do_compile | grep imx8mp-verdin-custom.dts

You should get the line that copies the .dts to its place.

do_compile task log

cat /path/to/build/tmp/work/verdin_imx8p-tdx-linux/linux-toradex/<version>/temp/log.do_compile | grep imx8mp-verdin-custom.dtb

You should see your device tree being compiled here. This is one line you should get with no errors related to it:

  DTC     arch/arm64/boot/dts/freescale/imx8mp-verdin-custom.dtb

Search among build files

fdfind imx8mp-verdin-custom.dt /path/to/build/deploy/images/verdin-imx8mp
fdfind imx8mp-verdin-custom.dt /path/to/build/tmp/work/verdin_imx8p-tdx-linux/linux-toradex

With these searches, you should find both the source .dts and compile .dtb files for your device tree. (The fdfind command is a very good and performant replacement to the usual find file: GitHub - sharkdp/fd: A simple, fast and user-friendly alternative to 'find')

Let us know if this helps you! :slight_smile:

Best regards,

1 Like

@henrique.tx - Thanks for all the info here.

I will try these out to check these as soon as I can and come back with results.