From e38438194282c02060374081514e5fd60221b67e Mon Sep 17 00:00:00 2001 From: Alice Domage Date: Wed, 2 Oct 2024 09:43:26 +0200 Subject: [PATCH] tool/run/image/uboot: provide dtb for FIT images Our new U-BOOT for the imx8mp_iot_gate complains about the size of the device tree being zero bytes. This is because it no longer provides the kernel boot arguments via ATAGS, but passes them via by injecting them in the flattened device tree.. This commit adds a minimal dtb file to the FIT image to satisfy U-BOOT. Issue #5354 --- tool/run/image/uboot | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tool/run/image/uboot b/tool/run/image/uboot index 8871bb759e..12f4cfef2d 100644 --- a/tool/run/image/uboot +++ b/tool/run/image/uboot @@ -36,6 +36,7 @@ proc image_uboot_gzip_opt { } { # Build U-boot bootloader specific uImage # proc run_image { } { + set dtc [installed_command dtc] set elf_img [file join [run_dir] boot [kernel_specific_binary image.elf]] @@ -67,8 +68,18 @@ proc run_image { } { if {[image_uboot_use_fit]} { # create image.itb set uboot_img [file join [run_dir] boot image.itb] + + # create dummy dtb for version of u-boot requiring it in the fit image + set fd [open [run_dir]/dummy.dts w] + puts $fd "/dts-v1/;\n / {};" + close $fd + exec $dtc [run_dir]/dummy.dts -o [run_dir]/dummy.dtb + exec mkimage -f auto -A $arch -O linux -T kernel -C $compress_type -a $load_addr \ - -e $entrypoint -d $bin_img$bin_ext $uboot_img + -e $entrypoint -b [run_dir]/dummy.dtb -d $bin_img$bin_ext $uboot_img + + # cleanup dummy files + file delete -force [run_dir]/dummy.dts [run_dir]/dummy.dtb } else { # create uImage set uboot_img [file join [run_dir] boot uImage]