linux: add support for device tree overlays

The linux kernel can build device tree overlays (.dtbo) itself. Add
support to build and copy them along with the actual device trees.
These can either be in-tree device tree overlays
(BR2_LINUX_KERNEL_INTREE_DTSO_NAMES) or they can be provided outside of
the kernel (BR2_LINUX_KERNEL_CUSTOM_DTS_PATH). In the latter case, the
overlay source files will be copied into the kernel tree first.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Michael Walle
2025-02-21 23:55:25 +01:00
committed by Julien Olivain
parent 66a0513e0e
commit 5472d93d1c
2 changed files with 16 additions and 5 deletions

View File

@@ -426,12 +426,20 @@ config BR2_LINUX_KERNEL_INTREE_DTS_NAME
the trailing .dts. You can provide a list of the trailing .dts. You can provide a list of
dts files to build, separated by spaces. dts files to build, separated by spaces.
config BR2_LINUX_KERNEL_INTREE_DTSO_NAMES
string "In-tree Device Tree Overlay file names"
help
Names of in-tree device tree overlay, without the trailing
.dtso which should be built and installed into the target
system, separated by spaces.
config BR2_LINUX_KERNEL_CUSTOM_DTS_PATH config BR2_LINUX_KERNEL_CUSTOM_DTS_PATH
string "Out-of-tree Device Tree Source file paths" string "Out-of-tree Device Tree Source file paths"
help help
Paths to out-of-tree Device Tree Source (.dts) and Device Tree Paths to out-of-tree Device Tree Source (.dts), Device Tree
Source Include (.dtsi) files, separated by spaces. These files Source Include (.dtsi) and Device Tree Overlay Source (.dtso)
will be copied to the kernel sources and the .dts files will 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.
config BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME config BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME

View File

@@ -203,14 +203,17 @@ endif
LINUX_VERSION_PROBED = `MAKEFLAGS='$(filter-out w,$(MAKEFLAGS))' $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease 2>/dev/null` LINUX_VERSION_PROBED = `MAKEFLAGS='$(filter-out w,$(MAKEFLAGS))' $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease 2>/dev/null`
LINUX_DTS_NAME += $(call qstrip,$(BR2_LINUX_KERNEL_INTREE_DTS_NAME)) LINUX_DTS_NAME += $(call qstrip,$(BR2_LINUX_KERNEL_INTREE_DTS_NAME))
LINUX_DTSO_NAMES += $(call qstrip,$(BR2_LINUX_KERNEL_INTREE_DTSO_NAMES))
# We keep only the .dts files, so that the user can specify both .dts # We keep only the .dts files, so that the user can specify both .dts
# and .dtsi files in BR2_LINUX_KERNEL_CUSTOM_DTS_PATH. Both will be # 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 # copied to arch/<arch>/boot/dts, but only the .dts files will
# actually be generated as .dtb. # actually be generated as .dtb.
LINUX_DTS_NAME += $(basename $(filter %.dts,$(notdir $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH))))) 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_DTBS = $(addsuffix .dtb,$(LINUX_DTS_NAME)) LINUX_DTBS = $(addsuffix .dtb,$(LINUX_DTS_NAME)) $(addsuffix .dtbo,$(LINUX_DTSO_NAMES))
ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y) ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
LINUX_IMAGE_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_NAME)) LINUX_IMAGE_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_NAME))