diff mbox series

[v1,1/1] linux: add support for building device tree overlays

Message ID 20230517021510.3016394-1-christian@aperture.us
State New
Headers show
Series [v1,1/1] linux: add support for building device tree overlays | expand

Commit Message

Christian Stewart May 17, 2023, 2:15 a.m. UTC
Some kernels have device tree overlay files:

make arch/arm64/boot/dts/amlogic/overlays/odroidn2/i2c0.dtbo

Add an option to add these dtbo files to the LINUX_DTBS list.

BR2_LINUX_KERNEL_INTREE_DTS_OVERLAY_NAME="amlogic/overlays/odroidn2/i2c0"

Signed-off-by: Christian Stewart <christian@aperture.us>
---
 linux/Config.in | 19 +++++++++++++++++++
 linux/linux.mk  |  5 +++++
 2 files changed, 24 insertions(+)
diff mbox series

Patch

diff --git a/linux/Config.in b/linux/Config.in
index abb4bf922f..2b27781128 100644
--- a/linux/Config.in
+++ b/linux/Config.in
@@ -434,6 +434,25 @@  config BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT
 	  Choose this option to support Device Tree overlays
 	  on the target system.
 
+if BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT
+
+config BR2_LINUX_KERNEL_INTREE_DTS_OVERLAY_NAME
+	string "In-tree Device Tree Overlay Source file names"
+	help
+	  Name of in-tree device tree source file, without
+	  the trailing .dts. You can provide a list of
+	  dts overlay files to build, separated by spaces.
+
+config BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH
+	string "Out-of-tree Device Tree Overlay Source file paths"
+	help
+	  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 to dtb overlays (.dtbo).
+
+endif
+
 endif
 
 config BR2_LINUX_KERNEL_INSTALL_TARGET
diff --git a/linux/linux.mk b/linux/linux.mk
index cc36b5251d..4bea7d6449 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -198,6 +198,11 @@  LINUX_DTS_NAME += $(basename $(filter %.dts,$(notdir $(call qstrip,$(BR2_LINUX_K
 
 LINUX_DTBS = $(addsuffix .dtb,$(LINUX_DTS_NAME))
 
+LINUX_DTS_OVERLAY_NAME += $(call qstrip,$(BR2_LINUX_KERNEL_INTREE_DTS_OVERLAY_NAME))
+LINUX_DTS_OVERLAY_NAME += $(basename $(filter %.dts,$(notdir $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH)))))
+
+LINUX_DTBS += $(addsuffix .dtbo,$(LINUX_DTS_OVERLAY_NAME))
+
 ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
 LINUX_IMAGE_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_NAME))
 LINUX_TARGET_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))