@@ -440,6 +440,30 @@ config BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT
Choose this option to support Device Tree overlays
on the target system.
+config BR2_LINUX_KERNEL_INTREE_DTS_OVERLAY_NAMES
+ string "In-tree Device Tree Source Overlay file names"
+ depends on BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT
+ help
+ Name of in-tree device tree source file, without
+ the trailing .dts. You can provide a list of
+ dts files to build, separated by spaces.
+
+config BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH
+ string "Out-of-tree Device Tree Source Overlay file paths"
+ help
+ Paths to out-of-tree Device Tree Source Overlay (.dtso)
+ and Device Tree Source Include (.dtsi) files, separated by
+ spaces. These files will be copied to the kernel sources and
+ the .dtso files will be compiled from there.
+
+config BR2_LINUX_KERNEL_DTBO_KEEP_DIRNAME
+ bool "Keep the directory name of the Device Tree Overlay"
+ depends on BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT
+ help
+ If enabled, the device tree blob overlays keep their
+ directory prefixes when they get copied to the
+ output image directory or the target directory.
+
endif
config BR2_LINUX_KERNEL_INSTALL_TARGET
@@ -202,6 +202,18 @@ LINUX_DTS_NAME += $(basename $(filter %.dts,$(notdir $(call qstrip,$(BR2_LINUX_K
LINUX_DTBS = $(addsuffix .dtb,$(LINUX_DTS_NAME))
+ifeq ($(BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT),y)
+LINUX_DTS_OVERLAY_NAMES += $(call qstrip,$(BR2_LINUX_KERNEL_INTREE_DTS_OVERLAY_NAMES))
+
+# We keep only the .dtso files, so that the user can specify both .dtso
+# and .dtsi files in BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH. Both will be
+# copied to arch/<arch>/boot/dts, but only the .dtso files will
+# actually be generated as .dtbo.
+LINUX_DTS_OVERLAY_NAMES += $(basename $(filter %.dtso,$(notdir $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH)))))
+
+LINUX_DTBOS = $(addsuffix .dtbo,$(LINUX_DTS_OVERLAY_NAMES))
+endif
+
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))
@@ -462,10 +474,26 @@ define LINUX_INSTALL_DTB
$(1)/$(if $(BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME),$(dtb),$(notdir $(dtb)))
)
endef
+define LINUX_BUILD_DTBO
+ $(LINUX_MAKE_ENV) $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_DTBOS)
+endef
+define LINUX_INSTALL_DTBO
+ $(foreach dtbo,$(LINUX_DTBOS), \
+ install -D \
+ $(wildcard $(LINUX_ARCH_PATH)/boot/dts/$(dtbo)) \
+ $(1)/$(if $(BR2_LINUX_KERNEL_DTBO_KEEP_DIRNAME),$(dtbo),$(notdir $(dtbo)))
+ )
+endef
endif # BR2_LINUX_KERNEL_APPENDED_DTB
endif # BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT
endif # BR2_LINUX_KERNEL_DTS_SUPPORT
+ifeq ($(BR2_LINUX_KERNEL_DTS_OVERLAY_SUPPORT),y)
+define LINUX_BUILD_DTBO
+ $(LINUX_MAKE_ENV) $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_DTBOS)
+endef
+endif # BR2_LINUX_KERNEL_DTS_OVERLAY_SUPPORT
+
ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
# dtbs moved from arch/$ARCH/boot to arch/$ARCH/boot/dts since 3.8-rc1
define LINUX_APPEND_DTB
@@ -508,10 +536,14 @@ define LINUX_BUILD_CMDS
$(foreach dts,$(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH)), \
cp -f $(dts) $(LINUX_ARCH_PATH)/boot/dts/
)
+ $(foreach dtso,$(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH)), \
+ cp -f $(dtso) $(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)
$(LINUX_BUILD_DTB)
$(LINUX_APPEND_DTB)
+ $(LINUX_BUILD_DTBO)
endef
ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
@@ -533,6 +565,7 @@ ifeq ($(BR2_LINUX_KERNEL_INSTALL_TARGET),y)
define LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET
$(call LINUX_INSTALL_IMAGE,$(TARGET_DIR)/boot)
$(call LINUX_INSTALL_DTB,$(TARGET_DIR)/boot)
+ $(call LINUX_INSTALL_DTBO,$(TARGET_DIR)/boot)
endef
endif
@@ -547,6 +580,7 @@ endef
define LINUX_INSTALL_IMAGES_CMDS
$(call LINUX_INSTALL_IMAGE,$(BINARIES_DIR))
$(call LINUX_INSTALL_DTB,$(BINARIES_DIR))
+ $(call LINUX_INSTALL_DTBO,$(BINARIES_DIR))
endef
ifeq ($(BR2_STRIP_strip),y)
The device-tree blob overlay is an upstream feature; one can build a .dtbo from .dtso thanks to commit 363547d2191c (kbuild: Allow DTB overlays to built from .dtso named source files)[1] (linux-6.1-rc2). This introduces the three new dtbo configs to build in-tree or out-of-tree dtbos, and to keep the directory name. The three configs are the equivalent to existing dts configs: - BR2_LINUX_KERNEL_INTREE_DTS_OVERLAY_NAMES is equivalent to BR2_LINUX_KERNEL_INTREE_DTS_NAME (it takes in-tree files relative to dts directory, without file extention: i.e. without .dts) - BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH is equivalent to BR2_LINUX_KERNEL_CUSTOM_DTS_PATH (it takes out-of-tree files relative to buildroot directory, with file extention .dtso) - BR2_LINUX_KERNEL_DTBO_KEEP_DIRNAME is equivalent to BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME [1]: https://github.com/torvalds/linux/commit/363547d2191cbc32ca954ba75d72908712398ff2 Signed-off-by: Gaël PORTAY <gael.portay@rtone.fr> --- linux/Config.in | 24 ++++++++++++++++++++++++ linux/linux.mk | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+)