From 43764c01cd8ed103fa6e15a61030e8005757f2d2 Mon Sep 17 00:00:00 2001
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: Mon, 20 Sep 2021 02:31:43 +0300
Subject: kbuild: Allow adding out-of-tree DTBs to image

It's useful to build a FIT image with DTBs stored outside of the kernel
tree, for instance to test vendor-supplied DTBs. Support this by
allowing DTB paths to be absolute. Compilation of the DTB is skipped in
that case.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 images/FIT.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'images')

diff --git a/images/FIT.sh b/images/FIT.sh
index 006baaf..46fe2ea 100644
--- a/images/FIT.sh
+++ b/images/FIT.sh
@@ -51,8 +51,6 @@ EOF
 	for dtb in ${dtbs[@]} ${dt_overlays[@]} ; do
 		local src=${dtb/:*/}
 		local dst=${dtb/*:/}
-		dst=${dst/*\//}
-
 		local load=
 
 		if [ ! -z $fdtaddr ] ; then
@@ -60,10 +58,15 @@ EOF
 			addr=$(($addr+0x40000))
 		fi
 
+		if [[ ${src} != /* ]] ; then
+			src="$output_dir/arch/$arch/boot/dts/$src"
+		fi
+
+		dst=${dst/*\//}
 		cat <<EOF >> $kernel_its
 		fdt-$dst {
 			description = "Flattened Device Tree blob $dst";
-			data = /incbin/("$output_dir/arch/$arch/boot/dts/$src");
+			data = /incbin/("$src");
 			type = "flat_dt";
 			arch = "$arch";
 			compression = "none";
-- 
cgit v1.2.3