From 1b9133e66ab3a75e5b81ca6746a5fb9d608b800a Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 17 Jun 2021 00:36:38 +0300 Subject: kbuild: Support directory names in DTB destinations The kbuild.sh script strips the directory name from the DTB destination. This is correct when no destination is specified explicitly, as we want to strip the directory name of the source for arm64 platforms where DT sources are stored in per-vendor directories. However, in some cases, we want to store the DTB in a sub-directory. A common use case is Raspberry Pi platforms that store overlays in an overlays/ subdirectory. Make this possible by stripping the directory name only when the destination is implicit. Signed-off-by: Laurent Pinchart --- kbuild.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kbuild.sh b/kbuild.sh index c548718..3f20151 100755 --- a/kbuild.sh +++ b/kbuild.sh @@ -316,8 +316,15 @@ copy_dtbs() { for dtb in ${dtbs[@]} ; do local src=${dtb/:*/} local dst=${dtb/*:/} - dst=${dst/*\//} + # If a destination is explicitly specified, don't strip + # directory name. This can be used for instance to store .dtbo + # files in an overlays/ subdirectory. + if ! echo ${dtb} | grep -q ':' ; then + dst=$(basename $dst) + fi + + mkdir -p $(dirname $dest_dir/$dst) cp $output_dir/arch/${arch}/boot/dts/$src* $dest_dir/$dst done } -- cgit v1.2.3