diff mbox series

[RFC,1/2] kbuild: Add support to build overlays (%.dtbo)

Message ID 317735e32a8ec3db935a375584aa420fe89124cc.1609844956.git.viresh.kumar@linaro.org (mailing list archive)
State New, archived
Headers show
Series kbuild: Add support to build overlays (%.dtbo) | expand

Commit Message

Viresh Kumar Jan. 5, 2021, 11:24 a.m. UTC
Add support for building DT overlays (%.dtbo). The overlay's source file
will have the usual extension, i.e. .dts, though the blob will have
.dtbo extension to distinguish it from normal blobs.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 Makefile             |  4 ++--
 scripts/Makefile.lib | 12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 3d328b7ab200..54cdcdfea67b 100644
--- a/Makefile
+++ b/Makefile
@@ -1334,7 +1334,7 @@  endif
 
 ifneq ($(dtstree),)
 
-%.dtb: include/config/kernel.release scripts_dtc
+%.dtb %.dtbo: include/config/kernel.release scripts_dtc
 	$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
 
 PHONY += dtbs dtbs_install dtbs_check
@@ -1816,7 +1816,7 @@  clean: $(clean-dirs)
 	@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
 		\( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \
 		-o -name '*.ko.*' \
-		-o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
+		-o -name '*.dtb' -o -name '*.dtbo' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
 		-o -name '*.dwo' -o -name '*.lst' \
 		-o -name '*.su' -o -name '*.mod' \
 		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 213677a5ed33..f70d7bd3262a 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -82,11 +82,15 @@  always-y += $(userprogs-always-y) $(userprogs-always-m)
 # DTB
 # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
 extra-y				+= $(dtb-y)
+extra-y				+= $(dtbo-y)
 extra-$(CONFIG_OF_ALL_DTBS)	+= $(dtb-)
+extra-$(CONFIG_OF_ALL_DTBS)	+= $(dtbo-)
 
 ifneq ($(CHECK_DTBS),)
 extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
+extra-y += $(patsubst %.dtbo,%.dt.yaml, $(dtbo-y))
 extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
+extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtbo,%.dt.yaml, $(dtbo-))
 endif
 
 # Add subdir path
@@ -299,6 +303,11 @@  endif
 
 DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
 
+# enable creation of __symbols__ node
+ifneq ($(dtbo-y),)
+DTC_FLAGS += -@
+endif
+
 # Generate an assembly file to wrap the output of the device tree compiler
 quiet_cmd_dt_S_dtb= DTB     $@
 cmd_dt_S_dtb=						\
@@ -327,6 +336,9 @@  cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ;
 $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
 	$(call if_changed_dep,dtc)
 
+$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
+	$(call if_changed_dep,dtc)
+
 DT_CHECKER ?= dt-validate
 DT_BINDING_DIR := Documentation/devicetree/bindings
 # DT_TMP_SCHEMA may be overridden from Documentation/devicetree/bindings/Makefile