Yocto / Torizon + Custom Kernel + Kernel Module + Network Mgmt + Apps [Architecture Help Neded]

Here’s the solution (for an iMX7 emmc based board, at least)
meta-customer/recipes-bsp/u-boot/u-boot-distro-boot.bbappend

do_install_prepend () {
    sed -e '/^otaroot=.*/a fdtfile=my-custom-devicetree-file.dtb' -i ${WORKDIR}/uEnv.txt.in
}

Here’s the solution (for an iMX7 emmc based board, at least)
meta-customer/recipes-bsp/u-boot/u-boot-distro-boot.bbappend

Oh I suppose that works as well. Just keep in mind you’re changing the uEnv.txt file rather than U-Boot. So if this file you’re modifying ever changes or we stop using it this solution will no longer work.

In general all you need to do is set the U-Boot environment variable fdtfile to whatever your device tree is.

The method I was showing you before changes the default value of this method in U-Boot.

I don’t see that line.

Also apologies I was looking at the file locally and I didn’t have an updated file from the repo. In the latest U-Boot code the default value of fdtfile is set here in the defconfig instead of the header file: colibri_imx7_emmc_defconfig « configs - u-boot-toradex.git - U-Boot bootloader for Apalis and Colibri modules

One issue I can see with the approach you’ve taken is that since you’re setting the value of fdtfile in uEnv.txt. This overrides anything you set in the U-Boot environment for this variable. Meaning you can’t just trivially change it anymore, which is fine for production but in development can be a bit annoying if you just want to quickly switch between 2 device trees. But I suppose this is up to you.

Best Regards,
Jeremias

OK, I’ll look at your method and get back to you.