kernel-build.mk: add support for compiling only DTS
authorChristian Marangi <ansuelsmth@gmail.com>
Wed, 7 Feb 2024 23:49:27 +0000 (00:49 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Thu, 8 Feb 2024 18:57:28 +0000 (19:57 +0100)
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@gmail.com>
include/image.mk
include/kernel-build.mk
include/subdir.mk

index f5ab1d7953c5ae7a43b52c71388e550e1b14b726..4b6acbe1aad6ac707021d84e78ea1384967fa006 100644 (file)
@@ -582,7 +582,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
@@ -593,7 +593,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
@@ -841,18 +841,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)
index b9513ec41435fb732b22ab0cd63fc1ccc698b325..c42dae0049ba4f010c9833212074576f190afffe 100644 (file)
@@ -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)
index 95009f814e29d4cab4f74c51fd30342484f5f111..b4edbf8b96c784cd8a7ed78996bb1ff715ceb9d0 100644 (file)
@@ -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