Skip to contentSkip to conversation

kernel-fitimage: fix build issue w/out dtb by name

PATCH New Denys Dmytriyenko 1 participant 1 message Jul 27, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel-fitimage: fix build issue w/out dtb by name

From: Gaël PORTAY <[email protected]>

When FITIMAGE_DTB_BY_NAME = "0", the following build issue happens.

Log data follows:
| DEBUG: Executing shell function do_assemble_fitimage
| none
| FIT description: U-Boot fitImage for xxx
| Created: Wed Jul 26 01:22:34 2017
| Image 0 (kernel@1)
| Description: Linux kernel
| Created: Wed Jul 26 01:22:34 2017
| Type: Kernel Image
| Compression: uncompressed
| Data Size: 3190040 Bytes = 3115.27 kB = 3.04 MB
| Architecture: ARM
| OS: Linux
| Load Address: 0x80008000
| Entry Point: 0x80008000
| Hash algo: sha1
| Hash value: ff0b619672c456d03ba0b75b4abcf3298ce14864
| Image 1 (fdt@1)
| Description: Flattened Device Tree blob
| Created: Wed Jul 26 01:22:34 2017
| Type: Flat Device Tree
| Compression: uncompressed
| Data Size: 38327 Bytes = 37.43 kB = 0.04 MB
| Architecture: ARM
| Hash algo: sha1
| Hash value: e396711bfbe8ef33f49358f763bebf6345e6a8be
| Image 2 (fdt@2)
| Description: Flattened Device Tree blob
| Created: Wed Jul 26 01:22:34 2017
| Type: Flat Device Tree
| Compression: uncompressed
| Data Size: 38088 Bytes = 37.20 kB = 0.04 MB
| Architecture: ARM
| Hash algo: sha1
| Hash value: f5b9f17f06e46542165a0940ada33d4cfca2e02e
| Image 3 (fdt@3)
| Description: Flattened Device Tree blob
| Created: Wed Jul 26 01:22:34 2017
| Type: Flat Device Tree
| Compression: uncompressed
| Data Size: 39726 Bytes = 38.79 kB = 0.04 MB
| Architecture: ARM
| Hash algo: sha1
| Hash value: 755d990706bfa9f203eeacbce0b9b732dfded621
| Default Configuration: 'conf@1'
| Configuration 0 (conf@1)
| Description: Linux kernel, FDT blob
| Kernel: kernel@1
| FDT: am335x-xxx.dtb
| Configuration 1 (conf@2)
| Description: Linux kernel, FDT blob
| Kernel: kernel@1
| FDT: am335x-xxx.dtb
| Configuration 2 (conf@3)
| Description: Linux kernel, FDT blob
| Kernel: kernel@1
| FDT: am335x-xxx.dtb
| uboot-mkimage Can't add hashes to FIT blob
| Failed to find image 'fdt' in configuration 'conf@1/signature@1'
| WARNING: /.../temp/run.do_assemble_fitimage.26832:1 exit 255 from 'uboot-mkimage -D "-I dts -O dtb -p 2000" -F -k "keys" -K "u-boot.dtb" -r arch/arm/boot/${2}' | ERROR: Function failed: do_assemble_fitimage (log file is located at .../temp/log.do_assemble_fitimage.26832)
ERROR: Task (.../meta-ti/recipes-kernel/linux/linux-ti-staging_4.9.bb:do_assemble_fitimage) failed with exit code '1'
NOTE: Tasks Summary: Attempted 635 tasks of which 634 didn't need to be rerun and 1 failed.

The configuration node is using the dtb file name (i.e. am335x-xxx.dtb) while the fdt node is named by its id (i.e. fdt@1).

	fdt@1 {
		description = "Flattened Device Tree blob";
		data = /incbin/("arch/arm/boot/dts/am335x-xxx.dtb.sec");
		type = "flat_dt";
		arch = "arm";
		compression = "none";
		...
	};

	...

	conf@1 {
		description = "Linux kernel, FDT blob";
		kernel = "kernel@1";
		fdt = "am335x-xxx.dtb";
		...
	};

This build issue has been introduced by the following commit.

f23f2876a0 kernel-fitimage, arago.conf: package OPTEE OS image files into FIT

The re-indentation has mis-replaced the fdt line in configuration node.

This patch re-uses the variable ${fdt_line}.

It also applies the fix to the commit following commit.

5edefbc694 (origin/master, origin/HEAD) kernel-fitimage: add support for packaging OPTEE pager images

Furthermore, the ${fdt_line} variable must to be set inside the for loop. Otherwise, the fdt property will be the same for each configurations.

---
 meta-arago-distro/classes/kernel-fitimage.bbclass | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
meta-arago-distro/classes/kernel-fitimage.bbclass +8 -4
index bca6f08..52399fe 100644
@@ -299,13 +299,11 @@ fitimage_emit_section_config() {
 
 	conf_desc="Linux kernel"
 	kernel_line="kernel = \"kernel@${2}\";"
-	fdt_line=""
 	ramdisk_line=""
 
 	# Test if we have any DTBs at all
 	if [ -n "${3}" ]; then
 		conf_desc="${conf_desc}, FDT blob"
-		fdt_line="fdt = \"${3}\";"
 	fi
 
 	if [ -n "${4}" ]; then
@@ -343,6 +341,12 @@ fitimage_emit_section_config() {
 			conf_name="conf@${dtbcount}"
 		fi
 
+		if [ "x${FITIMAGE_DTB_BY_NAME}" = "x1" ] ; then
+			fdt_line="fdt = \"${DTB}\";"
+		else
+			fdt_line="fdt = \"fdt@${dtbcount}\";"
+		fi
+
 		if [ "x${dtbcount}" = "x1" ]; then
 			cat << EOF >> ${1}
                 default = "${conf_name}";
@@ -354,7 +358,7 @@ EOF
                 ${conf_name} {
                         description = "${final_conf_desc}";
                         ${kernel_line}
-                        fdt = "${DTB}";
+                        ${fdt_line}
                         ${ramdisk_line}
                         ${setup_line}
                         ${loadables_line}
@@ -412,7 +416,7 @@ EOF
                 ${conf_name} {
                         description = "${final_conf_desc}";
                         ${kernel_line}
-                        fdt = "${DTB}";
+                        ${fdt_line}
                         ${ramdisk_line}
                         ${setup_line}
                         ${loadables_pager_line}
Signature · 1 line
2.7.4