Reapply "kbuild: split device tree build rules into scripts/Makefile.dtbs"
This reverts commit 245273f9bf.
Reason of revert: rockpi is fixed in changes in the same topic.
Bug: 371628764
Change-Id: I8ace1428d89bd02c861bf9ebb0242cde8bd5441a
Signed-off-by: HONG Yifan <elsk@google.com>
This commit is contained in:
+1
-1
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* __dtb_empty_root_begin[] and __dtb_empty_root_end[] magically created by
|
* __dtb_empty_root_begin[] and __dtb_empty_root_end[] magically created by
|
||||||
* cmd_dt_S_dtb in scripts/Makefile.lib
|
* cmd_wrap_S_dtb in scripts/Makefile.dtbs
|
||||||
*/
|
*/
|
||||||
extern uint8_t __dtb_empty_root_begin[];
|
extern uint8_t __dtb_empty_root_begin[];
|
||||||
extern uint8_t __dtb_empty_root_end[];
|
extern uint8_t __dtb_empty_root_end[];
|
||||||
|
|||||||
@@ -1861,7 +1861,7 @@ static int __init unittest_data_add(void)
|
|||||||
struct device_node *unittest_data_node = NULL, *np;
|
struct device_node *unittest_data_node = NULL, *np;
|
||||||
/*
|
/*
|
||||||
* __dtbo_testcases_begin[] and __dtbo_testcases_end[] are magically
|
* __dtbo_testcases_begin[] and __dtbo_testcases_end[] are magically
|
||||||
* created by cmd_dt_S_dtbo in scripts/Makefile.lib
|
* created by cmd_wrap_S_dtbo in scripts/Makefile.dtbs
|
||||||
*/
|
*/
|
||||||
extern uint8_t __dtbo_testcases_begin[];
|
extern uint8_t __dtbo_testcases_begin[];
|
||||||
extern uint8_t __dtbo_testcases_end[];
|
extern uint8_t __dtbo_testcases_end[];
|
||||||
@@ -3525,7 +3525,7 @@ out_skip_tests:
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* __dtbo_##overlay_name##_begin[] and __dtbo_##overlay_name##_end[] are
|
* __dtbo_##overlay_name##_begin[] and __dtbo_##overlay_name##_end[] are
|
||||||
* created by cmd_dt_S_dtbo in scripts/Makefile.lib
|
* created by cmd_wrap_S_dtbo in scripts/Makefile.dtbs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define OVERLAY_INFO_EXTERN(overlay_name) \
|
#define OVERLAY_INFO_EXTERN(overlay_name) \
|
||||||
|
|||||||
+8
-17
@@ -57,7 +57,6 @@ endif
|
|||||||
# subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...)
|
# subdir-builtin and subdir-modorder may contain duplications. Use $(sort ...)
|
||||||
subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y)))
|
subdir-builtin := $(sort $(filter %/built-in.a, $(real-obj-y)))
|
||||||
subdir-modorder := $(sort $(filter %/modules.order, $(obj-m)))
|
subdir-modorder := $(sort $(filter %/modules.order, $(obj-m)))
|
||||||
subdir-dtbslist := $(sort $(filter %/dtbs-list, $(dtb-y)))
|
|
||||||
|
|
||||||
targets-for-builtin := $(extra-y)
|
targets-for-builtin := $(extra-y)
|
||||||
|
|
||||||
@@ -354,7 +353,7 @@ $(obj)/%.o: $(obj)/%.S FORCE
|
|||||||
|
|
||||||
targets += $(filter-out $(subdir-builtin), $(real-obj-y))
|
targets += $(filter-out $(subdir-builtin), $(real-obj-y))
|
||||||
targets += $(filter-out $(subdir-modorder), $(real-obj-m))
|
targets += $(filter-out $(subdir-modorder), $(real-obj-m))
|
||||||
targets += $(real-dtb-y) $(lib-y) $(always-y)
|
targets += $(lib-y) $(always-y)
|
||||||
|
|
||||||
# Linker scripts preprocessor (.lds.S -> .lds)
|
# Linker scripts preprocessor (.lds.S -> .lds)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -380,7 +379,6 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
|
|||||||
# To build objects in subdirs, we need to descend into the directories
|
# To build objects in subdirs, we need to descend into the directories
|
||||||
$(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ;
|
$(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ;
|
||||||
$(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
|
$(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
|
||||||
$(subdir-dtbslist): $(obj)/%/dtbs-list: $(obj)/% ;
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Rule to compile a set of .o files into one .a file (without symbol table)
|
# Rule to compile a set of .o files into one .a file (without symbol table)
|
||||||
@@ -396,12 +394,8 @@ quiet_cmd_ar_builtin = AR $@
|
|||||||
$(obj)/built-in.a: $(real-obj-y) FORCE
|
$(obj)/built-in.a: $(real-obj-y) FORCE
|
||||||
$(call if_changed,ar_builtin)
|
$(call if_changed,ar_builtin)
|
||||||
|
|
||||||
#
|
# This is a list of build artifacts from the current Makefile and its
|
||||||
# Rule to create modules.order and dtbs-list
|
# sub-directories. The timestamp should be updated when any of the member files.
|
||||||
#
|
|
||||||
# This is a list of build artifacts (module or dtb) from the current Makefile
|
|
||||||
# and its sub-directories. The timestamp should be updated when any of the
|
|
||||||
# member files.
|
|
||||||
|
|
||||||
cmd_gen_order = { $(foreach m, $(real-prereqs), \
|
cmd_gen_order = { $(foreach m, $(real-prereqs), \
|
||||||
$(if $(filter %/$(notdir $@), $m), cat $m, echo $m);) :; } \
|
$(if $(filter %/$(notdir $@), $m), cat $m, echo $m);) :; } \
|
||||||
@@ -410,9 +404,6 @@ cmd_gen_order = { $(foreach m, $(real-prereqs), \
|
|||||||
$(obj)/modules.order: $(obj-m) FORCE
|
$(obj)/modules.order: $(obj-m) FORCE
|
||||||
$(call if_changed,gen_order)
|
$(call if_changed,gen_order)
|
||||||
|
|
||||||
$(obj)/dtbs-list: $(dtb-y) FORCE
|
|
||||||
$(call if_changed,gen_order)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Rule to compile a set of .o files into one .a file (with symbol table)
|
# Rule to compile a set of .o files into one .a file (with symbol table)
|
||||||
#
|
#
|
||||||
@@ -441,11 +432,7 @@ intermediate_targets = $(foreach sfx, $(2), \
|
|||||||
$(patsubst %$(strip $(1)),%$(sfx), \
|
$(patsubst %$(strip $(1)),%$(sfx), \
|
||||||
$(filter %$(strip $(1)), $(targets))))
|
$(filter %$(strip $(1)), $(targets))))
|
||||||
# %.asn1.o <- %.asn1.[ch] <- %.asn1
|
# %.asn1.o <- %.asn1.[ch] <- %.asn1
|
||||||
# %.dtb.o <- %.dtb.S <- %.dtb <- %.dts
|
targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h)
|
||||||
# %.dtbo.o <- %.dtbo.S <- %.dtbo <- %.dtso
|
|
||||||
targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \
|
|
||||||
$(call intermediate_targets, .dtb.o, .dtb.S .dtb) \
|
|
||||||
$(call intermediate_targets, .dtbo.o, .dtbo.S .dtbo)
|
|
||||||
|
|
||||||
# Include additional build rules when necessary
|
# Include additional build rules when necessary
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -462,6 +449,10 @@ ifneq ($(userprogs),)
|
|||||||
include $(srctree)/scripts/Makefile.userprogs
|
include $(srctree)/scripts/Makefile.userprogs
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(need-dtbslist)$(dtb-y)$(dtb-)$(filter %.dtb %.dtb.o %.dtbo.o,$(targets)),)
|
||||||
|
include $(srctree)/scripts/Makefile.dtbs
|
||||||
|
endif
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
|
||||||
|
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
|
||||||
|
dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
|
||||||
|
|
||||||
|
# Composite DTB (i.e. DTB constructed by overlay)
|
||||||
|
multi-dtb-y := $(call multi-search, $(dtb-y), .dtb, -dtbs)
|
||||||
|
# Primitive DTB compiled from *.dts
|
||||||
|
real-dtb-y := $(call real-search, $(dtb-y), .dtb, -dtbs)
|
||||||
|
# Base DTB that overlay is applied onto
|
||||||
|
base-dtb-y := $(filter %.dtb, $(call real-search, $(multi-dtb-y), .dtb, -dtbs))
|
||||||
|
|
||||||
|
dtb-y := $(addprefix $(obj)/, $(dtb-y))
|
||||||
|
multi-dtb-y := $(addprefix $(obj)/, $(multi-dtb-y))
|
||||||
|
real-dtb-y := $(addprefix $(obj)/, $(real-dtb-y))
|
||||||
|
|
||||||
|
always-y += $(dtb-y)
|
||||||
|
targets += $(real-dtb-y)
|
||||||
|
|
||||||
|
# dtbs-list
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
ifdef need-dtbslist
|
||||||
|
subdir-dtbslist := $(addsuffix /dtbs-list, $(subdir-ym))
|
||||||
|
dtb-y += $(subdir-dtbslist)
|
||||||
|
always-y += $(obj)/dtbs-list
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(subdir-dtbslist): $(obj)/%/dtbs-list: $(obj)/% ;
|
||||||
|
|
||||||
|
$(obj)/dtbs-list: $(dtb-y) FORCE
|
||||||
|
$(call if_changed,gen_order)
|
||||||
|
|
||||||
|
# Assembly file to wrap dtb(o)
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Generate an assembly file to wrap the output of the device tree compiler
|
||||||
|
quiet_cmd_wrap_S_dtb = WRAP $@
|
||||||
|
cmd_wrap_S_dtb = { \
|
||||||
|
symbase=__$(patsubst .%,%,$(suffix $<))_$(subst -,_,$(notdir $*)); \
|
||||||
|
echo '\#include <asm-generic/vmlinux.lds.h>'; \
|
||||||
|
echo '.section .dtb.init.rodata,"a"'; \
|
||||||
|
echo '.balign STRUCT_ALIGNMENT'; \
|
||||||
|
echo ".global $${symbase}_begin"; \
|
||||||
|
echo "$${symbase}_begin:"; \
|
||||||
|
echo '.incbin "$<" '; \
|
||||||
|
echo ".global $${symbase}_end"; \
|
||||||
|
echo "$${symbase}_end:"; \
|
||||||
|
echo '.balign STRUCT_ALIGNMENT'; \
|
||||||
|
} > $@
|
||||||
|
|
||||||
|
$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
|
||||||
|
$(call if_changed,wrap_S_dtb)
|
||||||
|
|
||||||
|
$(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE
|
||||||
|
$(call if_changed,wrap_S_dtb)
|
||||||
|
|
||||||
|
# Schema check
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
ifneq ($(CHECK_DTBS),)
|
||||||
|
DT_CHECKER ?= dt-validate
|
||||||
|
DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
|
||||||
|
DT_BINDING_DIR := Documentation/devicetree/bindings
|
||||||
|
DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
|
||||||
|
dtb-check-enabled = $(if $(filter %.dtb, $@),y)
|
||||||
|
endif
|
||||||
|
|
||||||
|
quiet_dtb_check_tag = $(if $(dtb-check-enabled),[C], )
|
||||||
|
cmd_dtb_check = $(if $(dtb-check-enabled),; $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true)
|
||||||
|
|
||||||
|
# Overlay
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# NOTE:
|
||||||
|
# Do not replace $(filter %.dtb %.dtbo, $^) with $(real-prereqs). When a single
|
||||||
|
# DTB is turned into a multi-blob DTB, $^ will contain header file dependencies
|
||||||
|
# recorded in the .*.cmd file.
|
||||||
|
quiet_cmd_fdtoverlay = OVL $(quiet_dtb_check_tag) $@
|
||||||
|
cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(filter %.dtb %.dtbo, $^) $(cmd_dtb_check)
|
||||||
|
|
||||||
|
$(multi-dtb-y): $(DT_TMP_SCHEMA) FORCE
|
||||||
|
$(call if_changed,fdtoverlay)
|
||||||
|
$(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
|
||||||
|
|
||||||
|
# DTC
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
DTC ?= $(objtree)/scripts/dtc/dtc
|
||||||
|
DTC_FLAGS += -Wno-unique_unit_address
|
||||||
|
|
||||||
|
# Disable noisy checks by default
|
||||||
|
ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
|
||||||
|
DTC_FLAGS += -Wno-unit_address_vs_reg \
|
||||||
|
-Wno-avoid_unnecessary_addr_size \
|
||||||
|
-Wno-alias_paths \
|
||||||
|
-Wno-graph_child_address \
|
||||||
|
-Wno-simple_bus_reg
|
||||||
|
else
|
||||||
|
DTC_FLAGS += -Wunique_unit_address_if_enabled
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN)),)
|
||||||
|
DTC_FLAGS += -Wnode_name_chars_strict \
|
||||||
|
-Wproperty_name_chars_strict \
|
||||||
|
-Wunique_unit_address
|
||||||
|
endif
|
||||||
|
|
||||||
|
DTC_FLAGS += $(DTC_FLAGS_$(target-stem))
|
||||||
|
|
||||||
|
# Set -@ if the target is a base DTB that overlay is applied onto
|
||||||
|
DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
|
||||||
|
|
||||||
|
# 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_cpp_flags = -Wp,-MMD,$(depfile).pre.tmp -nostdinc $(addprefix -I,$(DTC_INCLUDE)) -undef -D__DTS__
|
||||||
|
|
||||||
|
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
|
||||||
|
|
||||||
|
quiet_cmd_dtc = DTC $(quiet_dtb_check_tag) $@
|
||||||
|
cmd_dtc = \
|
||||||
|
$(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
|
||||||
|
$(DTC) -o $@ -b 0 $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) \
|
||||||
|
$(DTC_FLAGS) -d $(depfile).dtc.tmp $(dtc-tmp) ; \
|
||||||
|
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) \
|
||||||
|
$(cmd_dtb_check)
|
||||||
|
|
||||||
|
$(obj)/%.dtb: $(obj)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
|
||||||
|
$(call if_changed_dep,dtc)
|
||||||
|
|
||||||
|
$(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE
|
||||||
|
$(call if_changed_dep,dtc)
|
||||||
|
|
||||||
|
# targets
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
targets += $(always-y)
|
||||||
|
|
||||||
|
# %.dtb.o <- %.dtb.S <- %.dtb <- %.dts
|
||||||
|
# %.dtbo.o <- %.dtbo.S <- %.dtbo <- %.dtso
|
||||||
|
targets += $(call intermediate_targets, .dtb.o, .dtb.S .dtb) \
|
||||||
|
$(call intermediate_targets, .dtbo.o, .dtbo.S .dtbo)
|
||||||
@@ -45,11 +45,6 @@ else
|
|||||||
obj-y := $(filter-out %/, $(obj-y))
|
obj-y := $(filter-out %/, $(obj-y))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef need-dtbslist
|
|
||||||
dtb-y += $(addsuffix /dtbs-list, $(subdir-ym))
|
|
||||||
always-y += dtbs-list
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Expand $(foo-objs) $(foo-y) etc. by replacing their individuals
|
# Expand $(foo-objs) $(foo-y) etc. by replacing their individuals
|
||||||
suffix-search = $(strip $(foreach s, $3, $($(1:%$(strip $2)=%$s))))
|
suffix-search = $(strip $(foreach s, $3, $($(1:%$(strip $2)=%$s))))
|
||||||
# List composite targets that are constructed by combining other targets
|
# List composite targets that are constructed by combining other targets
|
||||||
@@ -80,19 +75,6 @@ always-y += $(hostprogs-always-y) $(hostprogs-always-m)
|
|||||||
userprogs += $(userprogs-always-y) $(userprogs-always-m)
|
userprogs += $(userprogs-always-y) $(userprogs-always-m)
|
||||||
always-y += $(userprogs-always-y) $(userprogs-always-m)
|
always-y += $(userprogs-always-y) $(userprogs-always-m)
|
||||||
|
|
||||||
# DTB
|
|
||||||
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
|
|
||||||
dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
|
|
||||||
|
|
||||||
# Composite DTB (i.e. DTB constructed by overlay)
|
|
||||||
multi-dtb-y := $(call multi-search, $(dtb-y), .dtb, -dtbs)
|
|
||||||
# Primitive DTB compiled from *.dts
|
|
||||||
real-dtb-y := $(call real-search, $(dtb-y), .dtb, -dtbs)
|
|
||||||
# Base DTB that overlay is applied onto
|
|
||||||
base-dtb-y := $(filter %.dtb, $(call real-search, $(multi-dtb-y), .dtb, -dtbs))
|
|
||||||
|
|
||||||
always-y += $(dtb-y)
|
|
||||||
|
|
||||||
# Add subdir path
|
# Add subdir path
|
||||||
|
|
||||||
ifneq ($(obj),.)
|
ifneq ($(obj),.)
|
||||||
@@ -104,9 +86,6 @@ lib-y := $(addprefix $(obj)/,$(lib-y))
|
|||||||
real-obj-y := $(addprefix $(obj)/,$(real-obj-y))
|
real-obj-y := $(addprefix $(obj)/,$(real-obj-y))
|
||||||
real-obj-m := $(addprefix $(obj)/,$(real-obj-m))
|
real-obj-m := $(addprefix $(obj)/,$(real-obj-m))
|
||||||
multi-obj-m := $(addprefix $(obj)/, $(multi-obj-m))
|
multi-obj-m := $(addprefix $(obj)/, $(multi-obj-m))
|
||||||
dtb-y := $(addprefix $(obj)/, $(dtb-y))
|
|
||||||
multi-dtb-y := $(addprefix $(obj)/, $(multi-dtb-y))
|
|
||||||
real-dtb-y := $(addprefix $(obj)/, $(real-dtb-y))
|
|
||||||
subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
|
subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -258,14 +237,6 @@ cpp_flags = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
|
|||||||
|
|
||||||
ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
|
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_cpp_flags = -Wp,-MMD,$(depfile).pre.tmp -nostdinc \
|
|
||||||
$(addprefix -I,$(DTC_INCLUDE)) \
|
|
||||||
-undef -D__DTS__
|
|
||||||
|
|
||||||
ifdef CONFIG_OBJTOOL
|
ifdef CONFIG_OBJTOOL
|
||||||
|
|
||||||
objtool := $(objtree)/tools/objtool/objtool
|
objtool := $(objtree)/tools/objtool/objtool
|
||||||
@@ -355,94 +326,6 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
|
|||||||
quiet_cmd_gzip = GZIP $@
|
quiet_cmd_gzip = GZIP $@
|
||||||
cmd_gzip = cat $(real-prereqs) | $(KGZIP) -n -f -9 > $@
|
cmd_gzip = cat $(real-prereqs) | $(KGZIP) -n -f -9 > $@
|
||||||
|
|
||||||
# DTC
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
DTC ?= $(objtree)/scripts/dtc/dtc
|
|
||||||
DTC_FLAGS += \
|
|
||||||
-Wno-unique_unit_address
|
|
||||||
|
|
||||||
# Disable noisy checks by default
|
|
||||||
ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
|
|
||||||
DTC_FLAGS += -Wno-unit_address_vs_reg \
|
|
||||||
-Wno-avoid_unnecessary_addr_size \
|
|
||||||
-Wno-alias_paths \
|
|
||||||
-Wno-graph_child_address \
|
|
||||||
-Wno-simple_bus_reg
|
|
||||||
else
|
|
||||||
DTC_FLAGS += \
|
|
||||||
-Wunique_unit_address_if_enabled
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN)),)
|
|
||||||
DTC_FLAGS += -Wnode_name_chars_strict \
|
|
||||||
-Wproperty_name_chars_strict \
|
|
||||||
-Wunique_unit_address
|
|
||||||
endif
|
|
||||||
|
|
||||||
DTC_FLAGS += $(DTC_FLAGS_$(target-stem))
|
|
||||||
|
|
||||||
# Set -@ if the target is a base DTB that overlay is applied onto
|
|
||||||
DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
|
|
||||||
|
|
||||||
# Generate an assembly file to wrap the output of the device tree compiler
|
|
||||||
quiet_cmd_wrap_S_dtb = WRAP $@
|
|
||||||
cmd_wrap_S_dtb = { \
|
|
||||||
symbase=__$(patsubst .%,%,$(suffix $<))_$(subst -,_,$(notdir $*)); \
|
|
||||||
echo '\#include <asm-generic/vmlinux.lds.h>'; \
|
|
||||||
echo '.section .dtb.init.rodata,"a"'; \
|
|
||||||
echo '.balign STRUCT_ALIGNMENT'; \
|
|
||||||
echo ".global $${symbase}_begin"; \
|
|
||||||
echo "$${symbase}_begin:"; \
|
|
||||||
echo '.incbin "$<" '; \
|
|
||||||
echo ".global $${symbase}_end"; \
|
|
||||||
echo "$${symbase}_end:"; \
|
|
||||||
echo '.balign STRUCT_ALIGNMENT'; \
|
|
||||||
} > $@
|
|
||||||
|
|
||||||
$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
|
|
||||||
$(call if_changed,wrap_S_dtb)
|
|
||||||
|
|
||||||
$(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE
|
|
||||||
$(call if_changed,wrap_S_dtb)
|
|
||||||
|
|
||||||
quiet_dtb_check_tag = $(if $(dtb-check-enabled),[C], )
|
|
||||||
cmd_dtb_check = $(if $(dtb-check-enabled),; $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true)
|
|
||||||
|
|
||||||
quiet_cmd_dtc = DTC $(quiet_dtb_check_tag) $@
|
|
||||||
cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
|
|
||||||
$(DTC) -o $@ -b 0 \
|
|
||||||
$(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
|
|
||||||
-d $(depfile).dtc.tmp $(dtc-tmp) ; \
|
|
||||||
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) \
|
|
||||||
$(cmd_dtb_check)
|
|
||||||
|
|
||||||
# NOTE:
|
|
||||||
# Do not replace $(filter %.dtb %.dtbo, $^) with $(real-prereqs). When a single
|
|
||||||
# DTB is turned into a multi-blob DTB, $^ will contain header file dependencies
|
|
||||||
# recorded in the .*.cmd file.
|
|
||||||
quiet_cmd_fdtoverlay = OVL $(quiet_dtb_check_tag) $@
|
|
||||||
cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(filter %.dtb %.dtbo, $^) $(cmd_dtb_check)
|
|
||||||
|
|
||||||
$(multi-dtb-y): FORCE
|
|
||||||
$(call if_changed,fdtoverlay)
|
|
||||||
$(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
|
|
||||||
|
|
||||||
ifneq ($(CHECK_DTBS),)
|
|
||||||
DT_CHECKER ?= dt-validate
|
|
||||||
DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
|
|
||||||
DT_BINDING_DIR := Documentation/devicetree/bindings
|
|
||||||
DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
|
|
||||||
dtb-check-enabled = $(if $(filter %.dtb, $@),y)
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(obj)/%.dtb: $(obj)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
|
|
||||||
$(call if_changed_dep,dtc)
|
|
||||||
|
|
||||||
$(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE
|
|
||||||
$(call if_changed_dep,dtc)
|
|
||||||
|
|
||||||
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
|
|
||||||
|
|
||||||
# Bzip2
|
# Bzip2
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user