Using a custom device tree on the Verdin

I followed the steps outlined in Custom meta layers, recipes and images in Yocto Project (hello-world examples) and it seems like there are some updates required to support the Verdin. Specifically, how u-boot is told about the new device tree needs to be updated.

The example in the web page is for the Colibri where u-boot include file has a definition for the FDT_FILE which gets replaced. For the Verdin, there is some other mechanism at play. Somewhere in the build system logs I found:

u-boot-initial-env-verdin-imx8mm-sd-2020.04-r0:6:preboot=setenv fdtfile imx8mm-verdin-${variant}-${fdt_board}.dtb

where the variant for me shows up as wifi and the fdt_board is defined in the u-boot include/configs/verdin-imx8mm.h file. I made my device tree conform to this naming convention (e.g., imx8mm-verdin-wifi-custom.dts) and updated my u-boot-toradex_%.bbappend to read:

    sed -i 's/fdt_board=dev/fdt_board=custom/' ${S}/include/configs/verdin-imx8mm.h

Of note here, the default u-boot ftd_board variable is set to dev, even when using the Dahlia. I may have been overlooking something here too, but it could be that using the tdx-reference-minimal-image build target will always use the dev carrier board.

Is there a better way to be doing this? If nothing else, this post can help others who are struggling with the same issues.

Welcome to my trip through Hell.

Greetings @mckay,

As you already noticed there’s indeed a preboot function that sets fdtfile.

Is there a better way to be doing this?

Right now more or less, yes. Another alternative would be to have a function that runs after preboot that overwrites fdtfile to another value before the boot to kernel occurs. But, you’d have to run this function on every boot since preboot is run every boot.

I may have been overlooking something here too, but it could be that using the tdx-reference-minimal-image build target will always use the dev carrier board.

This is correct, by default most of our default images target the dev/eval board for that module family. In most cases the dev/eval device tree is also suitable for other carrier boards. In your case the dev board device tree is usable despite your physical carrier board being the Dahlia. There are some cases however where you’d want to use the specific carrier board device tree.

Best Regards,
Jeremias