From: rric@kernel.org (Robert Richter)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] dts, kbuild: Factor out dtbs install rules to Makefile.dtbinst
Date: Fri, 5 Sep 2014 08:48:08 +0200 [thread overview]
Message-ID: <1409899692-1455-3-git-send-email-rric@kernel.org> (raw)
In-Reply-To: <1409899692-1455-1-git-send-email-rric@kernel.org>
From: Robert Richter <rrichter@cavium.com>
Move dtbs install rules to Makefile.dtbinst. This change is needed to
implement support for dts vendor subdirs. The change makes Makefiles
easier and smaller as no longer the dtbs_install rule needs to be
defined. Another advantage is that install goals are not encoded in
targets anymore (%.dtb_dtbinst_).
Signed-off-by: Robert Richter <rrichter@cavium.com>
---
arch/arm/Makefile | 6 +++++-
arch/arm/boot/dts/Makefile | 2 --
arch/arm64/Makefile | 6 +++++-
arch/arm64/boot/dts/Makefile | 2 --
scripts/Kbuild.include | 6 ++++++
scripts/Makefile.dtbinst | 38 ++++++++++++++++++++++++++++++++++++++
scripts/Makefile.lib | 12 ------------
7 files changed, 54 insertions(+), 18 deletions(-)
create mode 100644 scripts/Makefile.dtbinst
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 0ce9d0f71f2a..1963d9a9a2c4 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -313,9 +313,13 @@ $(BOOT_TARGETS): vmlinux
$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
PHONY += dtbs dtbs_install
-dtbs dtbs_install: prepare scripts
+
+dtbs: prepare scripts
$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $@
+dtbs_install:
+ $(Q)$(MAKE) $(dtbinst)=$(boot)/dts MACHINE=$(MACHINE)
+
# We use MRPROPER_FILES and CLEAN_FILES now
archclean:
$(Q)$(MAKE) $(clean)=$(boot)
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index b8c5cd3ddeb9..ab40afb87fb2 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -502,5 +502,3 @@ dtbs: $(addprefix $(obj)/, $(dtb-y))
$(Q)rm -f $(obj)/../*.dtb
clean-files := *.dtb
-
-dtbs_install: $(addsuffix _dtbinst_, $(dtb-y))
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index e0a8292bc832..1627861e9bbd 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -72,9 +72,13 @@ zinstall install: vmlinux
$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
PHONY += dtbs dtbs_install
-dtbs dtbs_install: prepare scripts
+
+dtbs: prepare scripts
$(Q)$(MAKE) $(build)=$(boot)/dts $@
+dtbs_install:
+ $(Q)$(MAKE) $(dtbinst)=$(boot)/dts
+
PHONY += vdso_install
vdso_install:
$(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index 82e1c4cf8780..0a14c3828301 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -7,5 +7,3 @@ targets += $(dtb-y)
dtbs: $(addprefix $(obj)/, $(dtb-y))
clean-files := *.dtb
-
-dtbs_install: $(addsuffix _dtbinst_, $(dtb-y))
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 8a9a4e1c7eab..861f5b4d48a2 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -179,6 +179,12 @@ build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
# $(Q)$(MAKE) $(modbuiltin)=dir
modbuiltin := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.modbuiltin obj
+###
+# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
+# Usage:
+# $(Q)$(MAKE) $(dtbinst)=dir
+dtbinst := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.dtbinst obj
+
# Prefix -I with $(srctree) if it is not an absolute path.
# skip if -I has no parameter
addtree = $(if $(patsubst -I%,%,$(1)), \
diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst
new file mode 100644
index 000000000000..54286cccc289
--- /dev/null
+++ b/scripts/Makefile.dtbinst
@@ -0,0 +1,38 @@
+# ==========================================================================
+# Installing dtb files
+#
+# Installs all dtb files listed in $(dtb-y) either in the
+# INSTALL_DTBS_PATH directory or the default location:
+#
+# $INSTALL_PATH/dtbs/$KERNELRELEASE
+#
+# ==========================================================================
+
+src := $(obj)
+
+PHONY := __dtbs_install
+__dtbs_install:
+
+include include/config/auto.conf
+include scripts/Kbuild.include
+include $(srctree)/$(obj)/Makefile
+
+PHONY += __dtbs_install_prep
+__dtbs_install_prep:
+ $(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi
+ $(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi
+ $(Q)mkdir -p $(INSTALL_DTBS_PATH)
+
+dtbinst-files := $(dtb-y)
+
+# Helper targets for Installing DTBs into the boot directory
+quiet_cmd_dtb_install = INSTALL $<
+ cmd_dtb_install = cp $< $(2)
+
+$(dtbinst-files): %.dtb: $(obj)/%.dtb | __dtbs_install_prep
+ $(call cmd,dtb_install,$(INSTALL_DTBS_PATH))
+
+PHONY += $(dtbinst-files)
+__dtbs_install: $(dtbinst-files)
+
+.PHONY: $(PHONY)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 260bf8acfce9..83a453794266 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -274,18 +274,6 @@ $(obj)/%.dtb: $(src)/%.dts FORCE
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
-# Helper targets for Installing DTBs into the boot directory
-quiet_cmd_dtb_install = INSTALL $<
- cmd_dtb_install = cp $< $(2)
-
-_dtbinst_pre_:
- $(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi
- $(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi
- $(Q)mkdir -p $(INSTALL_DTBS_PATH)
-
-%.dtb_dtbinst_: $(obj)/%.dtb _dtbinst_pre_
- $(call cmd,dtb_install,$(INSTALL_DTBS_PATH))
-
# Bzip2
# ---------------------------------------------------------------------------
--
2.0.1
next prev parent reply other threads:[~2014-09-05 6:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-05 6:48 [PATCH 0/6] dts, kbuild: Implement support for dtb vendor subdirs Robert Richter
2014-09-05 6:48 ` [PATCH 1/6] dts, arm64: Add dtbs_install make target Robert Richter
2014-09-05 6:48 ` Robert Richter [this message]
2014-09-05 12:48 ` [PATCH 2/6] dts, kbuild: Factor out dtbs install rules to Makefile.dtbinst Rob Herring
2014-09-08 7:14 ` Robert Richter
2014-09-05 6:48 ` [PATCH 3/6] dts, arm/arm64: Remove dtbs build rules in sub-makes Robert Richter
2014-09-05 6:48 ` [PATCH 4/6] dts, kbuild: Implement support for dtb vendor subdirs Robert Richter
2014-09-05 6:48 ` [PATCH 5/6] dts, arm64: Move dts files to " Robert Richter
2014-09-05 12:46 ` Rob Herring
2014-09-05 6:48 ` [PATCH 6/6] dts, arm: Remove $(MACHINE) variable from dtbs make recipes Robert Richter
2014-09-17 3:49 ` [PATCH 0/6] dts, kbuild: Implement support for dtb vendor subdirs Andrew Bresticker
2014-09-19 12:30 ` Robert Richter
2014-09-19 14:08 ` Catalin Marinas
2014-09-23 11:26 ` Robert Richter
2014-10-02 15:08 ` [GIT PULL] " Robert Richter
2014-10-20 13:56 ` Abhilash Kesavan
2014-10-20 15:24 ` Robert Richter
2014-10-21 18:15 ` Robert Richter
2014-10-30 19:26 ` Robert Richter
2014-11-04 4:47 ` Olof Johansson
2014-11-04 15:49 ` Robert Richter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409899692-1455-3-git-send-email-rric@kernel.org \
--to=rric@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).