Modifying the default device tree in a torizon-docker yocto build

Hi @drew.tx,

Per your suggestion I’m extending the thread from this post. I think the original question in this post is the same question I have.

I have already achieved the torizoncore-builder solution - see this post but I want to know how to do this in Yocto so I can compare the build results (eventually I will want to use an HSM with our own keys to sign the binaries - something I haven’t seen support for with torizoncore-builder)

In the original post you suggested 2 links the first one explains how to add a custom device tree. I don’t want to add a custom device tree or layer yet I just want to load (by default) one that is already being built. From meta-toradex-nxp/conf/machine/verdin-imx8mp.conf the KERNEL_DEVICETREE variable is including imx8mp-verdin-nonwifi-ivy.dtb which I can see is getting built as an artifact in deploy/images/verdin-imx8mp but it isn’t getting loaded by default when the board boots.

The second link is about enabling overlays which isn’t what I looking to accomplish right now.

I tried using the u-boot setenv ftdfile approach that was discussed in the original thread but didn’t have luck with this approach. I’m going to retry this just to see if I can reproduce it but ultimately I want to select the correct carrier board device tree in the yocto build.

Thanks for you help!

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


To configure the default device tree for the Ivy carrier board with Verdin iMX8M Plus in Yocto, you need to modify U-Boot to load the correct device tree file by default.

Solution: Modify U-Boot Configuration

Based on the documentation, you can create a U-Boot .bbappend file to set the default device tree. Here’s how to implement this approach(1):

1. Create U-Boot bbappend File

For NXP-based SoMs like the Verdin iMX8M Plus, create the following directory structure(1):

$ cd ../layers/meta-customer/
$ mkdir -p recipes-bsp/u-boot

(1)

2. Create the bbappend File

Create the U-Boot recipe append file(1):

touch recipes-bsp/u-boot/u-boot-toradex_%.bbappend

(1)

3. Configure the bbappend Content

The .bbappend file should contain the following configuration to set the default device tree(1):

do_configure:append() {
    # Remove exisiting fdtfile, if there is one
    sed -i '/"fdtfile=.*\\0" \\/d' ${S}/include/configs/verdin-imx8mp.h

    # Add new fdtfile, "my-custom-devicetree.dtb" should be replaced with your device tree binary file
    sed -i 's/\("fdt_board=.*\\0" \\\)/\0\n      "fdtfile=my-custom-devicetree.dtb\\0" \\/' ${S}/include/configs/verdin-imx8mp.h
}

(1)

4. Adapt for Your Use Case

In your case, replace my-custom-devicetree.dtb with imx8mp-verdin-nonwifi-ivy.dtb to load the Ivy carrier board device tree by default.

Alternative Approach: Machine Configuration

You can also create a machine-specific configuration file to ensure the correct device tree is built and included. Create a verdin-imx8mp-extra.conf file in your custom layer(1):

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

(1)

Then include this configuration in your layer’s conf/layer.conf file(1):

include conf/machine/verdin-imx8mp-extra.conf

(1)

This approach ensures that your specific device tree is built and available, while the U-Boot modification ensures it’s loaded by default.

Best regards, Toradex AI Assistant.

Hi @CGFE

You are right, I gave you the wrong link in the other post. The one that I think will help here is this.

Note that page is about adding a custom device tree but the bottom of that section shows how to patch the u-boot recipe to enable that tree as the default. That should be the only piece you need since the device tree you want already exists.

Hope that helps.