diff --git a/linux/Config.in b/linux/Config.in index d6a0ace6c0..ad9bb57439 100644 --- a/linux/Config.in +++ b/linux/Config.in @@ -435,6 +435,7 @@ config BR2_LINUX_KERNEL_INTREE_DTSO_NAMES config BR2_LINUX_KERNEL_CUSTOM_DTS_PATH string "Out-of-tree Device Tree Source file paths" + depends on BR2_LINUX_KERNEL_CUSTOM_DTS_DIR = "" help Paths to out-of-tree Device Tree Source (.dts), Device Tree Source Include (.dtsi) and Device Tree Overlay Source (.dtso) @@ -442,6 +443,34 @@ config BR2_LINUX_KERNEL_CUSTOM_DTS_PATH kernel sources and the .dts files will be compiled from there. + Due to a kernel build system changes in 6.12, + BR2_LINUX_KERNEL_CUSTOM_DTS_PATH is now deprecated and + replaced by BR2_LINUX_KERNEL_CUSTOM_DTS_DIR + +config BR2_LINUX_KERNEL_CUSTOM_DTS_DIR + string "Out-of-tree Device Tree Source overlay directories" + help + Specify a list of directories that are copied as-is over the + arch//boot/dts/ directory before building the device + tree blob. + + This overlay can contain dts, dtso and dtsi files. + + BR2_LINUX_KERNEL_CUSTOM_DTS_DIR should point to one or more + directories containing a vendor subdirectory (e.g. rockchip) + which contains the dts files. This vendor subdirectory should + match the vendor subdirectory used by the board in the kernel + (e.g. arch/arm64/boot/dts/rockchip/). + + While most architechtures make use of vendor subdirectories, + like arm, arm64 and riscv, some architectures like powerpc + and xtensa do not. + In this case, BR2_LINUX_KERNEL_CUSTOM_DTS_DIR should point to + a directory containing the dts files directly. + + Since the 6.12 release, each out-of-tree Device Tree Source + file must be copied into their corresponding sub-directory. + config BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME bool "Keep the directory name of the Device Tree" help diff --git a/linux/linux.mk b/linux/linux.mk index 9c621c18d5..f915823dcf 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -213,6 +213,22 @@ LINUX_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH)) LINUX_DTS_NAME += $(basename $(filter %.dts,$(notdir $(LINUX_CUSTOM_DTS_PATH)))) LINUX_DTSO_NAMES += $(basename $(filter %.dtso,$(notdir $(LINUX_CUSTOM_DTS_PATH)))) +LINUX_KERNEL_CUSTOM_DTS_DIR = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_DIR)) +ifneq ($(LINUX_KERNEL_CUSTOM_DTS_DIR),) +# Use evaluation-during-assignment using := to avoid any re-evaluation +# of LINUX_DTS_LIST when LINUX_DTS_NAME is used. +LINUX_DTS_LIST := $(shell find $(LINUX_KERNEL_CUSTOM_DTS_DIR) -name '*.dts' -printf '%P\n' 2>/dev/null) +LINUX_DTSO_LIST := $(shell find $(LINUX_KERNEL_CUSTOM_DTS_DIR) -name '*.dtso' -printf '%P\n' 2>/dev/null) +LINUX_DTS_NAME += $(basename $(LINUX_DTS_LIST)) +LINUX_DTSO_NAMES += $(basename $(LINUX_DTSO_LIST)) + +define LINUX_COPY_CUSTOM_DTS_FILES + $(foreach d, $(LINUX_KERNEL_CUSTOM_DTS_DIR), \ + @$(call MESSAGE,"Copying devicetree overlay $(d)")$(sep) \ + $(Q)$(call SYSTEM_RSYNC,$(d),$(LINUX_ARCH_PATH)/boot/dts/)$(sep)) +endef +endif + LINUX_DTBS = $(addsuffix .dtb,$(LINUX_DTS_NAME)) $(addsuffix .dtbo,$(LINUX_DTSO_NAMES)) ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y) @@ -527,6 +543,7 @@ define LINUX_BUILD_CMDS $(foreach dts,$(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH)), \ cp -f $(dts) $(LINUX_ARCH_PATH)/boot/dts/ ) + $(LINUX_COPY_CUSTOM_DTS_FILES) $(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)