Merge "Makefile: devicetree: Introduce support for out-of-tree dtbs"

This commit is contained in:
qctecmdr 2022-05-18 14:52:08 -07:00 committed by Gerrit - the friendly Code Review server
commit 74f608451c
2 changed files with 56 additions and 1 deletions

View File

@ -1149,6 +1149,61 @@ endif
$(Q)$(MAKE) $(hdr-inst)=$(hdr-prefix)include/uapi
$(Q)$(MAKE) $(hdr-inst)=$(hdr-prefix)arch/$(SRCARCH)/include/uapi
# ---------------------------------------------------------------------------
# Devicetree files
ifeq ($(KBUILD_EXTMOD),)
ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),)
dtstree := arch/$(SRCARCH)/boot/dts
endif
else # KBUILD_EXTMOD
# Devicetree source should live in $(KBUILD_EXTMOD)/arch/$(SRCARCH)/boot/dts/
# But it may live inside some other folder relative to KBUILD_EXTMOD, as specified
# by KBUILD_EXTMOD_DTS
KBUILD_EXTMOD_DTS = arch/$(SRCARCH)/boot/dts
ifneq ($(wildcard $(KBUILD_EXTMOD)/$(KBUILD_EXTMOD_DTS)/ $(srctree)/$(KBUILD_EXTMOD)/$(KBUILD_EXTMOD_DTS)/),)
dtstree := $(KBUILD_EXTMOD)/$(KBUILD_EXTMOD_DTS)
endif
endif
ifneq ($(dtstree),)
%.dtb: include/config/kernel.release scripts_dtc
$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
PHONY += dtbs dtbs_install dtbs_check
dtbs: include/config/kernel.release scripts_dtc
$(Q)$(MAKE) $(build)=$(dtstree)
ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
export CHECK_DTBS=y
dtbs: dt_binding_check
endif
dtbs_check: dtbs
dtbs_install:
$(Q)$(MAKE) $(dtbinst)=$(dtstree) dst=$(INSTALL_DTBS_PATH)
ifdef CONFIG_OF_EARLY_FLATTREE
all: dtbs
endif
endif
PHONY += scripts_dtc
scripts_dtc: scripts_basic
$(Q)$(MAKE) $(build)=scripts/dtc
ifneq ($(filter dt_binding_check, $(MAKECMDGOALS)),)
export CHECK_DT_BINDING=y
endif
PHONY += dt_binding_check
dt_binding_check: scripts_dtc
$(Q)$(MAKE) $(build)=Documentation/devicetree/bindings
ifeq ($(KBUILD_EXTMOD),)
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/
core-$(CONFIG_BLOCK) += block/

View File

@ -221,7 +221,7 @@ ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
# ANDROID: Allow DTC_INCLUDE to be set by the BUILD_CONFIG. This allows one to
# compile an out-of-tree device tree.
DTC_INCLUDE += $(srctree)/scripts/dtc/include-prefixes
DTC_INCLUDE += $(srctree)/scripts/dtc/include-prefixes $(KBUILD_DTC_INCLUDE)
dtc_cpp_flags = -Wp,-MMD,$(depfile).pre.tmp -nostdinc \
$(addprefix -I,$(DTC_INCLUDE)) \