Use FIT Image with Embedded Device Tree - Patch on Patch or Custom Patch?

Hey all,

I’m working with the BeagleV-Fire, which in the boot method from Microchip, mainly uses FIT images and boot scripts which have both the kernel and dtb included via configurations.

Yocto Wrynose is moving more towards multi-config FIT images too with security verification, which is the highly preferred path forward.

The standard Mender boot command patch integration mainly uses ${mender_boot_kernel_type} and ${fdt_addr_r} for loading kernels and device trees. This fails for me if I am using FIT images since I’m not using a separate device tree file or those addresses. I’ve seen FIT image calls for choosing the kernel boot type, just want to avoid using local dtb files.

Obviously, I can make a patch but I hesitate on making a patch on a patch since that seems like using integration on integrations.

A. What is the recommended and supported approach so I avoid using ${kernel_addr_r}, ${fdt_addr_r} and ${mender_dtb_name}, while just using ${mender_kernel_name} and ${scriptaddr} in U-Boot? Do I patch the patch output of env_mender.h?

Here are the lines of interest:

140-144 env_mender.h

# define MENDER_LOAD_KERNEL_AND_FDT                                     \
    "if test \"${fdt_addr_r}\" != \"\"; then "                          \
    "load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; " \
    "fi; "                                                              \
    "load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name}; "

Which using stock mender patches returns the following error:

Wrong Image Type for bootm command
ERROR -91: can't get kernel image!

My preferred approach is using a boot.scr that calls the mender logic as seen in RAUC and other upgrade engine solutions. I’ve also seen this in articles and forums as a boot method. Preferably, there’s lines in the Microchip boot.scr that prepare the kernel and fdt addresses using bootm. I have modified to include Mender environment variables.

For example:

run mender_setup;
load ${mender_uboot_root} ${scriptaddr} /boot/${mender_kernel_name};
${mender_boot_kernel_type} start ${scriptaddr};
${mender_boot_kernel_type} loados;
${mender_boot_kernel_type} ramdisk;
${mender_boot_kernel_type} prep;
${mender_boot_kernel_type} go;

B. Lastly, what is the benefit of using the Mender boot partition environment variable?

Based on my Mender understanding kernels are found in the root filesystem so calls to loading files to addresses should be found there. Are there instances seen where the boot partition can be used that aligns with Mender logic?