[openwrt/openwrt] kernel-build.mk: add support for compiling only DTS

LEDE Commits lede-commits at lists.infradead.org
Sat Feb 10 04:30:10 PST 2024


ansuel pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/183c0d530de3480917dafcffc1e5223ecff27935

commit 183c0d530de3480917dafcffc1e5223ecff27935
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Thu Feb 8 00:49:27 2024 +0100

    kernel-build.mk: add support for compiling only DTS
    
    Add support for compiling DTS for the selected target. This can be
    useful for testing if the DTS correctly compile and doesn't produce any
    error.
    
    This adds a new make target. To compile only DTS use:
    
    make target/linux/dtb
    
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
    (cherry picked from commit c47532b1ea7f8459f05a223a71317a1461c6e750)
---
 include/image.mk        | 10 ++++++----
 include/kernel-build.mk |  4 ++++
 include/subdir.mk       |  3 +++
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index dc53fe8b25..97cde011ce 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -575,7 +575,7 @@ define Device/Build/dtb
   $(KDIR)/image-$(1).dtb: FORCE
 	$(call Image/BuildDTB,$(strip $(2))/$(strip $(3)).dts,$$@)
 
-  image_prepare: $(KDIR)/image-$(1).dtb
+  compile-dtb: $(KDIR)/image-$(1).dtb
   endif
 
 endef
@@ -586,7 +586,7 @@ define Device/Build/dtbo
   $(KDIR)/image-$(1).dtbo: FORCE
 	$(call Image/BuildDTBO,$(strip $(2))/$(strip $(3)).dtso,$$@)
 
-  image_prepare: $(KDIR)/image-$(1).dtbo
+  compile-dtb: $(KDIR)/image-$(1).dtbo
   endif
 
 endef
@@ -823,18 +823,20 @@ define BuildImage
   download:
   prepare:
   compile:
+  compile-dtb:
   clean:
   image_prepare:
 
   ifeq ($(IB),)
-    .PHONY: download prepare compile clean image_prepare kernel_prepare install install-images
+    .PHONY: download prepare compile compile-dtb clean image_prepare kernel_prepare install install-images
     compile:
 		$(call Build/Compile)
 
     clean:
 		$(call Build/Clean)
 
-    image_prepare: compile
+    compile-dtb:
+    image_prepare: compile compile-dtb
 		mkdir -p $(BIN_DIR) $(KDIR)/tmp
 		rm -rf $(BUILD_DIR)/json_info_files
 		$(call Image/Prepare)
diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 5b332258f8..435a2fecea 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -156,6 +156,10 @@ define BuildKernel
   compile: $(LINUX_DIR)/.modules
 	$(MAKE) -C image compile TARGET_BUILD=
 
+  dtb: $(STAMP_CONFIGURED)
+	$(_SINGLE)$(KERNEL_MAKE) scripts_dtc
+	$(MAKE) -C image compile-dtb TARGET_BUILD=
+
   oldconfig menuconfig nconfig xconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE
 	rm -f $(LINUX_DIR)/.config.prev
 	rm -f $(STAMP_CONFIGURED)
diff --git a/include/subdir.mk b/include/subdir.mk
index 95009f814e..b4edbf8b96 100644
--- a/include/subdir.mk
+++ b/include/subdir.mk
@@ -5,6 +5,9 @@
 ifeq ($(MAKECMDGOALS),prereq)
   SUBTARGETS:=prereq
   PREREQ_ONLY:=1
+# For target/linux related target add dtb to selectively compile dtbs
+else ifneq ($(filter target/linux/%,$(MAKECMDGOALS)),)
+  SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS) dtb
 else
   SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS)
 endif




More information about the lede-commits mailing list