All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] linux: Add support for vendor directory in BR2_LINUX_KERNEL_CUSTOM_DTS_PATH
@ 2024-07-10 15:29 Kory Maincent via buildroot
  2024-07-15 14:07 ` Arnout Vandecappelle via buildroot
  0 siblings, 1 reply; 5+ messages in thread
From: Kory Maincent via buildroot @ 2024-07-10 15:29 UTC (permalink / raw)
  To: buildroot; +Cc: Kory Maincent, thomas.petazzoni

Linux organizes devicetree files under vendor subdirectories for arm and
arm64 architectures, such as arch/<arch>/boot/dts/<vendor>/. The
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH was only copying devicetree files to
arch/<arch>/boot/dts/, which is incompatible with the vendor
subdirectory structure.

This patch adds support for using a directory in
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH that matches the vendor subdirectory name.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 linux/Config.in |  4 +++-
 linux/linux.mk  | 14 +++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/linux/Config.in b/linux/Config.in
index 34057a4893..6ca615cae3 100644
--- a/linux/Config.in
+++ b/linux/Config.in
@@ -423,7 +423,9 @@ config BR2_LINUX_KERNEL_CUSTOM_DTS_PATH
 	  Paths to out-of-tree Device Tree Source (.dts) and Device Tree
 	  Source Include (.dtsi) files, separated by spaces. These files
 	  will be copied to the kernel sources and the .dts files will
-	  be compiled from there.
+	  be compiled from there. You can also use a directory which
+	  name match the vendor name as in
+	  arch/<arch>/boot/dts/<vendor>/
 
 config BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME
 	bool "Keep the directory name of the Device Tree"
diff --git a/linux/linux.mk b/linux/linux.mk
index 16d9f19470..07d4ddf7f3 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -198,7 +198,15 @@ LINUX_DTS_NAME += $(call qstrip,$(BR2_LINUX_KERNEL_INTREE_DTS_NAME))
 # and .dtsi files in BR2_LINUX_KERNEL_CUSTOM_DTS_PATH. Both will be
 # copied to arch/<arch>/boot/dts, but only the .dts files will
 # actually be generated as .dtb.
-LINUX_DTS_NAME += $(basename $(filter %.dts,$(notdir $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH)))))
+# In case we are copying a vendor dts subdirectory as in
+# arch/<arch>/boot/dts/<vendor>/ we have to append the wildcard to the
+# folder to list the devicetree.
+LINUX_KERNEL_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH))
+ifneq ($(wildcard $(LINUX_KERNEL_CUSTOM_DTS_PATH)/.*),)
+LINUX_DTS_NAME += $(addprefix $(notdir $(LINUX_KERNEL_CUSTOM_DTS_PATH))/,$(basename $(filter %.dts,$(notdir $(wildcard $(LINUX_KERNEL_CUSTOM_DTS_PATH)/*)))))
+else
+LINUX_DTS_NAME += $(basename $(filter %.dts,$(notdir $(wildcard $(LINUX_KERNEL_CUSTOM_DTS_PATH)))))
+endif
 
 LINUX_DTBS = $(addsuffix .dtb,$(LINUX_DTS_NAME))
 
@@ -505,8 +513,8 @@ endif
 #   http://lists.busybox.net/pipermail/buildroot/2020-May/282727.html
 define LINUX_BUILD_CMDS
 	$(call KCONFIG_DISABLE_OPT,CONFIG_GCC_PLUGINS)
-	$(foreach dts,$(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH)), \
-		cp -f $(dts) $(LINUX_ARCH_PATH)/boot/dts/
+	$(foreach dts,$(LINUX_KERNEL_CUSTOM_DTS_PATH), \
+		cp -rf $(dts) $(LINUX_ARCH_PATH)/boot/dts/
 	)
 	$(LINUX_MAKE_ENV) $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) all
 	$(LINUX_MAKE_ENV) $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_TARGET_NAME)
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-20 14:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-10 15:29 [Buildroot] [PATCH] linux: Add support for vendor directory in BR2_LINUX_KERNEL_CUSTOM_DTS_PATH Kory Maincent via buildroot
2024-07-15 14:07 ` Arnout Vandecappelle via buildroot
2024-07-15 15:22   ` Brandon Maier via buildroot
2025-02-20 13:53     ` Matthew Weber
2025-02-20 14:10       ` Niklas Cassel via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.