Verdin iMX8M-Plus custom DTB File (Yocto)

I’m using BSP 7.5.0

I am trying to use a custom device tree in my image. In Yocto I’ve made a custom machine based off the verdin-imx8mp.

MACHINE ?= "verdin-imx8mp-{my_board}"

I have a custom device tree imx8mp-verdin-wifi-{my_board}.dtb that gets compiled and placed in build/deploy/images/verdin-imx8mp-{my_board}/.

The only way I’ve been able to get my image to boot it by modifying u-boot-initial-env-sd to use my dtb.

conf/machine/verdin-imx8mp-{my_board}.conf:

require conf/machine/verdin-imx8mp.conf

MACHINEOVERRIDES =. "verdin-imx8mp:"

KMACHINE = "verdin-imx8mp"

# Set the base device tree that will be loaded at boot
KERNEL_DEVICETREE:append = " freescale/imx8mp-verdin-wifi-{my_board}.dtb"

linux-toradex_%.bbappend:

FILESEXTRAPATHS:prepend := "${THISDIR}/linux-toradex:"

CUSTOM_DEVICETREE = "imx8mp-verdin-wifi-{my_board}.dts"

SRC_URI += " \
    file://${CUSTOM_DEVICETREE} \
"

do_configure:append() {
    cp ${WORKDIR}/${CUSTOM_DEVICETREE} ${S}/arch/arm64/boot/dts/freescale/
}

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Based on the documentation, your approach for creating a custom device tree in Yocto is mostly correct, but there’s a more complete solution that includes proper U-Boot configuration(1).

Complete Custom Device Tree Setup

Your current setup is on the right track. Here’s the complete configuration based on Toradex documentation:

1. Machine Configuration

Your machine configuration looks correct(1):

require conf/machine/verdin-imx8mp.conf
MACHINEOVERRIDES =. "verdin-imx8mp:"
KMACHINE = "verdin-imx8mp"
KERNEL_DEVICETREE:append = " freescale/imx8mp-verdin-wifi-{my_board}.dtb"

2. Kernel Recipe (.bbappend)

Your kernel bbappend is also correct(1):

FILESEXTRAPATHS:prepend := "${THISDIR}/linux-toradex:"
CUSTOM_DEVICETREE = "imx8mp-verdin-wifi-{my_board}.dts"
SRC_URI += " file://${CUSTOM_DEVICETREE}"

do_configure:append() {
    cp ${WORKDIR}/${CUSTOM_DEVICETREE} ${S}/arch/arm64/boot/dts/freescale/
}

3. U-Boot Configuration (Missing Step)

The key missing piece is proper U-Boot configuration. Instead of manually modifying u-boot-initial-env-sd, you should create a U-Boot bbappend(1):

Create recipes-bsp/u-boot/u-boot-toradex_%.bbappend:

do_configure:append() {
    # Remove existing fdtfile, if there is one
    sed -i '/"fdtfile=.*\\0" \\/d' ${S}/include/configs/verdin-imx8mp.h
    # Add new fdtfile
    sed -i 's/\("fdt_board=.*\\0" \\\)/\0\n      "fdtfile=imx8mp-verdin-wifi-{my_board}.dtb\\0" \\/' ${S}/include/configs/verdin-imx8mp.h
}

4. Machine Extra Configuration

You should also include your machine configuration in your layer’s configuration. Add this line to the end of your conf/layer.conf file(1):

include conf/machine/verdin-imx8mp-{my_board}.conf

Why This Approach Works

This method ensures that(1):

  • Your custom device tree is compiled and included in the image
  • U-Boot is configured to load your custom device tree automatically
  • The system boots with your custom device tree without manual intervention

The documentation shows this exact pattern for customizing device trees in Yocto builds, making it the recommended approach for production systems.

Best regards, Toradex AI Assistant.


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

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Greetings @JosephG,

You marked the AI’s response as a solution. Just wanted to confirm, you have no other issues/questions related to this, correct?

Best Regards,
Jeremias

Hi @jeremias.tx ,

Yes adding the u-boot-toradex_%.bbappend solved my issue. I will add for anyone that sees this in the future, adding include conf/machine/verdin-imx8mp-{my_board}.conf to my layer.conf file broke the build. I removed that and the solution worked perfectly.

Thank you for clarifying and sharing your exact solution.

Best Regards,
Jeremias