Hi Olli On Fri, 2022-02-11 at 08:13 +0000, Westermann, Oliver wrote:
[snip] > My current setup uses bootm ${loadaddr}#${fit_config} which works fine, > fit_config containing a configuration > node name. When calling bootm ${loadaddr}#${fit_config}#bar to apply the bar > overlay to ${fit_config}, I get > the "Overlayed FDT requires relocation" error from boot/image-fit.c#L2341 out > of function boot_get_fdt_fit(). > > I might be doing something wrong, but I did some classic printf debugging to > understand the codepath leading > up to this location. I could not find any code that would copy the dtb > contained in my configuration out of > the fit image, which means the check in L2339 should always trigger. I'm > wondering if there is some "copy dtb > out of FIT" step in overlay-fdt-boot.txt which I'm not seeing, but I feel > like I triple checked that document > by now ;-) So for me the base dtb sits in the FIT and u-boot declines to > apply an overlay. The check itself > makes sense to me as we can't check if there is sufficent padding beyond the > base-dtb to prevent growing it > into the next blob. I am not sure whether I fully understand the issue(s) you are having. I only know that we are using a similar technique to actually boot our Toradex Easy Installer. Anyway, I hope you find this helpful. We do use a script there to get this going. Let me just post the (hopefully) relevant excerpts: env set fdtfile ${fdt_prefix}imx8mp-verdin-wifi-dev.dtb env set ramdisk_addr_r 0x47400000 # Re-enable fdt relocation since in place fdt edits corrupt the ramdisk # in a FIT image... env set fdt_high env set fdt_resize true env set fitconf_fdt_overlays env set set_default_overlays 'env set fdt_overlays "verdin-imx8mp_native-hdmi_overlay.dtbo verdin- imx8mp_lt8912_overlay.dtbo"' env set set_load_overlays_file 'env set load_overlays_file "env import -t 0x42e10000 0x200"' env set set_apply_overlays 'env set apply_overlays "for overlay_file in \"\\${fdt_overlays}\"; do env set fitconf_fdt_overlays \"\\"\\${fitconf_fdt_overlays}#config@\\${overlay_file}\\"\"; env set overlay_file; done; true"' env set bootcmd_run 'echo "Bootargs: \${bootargs}" && bootm ${ramdisk_addr_r}#config@freescale_\${fdtfile}\${fitconf_fdt_overlays}' run set_load_overlays_file run set_apply_overlays run load_overlays_file run apply_overlays run bootcmd And that is how that whole thing then looks upon boot: ## Executing script at 42e00000 Bootargs: quiet drm.edid_firmware=edid/1280x720.bin video=HDMI-A-1:1280x720-16@6 0D video=HDMI-A-2:1280x720-16@60D initcall_blacklist=vpu_driver_init rootfstype= squashfs root=/dev/ram autoinstall clk_ignore_unused pci=nomsi ## Loading kernel from FIT Image at 47400000 ... Using 'config@freescale_imx8mp-verdin-wifi-dev.dtb' configuration Trying 'kernel@1' kernel subimage Description: Linux kernel Type: Kernel Image Compression: gzip compressed Data Start: 0x47400108 Data Size: 10389245 Bytes = 9.9 MiB Architecture: AArch64 OS: Linux Load Address: 0x40000000 Entry Point: 0x40000000 Hash algo: sha1 Hash value: 039972cffe32d2806cff06f64707f56ecb214806 Verifying Hash Integrity ... sha1+ OK ## Loading ramdisk from FIT Image at 47400000 ... Using 'config@freescale_imx8mp-verdin-wifi-dev.dtb' configuration Trying 'ramdisk@1' ramdisk subimage Description: tezi-initramfs Type: RAMDisk Image Compression: uncompressed Data Start: 0x47e440ec Data Size: 35405824 Bytes = 33.8 MiB Architecture: AArch64 OS: Linux Load Address: 0x60000000 Entry Point: unavailable Hash algo: sha1 Hash value: d6acbdc4dbce430542b0ebc98cf78c8f1596fb6e Verifying Hash Integrity ... sha1+ OK Loading ramdisk from 0x47e440ec to 0x60000000 ## Loading fdt from FIT Image at 47400000 ... Using 'config@freescale_imx8mp-verdin-wifi-dev.dtb' configuration Trying 'fdt@freescale_imx8mp-verdin-wifi-dev.dtb' fdt subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x47e27800 Data Size: 86327 Bytes = 84.3 KiB Architecture: AArch64 Load Address: 0x44000000 Hash algo: sha1 Hash value: f0830ff873080ac797feaea43bcff0c365abfc37 Verifying Hash Integrity ... sha1+ OK Loading fdt from 0x47e27800 to 0x44000000 ## Loading fdt from FIT Image at 47400000 ... Using 'config@verdin-imx8mp_native-hdmi_overlay.dtbo' configuration Trying 'fdt@verdin-imx8mp_native-hdmi_overlay.dtbo' fdt subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x47e41e44 Data Size: 1860 Bytes = 1.8 KiB Architecture: AArch64 Load Address: 0x46000000 Hash algo: sha1 Hash value: e012dc61089de5a93eecd9cf4b0bb3b6cb58bec6 Verifying Hash Integrity ... sha1+ OK Loading fdt from 0x47e41e44 to 0x46000000 ## Loading fdt from FIT Image at 47400000 ... Using 'config@verdin-imx8mp_lt8912_overlay.dtbo' configuration Trying 'fdt@verdin-imx8mp_lt8912_overlay.dtbo' fdt subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x47e3ea40 Data Size: 1987 Bytes = 1.9 KiB Architecture: AArch64 Load Address: 0x46000000 Hash algo: sha1 Hash value: 5a8add06641fe0b39df350cb658d54d295d69a3a Verifying Hash Integrity ... sha1+ OK Loading fdt from 0x47e3ea40 to 0x46000000 Booting using the fdt blob at 0x44000000 Uncompressing Kernel Image Loading Device Tree to 00000000fdbdd000, end 00000000fdbf5245 ... OK Starting kernel ... > > U-Boot relocates itself to the top of memory. The available memory is > > shown by command bdinfo. > > > > Run 'printenv' to see which other memory addresses are defined. > > Thanks, I will check that for my testing, though I'm still wondering what I'm > doing wrong. I hope that gives you some ideas how to overcome your struggle. Good luck! > Best regards, Olli Cheers Marcel