All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 1/1] linux: make out-of-tree DTS work with newest kernels
@ 2024-12-17  9:55 Edgar Bonet
  2024-12-18 14:55 ` Romain Naour via buildroot
  0 siblings, 1 reply; 10+ messages in thread
From: Edgar Bonet @ 2024-12-17  9:55 UTC (permalink / raw)
  To: Buildroot development; +Cc: Michael Walle, Chris Packham, Sergey Matyukevich

Since Linux 6.12 (commit e7e2941300d2, "kbuild: split device tree build
rules into scripts/Makefile.dtbs"), the kernel build process does not
build the DTBs from the source files listed in
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH.[1] This is because it expects all the
DTS files to live in vendor-specific subdirectories of
arch/$ARCH/boot/dts/ , whereas Buildroot drops them in the top dts
directory.

Fulfilling this kernel expectation would require a new configuration
parameter for the name of the appropriate vendor subdirectory. It would
also require changing the relative paths to included .dtsi files.

Let's add instead a rule to the top dts/Makefile for each DTB we want to
build. This avoids breaking user's out-of-tree configurations.

[1] https://lists.buildroot.org/pipermail/buildroot/2024-October/765463.html

Reported-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
---
Changes v1 -> v2:
  - define a hook for LINUX_POST_PATCH_HOOKS and LINUX_POST_RSYNC_HOOKS
    instead of modifying LINUX_BUILD_CMDS
  - use $(patsubst %.dts,%.dtb,$(dts)) instead of $(dts:%.dts=%.dtb)
both changes suggested by Arnout Vandecappelle.

I ran the folowing build tests:

    # Test with an old kernel: v6.6.30
    make acmesystems_acqua_a5_512mb_defconfig
    make linux

    # Test with a new kernel: v6.12.5
    make linux-dirclean
    git cherry-pick 0938346cde  # bump Acqua's kernel to v6.12.5
    make acmesystems_acqua_a5_512mb_defconfig
    make linux

    # Test the OVERRIDE_SRCDIR case.
    make linux-dirclean
    git -C $HOME/src/linux checkout v6.12.5
    echo "LINUX_OVERRIDE_SRCDIR = $HOME/src/linux" > local.mk
    make acmesystems_acqua_a5_512mb_defconfig
    make linux

 linux/linux.mk | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/linux/linux.mk b/linux/linux.mk
index 1d3d8fffa6..eb509fd747 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -327,6 +327,17 @@ define LINUX_TRY_PATCH_TIMECONST
 endef
 LINUX_POST_PATCH_HOOKS += LINUX_TRY_PATCH_TIMECONST
 
+# Kernels 6.12+ won't compile the custom DTS files we drop into
+# arch/$ARCH/boot/dts unless we add specific rules to that directory's
+# Makefile.
+define LINUX_ADD_DTB_MAKE_RULES
+	$(foreach dts,$(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH)), \
+		echo "dtb-y += $(patsubst %.dts,%.dtb,$(notdir $(dts)))" >> $(LINUX_ARCH_PATH)/boot/dts/Makefile
+	)
+endef
+LINUX_POST_PATCH_HOOKS += LINUX_ADD_DTB_MAKE_RULES
+LINUX_POST_RSYNC_HOOKS += LINUX_ADD_DTB_MAKE_RULES
+
 LINUX_KERNEL_CUSTOM_LOGO_PATH = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_LOGO_PATH))
 ifneq ($(LINUX_KERNEL_CUSTOM_LOGO_PATH),)
 LINUX_DEPENDENCIES += host-imagemagick
-- 
2.34.1

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

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

end of thread, other threads:[~2025-02-04 18:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-17  9:55 [Buildroot] [PATCH v2 1/1] linux: make out-of-tree DTS work with newest kernels Edgar Bonet
2024-12-18 14:55 ` Romain Naour via buildroot
2024-12-24 12:22   ` Edgar Bonet
2025-01-28 13:33     ` Fiona Klute via buildroot
2025-01-29 10:10       ` Romain Naour via buildroot
2025-01-30 10:30         ` Niklas Cassel
2025-01-30 18:12           ` Romain Naour via buildroot
2025-02-03 15:48         ` Fiona Klute via buildroot
2025-02-04 14:47           ` Bryce Johnson
2025-02-04 18:27             ` Fiona Klute 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.