From 5d5044069e2d658a7077af488cefb895768cf0b3 Mon Sep 17 00:00:00 2001 From: Puja Gupta Date: Fri, 10 Feb 2017 14:52:32 -0800 Subject: [PATCH] scripts: Makefile: add support to compile DT overlay blobs Add support to compile device tree overlay blob. 'dtbo-y' target can be used to specify DT overlay blob. '-obj' must be specified to list base and overlay blobs. Change-Id: Ib5036c70ba46374619cc43f9f7b697e1a444aebf Signed-off-by: Puja Gupta Signed-off-by: Rishabh Bhatnagar [eberman@codeaurora.org: Resolve merge conflicts] Signed-off-by: Elliot Bermna --- scripts/Makefile.build | 5 +++++ scripts/Makefile.dtbo | 25 +++++++++++++++++++++++++ scripts/Makefile.lib | 4 ++-- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 scripts/Makefile.dtbo diff --git a/scripts/Makefile.build b/scripts/Makefile.build index a9e47953ca53..5dd0caba8d06 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -48,6 +48,11 @@ ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(h include scripts/Makefile.host endif +# Do not include host rules unless needed +ifneq ($(dtbo-y),) +include scripts/Makefile.dtbo +endif + ifndef obj $(warning kbuild: Makefile.build is included improperly) endif diff --git a/scripts/Makefile.dtbo b/scripts/Makefile.dtbo new file mode 100644 index 000000000000..50f32c5f79a6 --- /dev/null +++ b/scripts/Makefile.dtbo @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0-only +__dtbo := $(sort $(dtbo-y)) + +dtbo-base := $(sort $(foreach m,$(__dtbo),$($(m)-base))) +dtbo := $(foreach m,$(__dtbo),$(if $($(m)-base),$(m))) + +__dtbo := $(addprefix $(obj)/,$(__dtbo)) +dtbo-base := $(addprefix $(obj)/,$(dtbo-base)) +dtbo := $(addprefix $(obj)/,$(dtbo)) + +ifneq ($(DTC_OVERLAY_TEST_EXT),) +DTC_OVERLAY_TEST = $(DTC_OVERLAY_TEST_EXT) +quiet_cmd_dtbo_verify = VERIFY $@ +cmd_dtbo_verify = $(DTC_OVERLAY_TEST) $(addprefix $(obj)/,$($(@F)-base)) $@ $(dot-target).dtb +else +cmd_dtbo_verify = true +endif + +$(obj)/%.dtbo: $(src)/%.dts FORCE + $(call if_changed_dep,dtc,dtb,-@) + $(call if_changed,dtbo_verify) + +$(call multi_depend, $(dtbo), , -base) + +always += $(dtbo) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 179d55af5852..7d9e25a6507b 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -291,12 +291,12 @@ quiet_cmd_dtc = DTC $@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ $(DTC) -O $(2) -o $@ -b 0 \ - $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \ + $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(3) $(DTC_FLAGS) \ -d $(depfile).dtc.tmp $(dtc-tmp) ; \ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE - $(call if_changed_dep,dtc,dtb) + $(call if_changed_dep,dtc,dtb,-@) DT_CHECKER ?= dt-validate DT_BINDING_DIR := Documentation/devicetree/bindings