linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule
@ 2012-11-27 23:29 Stephen Warren
  2012-11-27 23:29 ` [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory Stephen Warren
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Stephen Warren @ 2012-11-27 23:29 UTC (permalink / raw)
  To: Michal Marek, Grant Likely, Rob Herring
  Cc: Sam Ravnborg, linux-kernel, linux-arch, Stephen Warren,
	Arnd Bergmann, linux-arm-kernel, Olof Johansson, Russell King,
	Catalin Marinas, Jonas Bonn, linux, Aurelien Jacquiot,
	linux-c6x-dev, Mark Salter, Michal Simek, microblaze-uclinux,
	Chris Zankel, linux-xtensa, Max Filippov, Ralf Baechle

From: Stephen Warren <swarren@nvidia.com>

All architectures that use cmd_dtc do so in almost the same way. Create
a central build rule to avoid duplication. The one difference is that
most current uses of dtc build $(obj)/%.dtb from $(src)/dts/%.dts rather
than building the .dtb in the same directory as the .dts file. This
difference will be eliminated arch-by-arch in future patches.

MIPS is the exception here; it already uses the exact same rule as the
new common rule, so the duplicate is removed in this patch to avoid any
conflict. arch/mips changes courtesy of Ralf Baechle.

Update Documentation/kbuild to remove the explicit call to cmd_dtc from
the example, now that the rule exists in a centralized location.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Olof Johansson <olof@lixom.net>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: linux@lists.openrisc.net
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: linux-c6x-dev@linux-c6x.org
Cc: Mark Salter <msalter@redhat.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: Chris Zankel <chris@zankel.net>
Cc: linux-xtensa@linux-xtensa.org
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
This is based on next-20121126.

I've split out this dtc rule cleanup as a separate patch series.
Hopefully it can be applied without too much controversy, then I'll move
back to discussing running cpp over *.dts.

v7:
* Build *.dtb from *.dts not src/*.dts.
* Removed all arch/ updates except MIPS.
v6: Added arch/{arm64,microblaze,mips} updates.
v5: Updated Documentation/kbuild.
v4: No change.
v3: No change.
v2: New patch.
---
 Documentation/kbuild/makefiles.txt |   15 ++++++++-------
 arch/mips/cavium-octeon/Makefile   |    3 ---
 arch/mips/lantiq/dts/Makefile      |    3 ---
 arch/mips/netlogic/dts/Makefile    |    3 ---
 scripts/Makefile.lib               |    3 +++
 5 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index ec9ae67..14c3f4f 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -1175,15 +1175,16 @@ When kbuild executes, the following steps are followed (roughly):
 	in an init section in the image. Platform code *must* copy the
 	blob to non-init memory prior to calling unflatten_device_tree().
 
-	Example:
-		#arch/x86/platform/ce4100/Makefile
-		clean-files := *dtb.S
+	To use this command, simply add *.dtb into obj-y or targets, or make
+	some other target depend on %.dtb
 
-		DTC_FLAGS := -p 1024
-		obj-y += foo.dtb.o
+	A central rule exists to create $(obj)/%.dtb from $(src)/%.dts;
+	architecture Makefiles do no need to explicitly write out that rule.
 
-		$(obj)/%.dtb: $(src)/%.dts
-			$(call cmd,dtc)
+	Example:
+		targets += $(dtb-y)
+		clean-files += *.dtb
+		DTC_FLAGS ?= -p 1024
 
 --- 6.8 Custom kbuild commands
 
diff --git a/arch/mips/cavium-octeon/Makefile b/arch/mips/cavium-octeon/Makefile
index bc96e29..6e927cf 100644
--- a/arch/mips/cavium-octeon/Makefile
+++ b/arch/mips/cavium-octeon/Makefile
@@ -24,9 +24,6 @@ DTB_FILES = $(patsubst %.dts, %.dtb, $(DTS_FILES))
 
 obj-y += $(patsubst %.dts, %.dtb.o, $(DTS_FILES))
 
-$(obj)/%.dtb: $(src)/%.dts FORCE
-	$(call if_changed_dep,dtc)
-
 # Let's keep the .dtb files around in case we want to look at them.
 .SECONDARY:  $(addprefix $(obj)/, $(DTB_FILES))
 
diff --git a/arch/mips/lantiq/dts/Makefile b/arch/mips/lantiq/dts/Makefile
index 674fca4..6fa72dd 100644
--- a/arch/mips/lantiq/dts/Makefile
+++ b/arch/mips/lantiq/dts/Makefile
@@ -1,4 +1 @@
 obj-$(CONFIG_DT_EASY50712) := easy50712.dtb.o
-
-$(obj)/%.dtb: $(obj)/%.dts
-	$(call if_changed,dtc)
diff --git a/arch/mips/netlogic/dts/Makefile b/arch/mips/netlogic/dts/Makefile
index 67ae3fe2..d117d46 100644
--- a/arch/mips/netlogic/dts/Makefile
+++ b/arch/mips/netlogic/dts/Makefile
@@ -1,4 +1 @@
 obj-$(CONFIG_DT_XLP_EVP) := xlp_evp.dtb.o
-
-$(obj)/%.dtb: $(obj)/%.dts
-	$(call if_changed,dtc)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 0be6f11..bdf42fd 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -266,6 +266,9 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
 quiet_cmd_dtc = DTC     $@
 cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $<
 
+$(obj)/%.dtb: $(src)/%.dts FORCE
+	$(call if_changed_dep,dtc)
+
 # Bzip2
 # ---------------------------------------------------------------------------
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory
  2012-11-27 23:29 [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Stephen Warren
@ 2012-11-27 23:29 ` Stephen Warren
  2012-11-27 23:50   ` Olof Johansson
                     ` (2 more replies)
  2012-11-27 23:29 ` [PATCH V7 3/7] arm64: use new common dtc rule Stephen Warren
                   ` (7 subsequent siblings)
  8 siblings, 3 replies; 21+ messages in thread
From: Stephen Warren @ 2012-11-27 23:29 UTC (permalink / raw)
  To: Michal Marek, Grant Likely, Rob Herring
  Cc: Sam Ravnborg, linux-kernel, linux-arch, Russell King,
	Arnd Bergmann, Olof Johansson, linux-arm-kernel, Stephen Warren

From: Grant Likely <grant.likely@secretlab.ca>

The current rules have the .dtb files build in a different directory
from the .dts files. The only reason for this is that it was what
PowerPC has done historically. This patch changes ARM to use the generic
dtb rule which builds .dtb files in the same directory as the source .dts.

Cc: Russell King <linux@arm.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Olof Johansson <olof@lixom.net>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
[swarren: added rm command for old stale .dtb files]
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v7: New patch.
---
 arch/arm/Makefile          |    4 ++--
 arch/arm/boot/Makefile     |   12 ------------
 arch/arm/boot/dts/Makefile |    8 ++++++++
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 1ec5f67..5f92252 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -291,10 +291,10 @@ zinstall uinstall install: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
 
 %.dtb: scripts
-	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
+	$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
 
 dtbs: scripts
-	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
+	$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs
 
 # We use MRPROPER_FILES and CLEAN_FILES now
 archclean:
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index 9137df5..abfce28 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -15,8 +15,6 @@ ifneq ($(MACHINE),)
 include $(srctree)/$(MACHINE)/Makefile.boot
 endif
 
-include $(srctree)/arch/arm/boot/dts/Makefile
-
 # Note: the following conditions must always be true:
 #   ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
 #   PARAMS_PHYS must be within 4MB of ZRELADDR
@@ -59,16 +57,6 @@ $(obj)/zImage:	$(obj)/compressed/vmlinux FORCE
 
 endif
 
-targets += $(dtb-y)
-
-# Rule to build device tree blobs
-$(obj)/%.dtb: $(src)/dts/%.dts FORCE
-	$(call if_changed_dep,dtc)
-
-$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
-
-clean-files := *.dtb
-
 ifneq ($(LOADADDR),)
   UIMAGE_LOADADDR=$(LOADADDR)
 else
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index a17d5ab..cb217f8 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -136,4 +136,12 @@ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
 	wm8650-mid.dtb
 dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb
 
+targets += dtbs
 endif
+
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+	# *.dtb used to be generated in the directory above. Clean out the
+	# old build results so people don't accidentally use them.
+	rm -f $(obj)/../*.dtb
+
+clean-files := *.dtb
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V7 3/7] arm64: use new common dtc rule
  2012-11-27 23:29 [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Stephen Warren
  2012-11-27 23:29 ` [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory Stephen Warren
@ 2012-11-27 23:29 ` Stephen Warren
  2012-11-29 14:30   ` Catalin Marinas
  2012-11-27 23:29 ` [PATCH V7 4/7] openrisc: " Stephen Warren
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Stephen Warren @ 2012-11-27 23:29 UTC (permalink / raw)
  To: Michal Marek, Grant Likely, Rob Herring
  Cc: Sam Ravnborg, linux-kernel, linux-arch, Stephen Warren,
	Catalin Marinas, linux-arm-kernel

From: Stephen Warren <swarren@nvidia.com>

The current rules have the .dtb files build in a different directory
from the .dts files. This patch changes arm64 to use the generic dtb
rule which builds .dtb files in the same directory as the source .dts.

This requires moving parts of arch/arm64/boot/Makefile into newly created
arch/arm64/boot/dts/Makefile, and updating arch/arm64/Makefile to call the
new Makefile.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v7: New patch.
---
 arch/arm64/Makefile          |    2 +-
 arch/arm64/boot/Makefile     |    5 -----
 arch/arm64/boot/dts/Makefile |    5 +++++
 3 files changed, 6 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm64/boot/dts/Makefile

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 364191f..fd3d4a1 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -54,7 +54,7 @@ zinstall install: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
 
 %.dtb:
-	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
+	$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
 
 # We use MRPROPER_FILES and CLEAN_FILES now
 archclean:
diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile
index eca209b..5a0e3ab 100644
--- a/arch/arm64/boot/Makefile
+++ b/arch/arm64/boot/Makefile
@@ -22,9 +22,6 @@ $(obj)/Image: vmlinux FORCE
 $(obj)/Image.gz: $(obj)/Image FORCE
 	$(call if_changed,gzip)
 
-$(obj)/%.dtb: $(src)/dts/%.dts
-	$(call cmd,dtc)
-
 install: $(obj)/Image
 	$(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
 	$(obj)/Image System.map "$(INSTALL_PATH)"
@@ -32,5 +29,3 @@ install: $(obj)/Image
 zinstall: $(obj)/Image.gz
 	$(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
 	$(obj)/Image.gz System.map "$(INSTALL_PATH)"
-
-clean-files += *.dtb
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
new file mode 100644
index 0000000..801e2d7
--- /dev/null
+++ b/arch/arm64/boot/dts/Makefile
@@ -0,0 +1,5 @@
+targets += dtbs
+
+dtbs: $(addprefix $(obj)/, $(dtb-y))
+
+clean-files := *.dtb
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V7 4/7] openrisc: use new common dtc rule
  2012-11-27 23:29 [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Stephen Warren
  2012-11-27 23:29 ` [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory Stephen Warren
  2012-11-27 23:29 ` [PATCH V7 3/7] arm64: use new common dtc rule Stephen Warren
@ 2012-11-27 23:29 ` Stephen Warren
  2012-11-27 23:29 ` [PATCH V7 5/7] c6x: " Stephen Warren
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Stephen Warren @ 2012-11-27 23:29 UTC (permalink / raw)
  To: Michal Marek, Grant Likely, Rob Herring
  Cc: Sam Ravnborg, linux-kernel, linux-arch, Stephen Warren,
	Jonas Bonn, linux

From: Stephen Warren <swarren@nvidia.com>

The current rules have the .dtb files build in a different directory
from the .dts files. This patch changes openrisc to use the generic dtb
rule which builds .dtb files in the same directory as the source .dts.

This requires renaming arch/openrisc/boot/Makefile to
arch/openrisc/boot/dts/Makefile, and updating arch/openrisc/Makefile to
call the new Makefile.

Cc: Jonas Bonn <jonas@southpole.se>
Cc: linux@lists.openrisc.net
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v7: New patch.
---
 arch/openrisc/Makefile                |    2 +-
 arch/openrisc/boot/{ => dts}/Makefile |    5 -----
 2 files changed, 1 insertion(+), 6 deletions(-)
 rename arch/openrisc/boot/{ => dts}/Makefile (75%)

diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
index 966886c..4739b83 100644
--- a/arch/openrisc/Makefile
+++ b/arch/openrisc/Makefile
@@ -50,6 +50,6 @@ BUILTIN_DTB := y
 else
 BUILTIN_DTB := n
 endif
-core-$(BUILTIN_DTB) += arch/openrisc/boot/
+core-$(BUILTIN_DTB) += arch/openrisc/boot/dts/
 
 all: vmlinux
diff --git a/arch/openrisc/boot/Makefile b/arch/openrisc/boot/dts/Makefile
similarity index 75%
rename from arch/openrisc/boot/Makefile
rename to arch/openrisc/boot/dts/Makefile
index 0995835..b092d30 100644
--- a/arch/openrisc/boot/Makefile
+++ b/arch/openrisc/boot/dts/Makefile
@@ -1,5 +1,3 @@
-
-
 ifneq '$(CONFIG_OPENRISC_BUILTIN_DTB)' '""'
 BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_OPENRISC_BUILTIN_DTB)).dtb.o
 else
@@ -10,6 +8,3 @@ obj-y += $(BUILTIN_DTB)
 clean-files := *.dtb.S
 
 #DTC_FLAGS ?= -p 1024
-
-$(obj)/%.dtb: $(src)/dts/%.dts FORCE
-	$(call if_changed_dep,dtc)
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V7 5/7] c6x: use new common dtc rule
  2012-11-27 23:29 [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Stephen Warren
                   ` (2 preceding siblings ...)
  2012-11-27 23:29 ` [PATCH V7 4/7] openrisc: " Stephen Warren
@ 2012-11-27 23:29 ` Stephen Warren
  2012-11-28 18:09   ` Mark Salter
  2012-11-27 23:29 ` [PATCH V7 6/7] microblaze: " Stephen Warren
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Stephen Warren @ 2012-11-27 23:29 UTC (permalink / raw)
  To: Michal Marek, Grant Likely, Rob Herring
  Cc: Sam Ravnborg, linux-kernel, linux-arch, Stephen Warren,
	Mark Salter, Aurelien Jacquiot, linux-c6x-dev

From: Stephen Warren <swarren@nvidia.com>

The current rules have the .dtb files build in a different directory
from the .dts files. This patch changes c6x to use the generic dtb
rule which builds .dtb files in the same directory as the source .dts.

This requires moving parts of arch/c6x/boot/Makefile into newly created
arch/c6x/boot/dts/Makefile, and updating arch/c6x/Makefile to call the
new Makefile. linked_dtb.S is also moved into boot/dts/ since it's used
by rules that were moved.

Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: linux-c6x-dev@linux-c6x.org
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v7: New patch.
---
 arch/c6x/Makefile                |    2 +-
 arch/c6x/boot/Makefile           |   20 --------------------
 arch/c6x/boot/{ => dts}/Makefile |   14 ++------------
 arch/c6x/boot/dts/linked_dtb.S   |    2 ++
 arch/c6x/boot/linked_dtb.S       |    2 --
 5 files changed, 5 insertions(+), 35 deletions(-)
 copy arch/c6x/boot/{ => dts}/Makefile (50%)
 create mode 100644 arch/c6x/boot/dts/linked_dtb.S
 delete mode 100644 arch/c6x/boot/linked_dtb.S

diff --git a/arch/c6x/Makefile b/arch/c6x/Makefile
index a9eb959..e72eb34 100644
--- a/arch/c6x/Makefile
+++ b/arch/c6x/Makefile
@@ -41,7 +41,7 @@ DTB:=$(subst dtbImage.,,$(filter dtbImage.%, $(MAKECMDGOALS)))
 export DTB
 
 ifneq ($(DTB),)
-core-y	+= $(boot)/
+core-y	+= $(boot)/dts/
 endif
 
 # With make 3.82 we cannot mix normal and wildcard targets
diff --git a/arch/c6x/boot/Makefile b/arch/c6x/boot/Makefile
index 6891257..8734abe 100644
--- a/arch/c6x/boot/Makefile
+++ b/arch/c6x/boot/Makefile
@@ -6,25 +6,5 @@ OBJCOPYFLAGS_vmlinux.bin := -O binary
 $(obj)/vmlinux.bin: vmlinux FORCE
 	$(call if_changed,objcopy)
 
-DTC_FLAGS ?= -p 1024
-
-ifneq ($(DTB),)
-obj-y += linked_dtb.o
-endif
-
-$(obj)/%.dtb: $(src)/dts/%.dts FORCE
-	$(call if_changed_dep,dtc)
-
-quiet_cmd_cp = CP      $< $@$2
-	cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
-
-# Generate builtin.dtb from $(DTB).dtb
-$(obj)/builtin.dtb: $(obj)/$(DTB).dtb
-	$(call if_changed,cp)
-
-$(obj)/linked_dtb.o: $(obj)/builtin.dtb
-
 $(obj)/dtbImage.%: vmlinux
 	$(call if_changed,objcopy)
-
-clean-files := $(obj)/*.dtb
diff --git a/arch/c6x/boot/Makefile b/arch/c6x/boot/dts/Makefile
similarity index 50%
copy from arch/c6x/boot/Makefile
copy to arch/c6x/boot/dts/Makefile
index 6891257..c7528b0 100644
--- a/arch/c6x/boot/Makefile
+++ b/arch/c6x/boot/dts/Makefile
@@ -1,20 +1,13 @@
 #
-# Makefile for bootable kernel images
+# Makefile for device trees
 #
 
-OBJCOPYFLAGS_vmlinux.bin := -O binary
-$(obj)/vmlinux.bin: vmlinux FORCE
-	$(call if_changed,objcopy)
-
 DTC_FLAGS ?= -p 1024
 
 ifneq ($(DTB),)
 obj-y += linked_dtb.o
 endif
 
-$(obj)/%.dtb: $(src)/dts/%.dts FORCE
-	$(call if_changed_dep,dtc)
-
 quiet_cmd_cp = CP      $< $@$2
 	cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
 
@@ -24,7 +17,4 @@ $(obj)/builtin.dtb: $(obj)/$(DTB).dtb
 
 $(obj)/linked_dtb.o: $(obj)/builtin.dtb
 
-$(obj)/dtbImage.%: vmlinux
-	$(call if_changed,objcopy)
-
-clean-files := $(obj)/*.dtb
+clean-files := *.dtb
diff --git a/arch/c6x/boot/dts/linked_dtb.S b/arch/c6x/boot/dts/linked_dtb.S
new file mode 100644
index 0000000..cf347f1
--- /dev/null
+++ b/arch/c6x/boot/dts/linked_dtb.S
@@ -0,0 +1,2 @@
+.section __fdt_blob,"a"
+.incbin "arch/c6x/boot/dts/builtin.dtb"
diff --git a/arch/c6x/boot/linked_dtb.S b/arch/c6x/boot/linked_dtb.S
deleted file mode 100644
index 57a4454..0000000
--- a/arch/c6x/boot/linked_dtb.S
+++ /dev/null
@@ -1,2 +0,0 @@
-.section __fdt_blob,"a"
-.incbin "arch/c6x/boot/builtin.dtb"
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V7 6/7] microblaze: use new common dtc rule
  2012-11-27 23:29 [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Stephen Warren
                   ` (3 preceding siblings ...)
  2012-11-27 23:29 ` [PATCH V7 5/7] c6x: " Stephen Warren
@ 2012-11-27 23:29 ` Stephen Warren
  2012-11-27 23:29 ` [PATCH V7 7/7] xtensa: " Stephen Warren
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Stephen Warren @ 2012-11-27 23:29 UTC (permalink / raw)
  To: Michal Marek, Grant Likely, Rob Herring
  Cc: Sam Ravnborg, linux-kernel, linux-arch, Stephen Warren,
	Michal Simek, microblaze-uclinux

From: Stephen Warren <swarren@nvidia.com>

The current rules have the .dtb files build in a different directory
from the .dts files. This patch changes microblaze to use the generic dtb
rule which builds .dtb files in the same directory as the source .dts.

This requires moving parts of arch/microblaze/boot/Makefile into newly
created arch/microblaze/boot/dts/Makefile, and updating
arch/microblaze/Makefile to call the new Makefile. linked_dtb.S is also
moved into boot/dts/ since it's used by rules that were moved.

Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v7: New patch.
---
 arch/microblaze/Makefile              |    2 +-
 arch/microblaze/boot/Makefile         |   19 +------------------
 arch/microblaze/boot/dts/Makefile     |   22 ++++++++++++++++++++++
 arch/microblaze/boot/dts/linked_dtb.S |    2 ++
 arch/microblaze/boot/linked_dtb.S     |    3 ---
 5 files changed, 26 insertions(+), 22 deletions(-)
 create mode 100644 arch/microblaze/boot/dts/Makefile
 create mode 100644 arch/microblaze/boot/dts/linked_dtb.S
 delete mode 100644 arch/microblaze/boot/linked_dtb.S

diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index b23c40e..d26fb90 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -57,7 +57,7 @@ boot := arch/microblaze/boot
 DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS)))
 
 ifneq ($(DTB),)
-	core-y	+= $(boot)/
+	core-y	+= $(boot)/dts/
 endif
 
 # defines filename extension depending memory management type
diff --git a/arch/microblaze/boot/Makefile b/arch/microblaze/boot/Makefile
index fa83ea4..80fe54f 100644
--- a/arch/microblaze/boot/Makefile
+++ b/arch/microblaze/boot/Makefile
@@ -2,21 +2,10 @@
 # arch/microblaze/boot/Makefile
 #
 
-obj-y += linked_dtb.o
-
 targets := linux.bin linux.bin.gz simpleImage.%
 
 OBJCOPYFLAGS := -R .note -R .comment -R .note.gnu.build-id -O binary
 
-# Ensure system.dtb exists
-$(obj)/linked_dtb.o: $(obj)/system.dtb
-
-# Generate system.dtb from $(DTB).dtb
-ifneq ($(DTB),system)
-$(obj)/system.dtb: $(obj)/$(DTB).dtb
-	$(call if_changed,cp)
-endif
-
 $(obj)/linux.bin: vmlinux FORCE
 	$(call if_changed,objcopy)
 	$(call if_changed,uimage)
@@ -45,10 +34,4 @@ $(obj)/simpleImage.%: vmlinux FORCE
 	@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
 
 
-# Rule to build device tree blobs
-DTC_FLAGS := -p 1024
-
-$(obj)/%.dtb: $(src)/dts/%.dts FORCE
-	$(call if_changed_dep,dtc)
-
-clean-files += *.dtb simpleImage.*.unstrip linux.bin.ub
+clean-files += simpleImage.*.unstrip linux.bin.ub
diff --git a/arch/microblaze/boot/dts/Makefile b/arch/microblaze/boot/dts/Makefile
new file mode 100644
index 0000000..c3b3a5d
--- /dev/null
+++ b/arch/microblaze/boot/dts/Makefile
@@ -0,0 +1,22 @@
+#
+# arch/microblaze/boot/Makefile
+#
+
+obj-y += linked_dtb.o
+
+# Ensure system.dtb exists
+$(obj)/linked_dtb.o: $(obj)/system.dtb
+
+# Generate system.dtb from $(DTB).dtb
+ifneq ($(DTB),system)
+$(obj)/system.dtb: $(obj)/$(DTB).dtb
+	$(call if_changed,cp)
+endif
+
+quiet_cmd_cp = CP      $< $@$2
+	cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
+
+# Rule to build device tree blobs
+DTC_FLAGS := -p 1024
+
+clean-files += *.dtb
diff --git a/arch/microblaze/boot/dts/linked_dtb.S b/arch/microblaze/boot/dts/linked_dtb.S
new file mode 100644
index 0000000..23345af
--- /dev/null
+++ b/arch/microblaze/boot/dts/linked_dtb.S
@@ -0,0 +1,2 @@
+.section __fdt_blob,"a"
+.incbin "arch/microblaze/boot/dts/system.dtb"
diff --git a/arch/microblaze/boot/linked_dtb.S b/arch/microblaze/boot/linked_dtb.S
deleted file mode 100644
index cb2b537..0000000
--- a/arch/microblaze/boot/linked_dtb.S
+++ /dev/null
@@ -1,3 +0,0 @@
-.section __fdt_blob,"a"
-.incbin "arch/microblaze/boot/system.dtb"
-
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH V7 7/7] xtensa: use new common dtc rule
  2012-11-27 23:29 [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Stephen Warren
                   ` (4 preceding siblings ...)
  2012-11-27 23:29 ` [PATCH V7 6/7] microblaze: " Stephen Warren
@ 2012-11-27 23:29 ` Stephen Warren
  2012-11-28 17:44 ` [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Catalin Marinas
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Stephen Warren @ 2012-11-27 23:29 UTC (permalink / raw)
  To: Michal Marek, Grant Likely, Rob Herring
  Cc: Sam Ravnborg, linux-kernel, linux-arch, Stephen Warren,
	Chris Zankel, Max Filippov, linux-xtensa

From: Stephen Warren <swarren@nvidia.com>

The current rules have the .dtb files build in a different directory
from the .dts files. This patch changes xtensa to use the generic dtb
rule which builds .dtb files in the same directory as the source .dts.

This requires moving parts of arch/xtensa/boot/Makefile into newly
created arch/xtensa/boot/dts/Makefile, and updating arch/xtensa/Makefile
to call the new Makefile.

Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-xtensa@linux-xtensa.org
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v7: New patch.
---
 arch/xtensa/Makefile          |    4 ++--
 arch/xtensa/boot/Makefile     |   10 ----------
 arch/xtensa/boot/dts/Makefile |   13 +++++++++++++
 3 files changed, 15 insertions(+), 12 deletions(-)
 create mode 100644 arch/xtensa/boot/dts/Makefile

diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index b8eb819..b0646fd 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -80,7 +80,7 @@ core-y		+= $(buildvar) $(buildplf)
 
 libs-y		+= arch/xtensa/lib/ $(LIBGCC)
 
-core-$(CONFIG_BUILTIN_DTB_BOOL) += arch/xtensa/boot/
+core-$(CONFIG_BUILTIN_DTB_BOOL) += arch/xtensa/boot/dts/
 
 boot		:= arch/xtensa/boot
 
@@ -92,7 +92,7 @@ zImage: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) $@
 
 %.dtb:
-	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
+	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
 
 define archhelp
   @echo '* zImage      - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile
index 5d21c21..6be27fb 100644
--- a/arch/xtensa/boot/Makefile
+++ b/arch/xtensa/boot/Makefile
@@ -25,16 +25,6 @@ bootdir-$(CONFIG_XTENSA_PLATFORM_ISS)	 += boot-elf
 bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf boot-uboot
 bootdir-$(CONFIG_XTENSA_PLATFORM_XTAVNET)+= boot-redboot boot-elf boot-uboot
 
-
-BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB)).dtb.o
-obj-$(CONFIG_BUILTIN_DTB_BOOL) += $(BUILTIN_DTB)
-
-# Rule to build device tree blobs
-$(obj)/%.dtb: $(src)/dts/%.dts FORCE
-	$(call if_changed_dep,dtc)
-
-clean-files := *.dtb.S
-
 zImage Image: $(bootdir-y)
 
 $(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
diff --git a/arch/xtensa/boot/dts/Makefile b/arch/xtensa/boot/dts/Makefile
new file mode 100644
index 0000000..0b5581a
--- /dev/null
+++ b/arch/xtensa/boot/dts/Makefile
@@ -0,0 +1,13 @@
+#
+# arch/xtensa/boot/dts/Makefile
+#
+# This file is subject to the terms and conditions of the GNU General Public
+# License.  See the file "COPYING" in the main directory of this archive
+# for more details.
+#
+#
+
+BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB)).dtb.o
+obj-$(CONFIG_BUILTIN_DTB_BOOL) += $(BUILTIN_DTB)
+
+clean-files := *.dtb.S
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory
  2012-11-27 23:29 ` [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory Stephen Warren
@ 2012-11-27 23:50   ` Olof Johansson
  2012-12-03 16:15   ` Rob Herring
  2012-12-26 14:27   ` Shawn Guo
  2 siblings, 0 replies; 21+ messages in thread
From: Olof Johansson @ 2012-11-27 23:50 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Michal Marek, Grant Likely, Rob Herring, Sam Ravnborg,
	linux-kernel, linux-arch, Russell King, Arnd Bergmann,
	linux-arm-kernel, Stephen Warren

On Tue, Nov 27, 2012 at 3:29 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
>
> The current rules have the .dtb files build in a different directory
> from the .dts files. The only reason for this is that it was what
> PowerPC has done historically. This patch changes ARM to use the generic
> dtb rule which builds .dtb files in the same directory as the source .dts.
>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Olof Johansson <olof@lixom.net>
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> [swarren: added rm command for old stale .dtb files]
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Acked-by: Olof Johansson <olof@lixom.net>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule
  2012-11-27 23:29 [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Stephen Warren
                   ` (5 preceding siblings ...)
  2012-11-27 23:29 ` [PATCH V7 7/7] xtensa: " Stephen Warren
@ 2012-11-28 17:44 ` Catalin Marinas
  2012-11-28 18:33 ` Stephen Warren
  2012-11-30 16:01 ` Rob Herring
  8 siblings, 0 replies; 21+ messages in thread
From: Catalin Marinas @ 2012-11-28 17:44 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Michal Marek, Grant Likely, rob.herring, Sam Ravnborg,
	linux-kernel, linux-arch, Stephen Warren, Arnd Bergmann,
	linux-arm-kernel, Olof Johansson, Russell King, Jonas Bonn,
	linux, Aurelien Jacquiot, linux-c6x-dev, msalter, Michal Simek,
	microblaze-uclinux, Chris Zankel, linux-xtensa, Max Filippov,
	Ralf Baechle

On Tue, Nov 27, 2012 at 11:29:10PM +0000, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> All architectures that use cmd_dtc do so in almost the same way. Create
> a central build rule to avoid duplication. The one difference is that
> most current uses of dtc build $(obj)/%.dtb from $(src)/dts/%.dts rather
> than building the .dtb in the same directory as the .dts file. This
> difference will be eliminated arch-by-arch in future patches.
> 
> MIPS is the exception here; it already uses the exact same rule as the
> new common rule, so the duplicate is removed in this patch to avoid any
> conflict. arch/mips changes courtesy of Ralf Baechle.
> 
> Update Documentation/kbuild to remove the explicit call to cmd_dtc from
> the example, now that the rule exists in a centralized location.
> 
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Olof Johansson <olof@lixom.net>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Jonas Bonn <jonas@southpole.se>
> Cc: linux@lists.openrisc.net
> Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
> Cc: linux-c6x-dev@linux-c6x.org
> Cc: Mark Salter <msalter@redhat.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: microblaze-uclinux@itee.uq.edu.au
> Cc: Chris Zankel <chris@zankel.net>
> Cc: linux-xtensa@linux-xtensa.org
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 5/7] c6x: use new common dtc rule
  2012-11-27 23:29 ` [PATCH V7 5/7] c6x: " Stephen Warren
@ 2012-11-28 18:09   ` Mark Salter
  0 siblings, 0 replies; 21+ messages in thread
From: Mark Salter @ 2012-11-28 18:09 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Michal Marek, Grant Likely, Rob Herring, Sam Ravnborg,
	linux-kernel, linux-arch, Stephen Warren, Aurelien Jacquiot,
	linux-c6x-dev

On Tue, 2012-11-27 at 16:29 -0700, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> The current rules have the .dtb files build in a different directory
> from the .dts files. This patch changes c6x to use the generic dtb
> rule which builds .dtb files in the same directory as the source .dts.
> 
> This requires moving parts of arch/c6x/boot/Makefile into newly created
> arch/c6x/boot/dts/Makefile, and updating arch/c6x/Makefile to call the
> new Makefile. linked_dtb.S is also moved into boot/dts/ since it's used
> by rules that were moved.
> 
> Cc: Mark Salter <msalter@redhat.com>
> Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
> Cc: linux-c6x-dev@linux-c6x.org
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---

Acked-by: Mark Salter <msalter@redhat.com>



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule
  2012-11-27 23:29 [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Stephen Warren
                   ` (6 preceding siblings ...)
  2012-11-28 17:44 ` [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Catalin Marinas
@ 2012-11-28 18:33 ` Stephen Warren
  2012-11-28 23:28   ` Benjamin Herrenschmidt
  2012-11-30 16:01 ` Rob Herring
  8 siblings, 1 reply; 21+ messages in thread
From: Stephen Warren @ 2012-11-28 18:33 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras
  Cc: Michal Marek, Grant Likely, Rob Herring, linux-kernel,
	linux-arch, linuxppc-dev

On 11/27/2012 04:29 PM, Stephen Warren wrote:
> All architectures that use cmd_dtc do so in almost the same way. Create
> a central build rule to avoid duplication. The one difference is that
> most current uses of dtc build $(obj)/%.dtb from $(src)/dts/%.dts rather
> than building the .dtb in the same directory as the .dts file. This
> difference will be eliminated arch-by-arch in future patches.
> 
> MIPS is the exception here; it already uses the exact same rule as the
> new common rule, so the duplicate is removed in this patch to avoid any
> conflict. arch/mips changes courtesy of Ralf Baechle.
> 
> Update Documentation/kbuild to remove the explicit call to cmd_dtc from
> the example, now that the rule exists in a centralized location.

Ben, Paul,

Following this patch (http://lkml.org/lkml/2012/11/27/555), I posted a
series of patches to convert almost all architectures to using the
centralized rule. The one architecture I didn't convert was PowerPC.

I didn't convert it because arch/powerpc/boot/Makefile contains a large
number of rules (to generate *Image.% where % is a board name) that
depend on %.dtb, which is expected to be in arch/powerpc/boot rather
than arch/powerpc/boot/dts. Now, I guess it's possible to convert them
all to expect the .dtb files to be in dts/ and also have
arch/powerpc/boot/Makefile call make in boot/dts/ to make each required
.dtb file. However, the patch would be a bit larger than all the other
architecture patches. Do you want me to do that conversion, or would you
rather I leave PowerPC alone? Thanks for any feedback.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule
  2012-11-28 18:33 ` Stephen Warren
@ 2012-11-28 23:28   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 21+ messages in thread
From: Benjamin Herrenschmidt @ 2012-11-28 23:28 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Paul Mackerras, Michal Marek, Grant Likely, Rob Herring,
	linux-kernel, linux-arch, linuxppc-dev, Kumar Gala

On Wed, 2012-11-28 at 11:33 -0700, Stephen Warren wrote:

> Following this patch (http://lkml.org/lkml/2012/11/27/555), I posted a
> series of patches to convert almost all architectures to using the
> centralized rule. The one architecture I didn't convert was PowerPC.
> 
> I didn't convert it because arch/powerpc/boot/Makefile contains a large
> number of rules (to generate *Image.% where % is a board name) that
> depend on %.dtb, which is expected to be in arch/powerpc/boot rather
> than arch/powerpc/boot/dts. Now, I guess it's possible to convert them
> all to expect the .dtb files to be in dts/ and also have
> arch/powerpc/boot/Makefile call make in boot/dts/ to make each required
> .dtb file. However, the patch would be a bit larger than all the other
> architecture patches. Do you want me to do that conversion, or would you
> rather I leave PowerPC alone? Thanks for any feedback.

Kumar, any objection to moving the dtb's to arch/powerpc/boot/dtb/ ?
Other than breaking a script or two out there ...

Cheers,
Ben.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 3/7] arm64: use new common dtc rule
  2012-11-27 23:29 ` [PATCH V7 3/7] arm64: use new common dtc rule Stephen Warren
@ 2012-11-29 14:30   ` Catalin Marinas
  2012-12-03 17:27     ` Stephen Warren
  0 siblings, 1 reply; 21+ messages in thread
From: Catalin Marinas @ 2012-11-29 14:30 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Michal Marek, Grant Likely, rob.herring, Sam Ravnborg,
	linux-kernel, linux-arch, Stephen Warren, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 938 bytes --]

On Tue, Nov 27, 2012 at 11:29:12PM +0000, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> The current rules have the .dtb files build in a different directory
> from the .dts files. This patch changes arm64 to use the generic dtb
> rule which builds .dtb files in the same directory as the source .dts.
> 
> This requires moving parts of arch/arm64/boot/Makefile into newly created
> arch/arm64/boot/dts/Makefile, and updating arch/arm64/Makefile to call the
> new Makefile.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

I had a bit more clean-up in a local patch (see attached). Depending on
the timing, you can just fold it into your patch (basically removing the
MACHINE argument, adding KBUILD_DTBS and dtbs target help). It's been
derived from your arch/arm patch anyway ;).

-- 
Catalin

[-- Attachment #2: 0001-arm64-Add-dtbs-target-for-building-all-the-enabled-d.patch --]
[-- Type: text/x-diff, Size: 3069 bytes --]

>From 906ea5523f1a5c2fadea72b54d5d6a8e5fecdfe5 Mon Sep 17 00:00:00 2001
From: Catalin Marinas <catalin.marinas@arm.com>
Date: Wed, 21 Nov 2012 11:44:59 +0000
Subject: [PATCH] arm64: Add dtbs target for building all the enabled dtb
 files

Based on Rob Herring's patches for arch/arm, this patch adds a dtbs
target to arch/arm64/boot/Makefile.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/Makefile        | 17 +++++++++++------
 arch/arm64/boot/.gitignore |  1 +
 arch/arm64/boot/Makefile   |  6 ++++++
 3 files changed, 18 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm64/boot/dts/Makefile

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 93e871e..ddadd27 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -42,20 +42,24 @@ libs-y		:= arch/arm64/lib/ $(libs-y)
 libs-y		+= $(LIBGCC)
 
 # Default target when executing plain make
-KBUILD_IMAGE := Image.gz
+KBUILD_IMAGE	:= Image.gz
+KBUILD_DTBS	:= dtbs
 
-all:	$(KBUILD_IMAGE)
+all:	$(KBUILD_IMAGE) $(KBUILD_DTBS)
 
 boot := arch/arm64/boot
 
 Image Image.gz: vmlinux
-	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
 zinstall install: vmlinux
-	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
+	$(Q)$(MAKE) $(build)=$(boot) $@
 
-%.dtb:
-	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
+%.dtb: scripts
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
+
+dtbs: scripts
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
 # We use MRPROPER_FILES and CLEAN_FILES now
 archclean:
@@ -64,6 +68,7 @@ archclean:
 define archhelp
   echo  '* Image.gz      - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
   echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
+  echo  '* dtbs          - Build device tree blobs for enabled boards'
   echo  '  install       - Install uncompressed kernel'
   echo  '  zinstall      - Install compressed kernel'
   echo  '                  Install using (your) ~/bin/installkernel or'
diff --git a/arch/arm64/boot/.gitignore b/arch/arm64/boot/.gitignore
index 8dab0bb..98af90a 100644
--- a/arch/arm64/boot/.gitignore
+++ b/arch/arm64/boot/.gitignore
@@ -1,2 +1,3 @@
 Image
 Image.gz
+*.dtb
diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile
index 20048be..ce8642e 100644
--- a/arch/arm64/boot/Makefile
+++ b/arch/arm64/boot/Makefile
@@ -14,6 +14,8 @@
 # Based on the ia64 boot/Makefile.
 #
 
+include $(srctree)/arch/arm64/boot/dts/Makefile
+
 targets := Image Image.gz
 
 $(obj)/Image: vmlinux FORCE
@@ -22,6 +24,10 @@ $(obj)/Image: vmlinux FORCE
 $(obj)/Image.gz: $(obj)/Image FORCE
 	$(call if_changed,gzip)
 
+targets += $(dtb-y)
+
+$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
+
 install: $(obj)/Image
 	$(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
 	$(obj)/Image System.map "$(INSTALL_PATH)"
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
new file mode 100644
index 0000000..e69de29

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule
  2012-11-27 23:29 [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Stephen Warren
                   ` (7 preceding siblings ...)
  2012-11-28 18:33 ` Stephen Warren
@ 2012-11-30 16:01 ` Rob Herring
  2012-11-30 19:34   ` Stephen Warren
  2012-12-01  4:43   ` Max Filippov
  8 siblings, 2 replies; 21+ messages in thread
From: Rob Herring @ 2012-11-30 16:01 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Michal Marek, Grant Likely, Sam Ravnborg, linux-kernel,
	linux-arch, Stephen Warren, Arnd Bergmann, linux-arm-kernel,
	Olof Johansson, Russell King, Catalin Marinas, Jonas Bonn, linux,
	Aurelien Jacquiot, linux-c6x-dev, Mark Salter, Michal Simek,
	microblaze-uclinux, Chris Zankel, linux-xtensa, Max Filippov,
	Ralf Baechle

On 11/27/2012 05:29 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> All architectures that use cmd_dtc do so in almost the same way. Create
> a central build rule to avoid duplication. The one difference is that
> most current uses of dtc build $(obj)/%.dtb from $(src)/dts/%.dts rather
> than building the .dtb in the same directory as the .dts file. This
> difference will be eliminated arch-by-arch in future patches.
> 
> MIPS is the exception here; it already uses the exact same rule as the
> new common rule, so the duplicate is removed in this patch to avoid any
> conflict. arch/mips changes courtesy of Ralf Baechle.
> 
> Update Documentation/kbuild to remove the explicit call to cmd_dtc from
> the example, now that the rule exists in a centralized location.
> 
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Olof Johansson <olof@lixom.net>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Jonas Bonn <jonas@southpole.se>
> Cc: linux@lists.openrisc.net
> Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
> Cc: linux-c6x-dev@linux-c6x.org
> Cc: Mark Salter <msalter@redhat.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: microblaze-uclinux@itee.uq.edu.au
> Cc: Chris Zankel <chris@zankel.net>
> Cc: linux-xtensa@linux-xtensa.org
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> This is based on next-20121126.
> 

I'll apply the series but I need a stable base. Looks like xtensa has
the dependency. Or I can just drop xtensa.

Rob

> I've split out this dtc rule cleanup as a separate patch series.
> Hopefully it can be applied without too much controversy, then I'll move
> back to discussing running cpp over *.dts.
> 
> v7:
> * Build *.dtb from *.dts not src/*.dts.
> * Removed all arch/ updates except MIPS.
> v6: Added arch/{arm64,microblaze,mips} updates.
> v5: Updated Documentation/kbuild.
> v4: No change.
> v3: No change.
> v2: New patch.
> ---
>  Documentation/kbuild/makefiles.txt |   15 ++++++++-------
>  arch/mips/cavium-octeon/Makefile   |    3 ---
>  arch/mips/lantiq/dts/Makefile      |    3 ---
>  arch/mips/netlogic/dts/Makefile    |    3 ---
>  scripts/Makefile.lib               |    3 +++
>  5 files changed, 11 insertions(+), 16 deletions(-)
> 
> diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
> index ec9ae67..14c3f4f 100644
> --- a/Documentation/kbuild/makefiles.txt
> +++ b/Documentation/kbuild/makefiles.txt
> @@ -1175,15 +1175,16 @@ When kbuild executes, the following steps are followed (roughly):
>  	in an init section in the image. Platform code *must* copy the
>  	blob to non-init memory prior to calling unflatten_device_tree().
>  
> -	Example:
> -		#arch/x86/platform/ce4100/Makefile
> -		clean-files := *dtb.S
> +	To use this command, simply add *.dtb into obj-y or targets, or make
> +	some other target depend on %.dtb
>  
> -		DTC_FLAGS := -p 1024
> -		obj-y += foo.dtb.o
> +	A central rule exists to create $(obj)/%.dtb from $(src)/%.dts;
> +	architecture Makefiles do no need to explicitly write out that rule.
>  
> -		$(obj)/%.dtb: $(src)/%.dts
> -			$(call cmd,dtc)
> +	Example:
> +		targets += $(dtb-y)
> +		clean-files += *.dtb
> +		DTC_FLAGS ?= -p 1024
>  
>  --- 6.8 Custom kbuild commands
>  
> diff --git a/arch/mips/cavium-octeon/Makefile b/arch/mips/cavium-octeon/Makefile
> index bc96e29..6e927cf 100644
> --- a/arch/mips/cavium-octeon/Makefile
> +++ b/arch/mips/cavium-octeon/Makefile
> @@ -24,9 +24,6 @@ DTB_FILES = $(patsubst %.dts, %.dtb, $(DTS_FILES))
>  
>  obj-y += $(patsubst %.dts, %.dtb.o, $(DTS_FILES))
>  
> -$(obj)/%.dtb: $(src)/%.dts FORCE
> -	$(call if_changed_dep,dtc)
> -
>  # Let's keep the .dtb files around in case we want to look at them.
>  .SECONDARY:  $(addprefix $(obj)/, $(DTB_FILES))
>  
> diff --git a/arch/mips/lantiq/dts/Makefile b/arch/mips/lantiq/dts/Makefile
> index 674fca4..6fa72dd 100644
> --- a/arch/mips/lantiq/dts/Makefile
> +++ b/arch/mips/lantiq/dts/Makefile
> @@ -1,4 +1 @@
>  obj-$(CONFIG_DT_EASY50712) := easy50712.dtb.o
> -
> -$(obj)/%.dtb: $(obj)/%.dts
> -	$(call if_changed,dtc)
> diff --git a/arch/mips/netlogic/dts/Makefile b/arch/mips/netlogic/dts/Makefile
> index 67ae3fe2..d117d46 100644
> --- a/arch/mips/netlogic/dts/Makefile
> +++ b/arch/mips/netlogic/dts/Makefile
> @@ -1,4 +1 @@
>  obj-$(CONFIG_DT_XLP_EVP) := xlp_evp.dtb.o
> -
> -$(obj)/%.dtb: $(obj)/%.dts
> -	$(call if_changed,dtc)
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 0be6f11..bdf42fd 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -266,6 +266,9 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
>  quiet_cmd_dtc = DTC     $@
>  cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $<
>  
> +$(obj)/%.dtb: $(src)/%.dts FORCE
> +	$(call if_changed_dep,dtc)
> +
>  # Bzip2
>  # ---------------------------------------------------------------------------
>  
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule
  2012-11-30 16:01 ` Rob Herring
@ 2012-11-30 19:34   ` Stephen Warren
  2012-12-01  4:43   ` Max Filippov
  1 sibling, 0 replies; 21+ messages in thread
From: Stephen Warren @ 2012-11-30 19:34 UTC (permalink / raw)
  To: Rob Herring
  Cc: Michal Marek, Grant Likely, Sam Ravnborg, linux-kernel,
	linux-arch, Stephen Warren, Arnd Bergmann, linux-arm-kernel,
	Olof Johansson, Russell King, Catalin Marinas, Jonas Bonn, linux,
	Aurelien Jacquiot, linux-c6x-dev, Mark Salter, Michal Simek,
	microblaze-uclinux, Chris Zankel, linux-xtensa, Max Filippov,
	Ralf Baechle

On 11/30/2012 09:01 AM, Rob Herring wrote:
> On 11/27/2012 05:29 PM, Stephen Warren wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> All architectures that use cmd_dtc do so in almost the same way. Create
>> a central build rule to avoid duplication. The one difference is that
>> most current uses of dtc build $(obj)/%.dtb from $(src)/dts/%.dts rather
>> than building the .dtb in the same directory as the .dts file. This
>> difference will be eliminated arch-by-arch in future patches.
>>
>> MIPS is the exception here; it already uses the exact same rule as the
>> new common rule, so the duplicate is removed in this patch to avoid any
>> conflict. arch/mips changes courtesy of Ralf Baechle.
>>
>> Update Documentation/kbuild to remove the explicit call to cmd_dtc from
>> the example, now that the rule exists in a centralized location.
>>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: Olof Johansson <olof@lixom.net>
>> Cc: Russell King <linux@arm.linux.org.uk>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Jonas Bonn <jonas@southpole.se>
>> Cc: linux@lists.openrisc.net
>> Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
>> Cc: linux-c6x-dev@linux-c6x.org
>> Cc: Mark Salter <msalter@redhat.com>
>> Cc: Michal Simek <monstr@monstr.eu>
>> Cc: microblaze-uclinux@itee.uq.edu.au
>> Cc: Chris Zankel <chris@zankel.net>
>> Cc: linux-xtensa@linux-xtensa.org
>> Cc: Max Filippov <jcmvbkbc@gmail.com>
>> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>> This is based on next-20121126.
>>
> 
> I'll apply the series but I need a stable base. Looks like xtensa has
> the dependency. Or I can just drop xtensa.

I was assuming this series would be applied for 3.9, hence hadn't
rebased it onto anything stable yet. Are you wanting to apply it
earlier? If so, I'll look into how it fits on top of 3.7-rc7.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule
  2012-11-30 16:01 ` Rob Herring
  2012-11-30 19:34   ` Stephen Warren
@ 2012-12-01  4:43   ` Max Filippov
  1 sibling, 0 replies; 21+ messages in thread
From: Max Filippov @ 2012-12-01  4:43 UTC (permalink / raw)
  To: Rob Herring
  Cc: Stephen Warren, Michal Marek, Grant Likely, Sam Ravnborg,
	linux-kernel, linux-arch, Stephen Warren, Arnd Bergmann,
	linux-arm-kernel, Olof Johansson, Russell King, Catalin Marinas,
	Jonas Bonn, linux, Aurelien Jacquiot, linux-c6x-dev, Mark Salter,
	Michal Simek, microblaze-uclinux, Chris Zankel, linux-xtensa,
	Ralf Baechle

On Fri, Nov 30, 2012 at 8:01 PM, Rob Herring <robherring2@gmail.com> wrote:

[...]

>> This is based on next-20121126.
>
> I'll apply the series but I need a stable base. Looks like xtensa has
> the dependency. Or I can just drop xtensa.

Please drop it, I will follow up with a conversion.

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory
  2012-11-27 23:29 ` [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory Stephen Warren
  2012-11-27 23:50   ` Olof Johansson
@ 2012-12-03 16:15   ` Rob Herring
  2012-12-03 17:26     ` Stephen Warren
  2012-12-26 14:27   ` Shawn Guo
  2 siblings, 1 reply; 21+ messages in thread
From: Rob Herring @ 2012-12-03 16:15 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Michal Marek, Grant Likely, linux-arch, Russell King,
	Arnd Bergmann, linux-kernel, Olof Johansson, Stephen Warren,
	Sam Ravnborg, linux-arm-kernel

On 11/27/2012 05:29 PM, Stephen Warren wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
> 
> The current rules have the .dtb files build in a different directory
> from the .dts files. The only reason for this is that it was what
> PowerPC has done historically. This patch changes ARM to use the generic
> dtb rule which builds .dtb files in the same directory as the source .dts.

[snip]

> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index a17d5ab..cb217f8 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -136,4 +136,12 @@ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
>  	wm8650-mid.dtb
>  dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb
>  
> +targets += dtbs
>  endif
> +
> +dtbs: $(addprefix $(obj)/, $(dtb-y))
> +	# *.dtb used to be generated in the directory above. Clean out the
> +	# old build results so people don't accidentally use them.
> +	rm -f $(obj)/../*.dtb

Do you intend for this to print out? Seems a little noisy to me for a
one-time problem. Are you trying to tell users the dtb files moved or
just prevent them from using the old ones? Quietly removing them would
still accomplish the latter.

Rob

> +
> +clean-files := *.dtb
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory
  2012-12-03 16:15   ` Rob Herring
@ 2012-12-03 17:26     ` Stephen Warren
  0 siblings, 0 replies; 21+ messages in thread
From: Stephen Warren @ 2012-12-03 17:26 UTC (permalink / raw)
  To: Rob Herring
  Cc: Michal Marek, Grant Likely, linux-arch, Russell King,
	Arnd Bergmann, linux-kernel, Olof Johansson, Stephen Warren,
	Sam Ravnborg, linux-arm-kernel

On 12/03/2012 09:15 AM, Rob Herring wrote:
> On 11/27/2012 05:29 PM, Stephen Warren wrote:
>> From: Grant Likely <grant.likely@secretlab.ca>
>>
>> The current rules have the .dtb files build in a different directory
>> from the .dts files. The only reason for this is that it was what
>> PowerPC has done historically. This patch changes ARM to use the generic
>> dtb rule which builds .dtb files in the same directory as the source .dts.
> 
> [snip]
> 
>> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
>> index a17d5ab..cb217f8 100644
>> --- a/arch/arm/boot/dts/Makefile
>> +++ b/arch/arm/boot/dts/Makefile
>> @@ -136,4 +136,12 @@ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
>>  	wm8650-mid.dtb
>>  dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb
>>  
>> +targets += dtbs
>>  endif
>> +
>> +dtbs: $(addprefix $(obj)/, $(dtb-y))
>> +	# *.dtb used to be generated in the directory above. Clean out the
>> +	# old build results so people don't accidentally use them.
>> +	rm -f $(obj)/../*.dtb
> 
> Do you intend for this to print out? Seems a little noisy to me for a
> one-time problem. Are you trying to tell users the dtb files moved or
> just prevent them from using the old ones? Quietly removing them would
> still accomplish the latter.

Oh, I just wasn't thinking; I guess this should be @rm or similar. Will
you fix this up locally since you've applied the patches?

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 3/7] arm64: use new common dtc rule
  2012-11-29 14:30   ` Catalin Marinas
@ 2012-12-03 17:27     ` Stephen Warren
  0 siblings, 0 replies; 21+ messages in thread
From: Stephen Warren @ 2012-12-03 17:27 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Michal Marek, Grant Likely, rob.herring, Sam Ravnborg,
	linux-kernel, linux-arch, Stephen Warren, linux-arm-kernel

On 11/29/2012 07:30 AM, Catalin Marinas wrote:
> On Tue, Nov 27, 2012 at 11:29:12PM +0000, Stephen Warren wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> The current rules have the .dtb files build in a different directory
>> from the .dts files. This patch changes arm64 to use the generic dtb
>> rule which builds .dtb files in the same directory as the source .dts.
>>
>> This requires moving parts of arch/arm64/boot/Makefile into newly created
>> arch/arm64/boot/dts/Makefile, and updating arch/arm64/Makefile to call the
>> new Makefile.
>>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> 
> I had a bit more clean-up in a local patch (see attached). Depending on
> the timing, you can just fold it into your patch (basically removing the
> MACHINE argument, adding KBUILD_DTBS and dtbs target help). It's been
> derived from your arch/arm patch anyway ;).

Thanks. Just to follow up on this, Rob has applied the series (minus
Xtensa) to a local tree, I believe intending to take it for 3.8(?), and
has included a modified version of this patch there (i.e. rebased onto
my series and hence slightly adjusted for it).

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory
  2012-11-27 23:29 ` [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory Stephen Warren
  2012-11-27 23:50   ` Olof Johansson
  2012-12-03 16:15   ` Rob Herring
@ 2012-12-26 14:27   ` Shawn Guo
  2012-12-29  0:43     ` Stephen Warren
  2 siblings, 1 reply; 21+ messages in thread
From: Shawn Guo @ 2012-12-26 14:27 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Michal Marek, Grant Likely, Rob Herring, Sam Ravnborg,
	linux-kernel, linux-arch, Russell King, Arnd Bergmann,
	Olof Johansson, linux-arm-kernel, Stephen Warren

On Tue, Nov 27, 2012 at 04:29:11PM -0700, Stephen Warren wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
> 
> The current rules have the .dtb files build in a different directory
> from the .dts files. The only reason for this is that it was what
> PowerPC has done historically. This patch changes ARM to use the generic
> dtb rule which builds .dtb files in the same directory as the source .dts.
> 
It's a pity that after merging the patch, all the enabled dts files
will be rebuilt anyway no matter whether they are actually changed
or not.

Shawn

> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Olof Johansson <olof@lixom.net>
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> [swarren: added rm command for old stale .dtb files]
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> v7: New patch.
> ---
>  arch/arm/Makefile          |    4 ++--
>  arch/arm/boot/Makefile     |   12 ------------
>  arch/arm/boot/dts/Makefile |    8 ++++++++
>  3 files changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 1ec5f67..5f92252 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -291,10 +291,10 @@ zinstall uinstall install: vmlinux
>  	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
>  
>  %.dtb: scripts
> -	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
> +	$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
>  
>  dtbs: scripts
> -	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
> +	$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs
>  
>  # We use MRPROPER_FILES and CLEAN_FILES now
>  archclean:
> diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
> index 9137df5..abfce28 100644
> --- a/arch/arm/boot/Makefile
> +++ b/arch/arm/boot/Makefile
> @@ -15,8 +15,6 @@ ifneq ($(MACHINE),)
>  include $(srctree)/$(MACHINE)/Makefile.boot
>  endif
>  
> -include $(srctree)/arch/arm/boot/dts/Makefile
> -
>  # Note: the following conditions must always be true:
>  #   ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
>  #   PARAMS_PHYS must be within 4MB of ZRELADDR
> @@ -59,16 +57,6 @@ $(obj)/zImage:	$(obj)/compressed/vmlinux FORCE
>  
>  endif
>  
> -targets += $(dtb-y)
> -
> -# Rule to build device tree blobs
> -$(obj)/%.dtb: $(src)/dts/%.dts FORCE
> -	$(call if_changed_dep,dtc)
> -
> -$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
> -
> -clean-files := *.dtb
> -
>  ifneq ($(LOADADDR),)
>    UIMAGE_LOADADDR=$(LOADADDR)
>  else
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index a17d5ab..cb217f8 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -136,4 +136,12 @@ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
>  	wm8650-mid.dtb
>  dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb
>  
> +targets += dtbs
>  endif
> +
> +dtbs: $(addprefix $(obj)/, $(dtb-y))
> +	# *.dtb used to be generated in the directory above. Clean out the
> +	# old build results so people don't accidentally use them.
> +	rm -f $(obj)/../*.dtb
> +
> +clean-files := *.dtb
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory
  2012-12-26 14:27   ` Shawn Guo
@ 2012-12-29  0:43     ` Stephen Warren
  0 siblings, 0 replies; 21+ messages in thread
From: Stephen Warren @ 2012-12-29  0:43 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Michal Marek, Grant Likely, Rob Herring, Sam Ravnborg,
	linux-kernel, linux-arch, Russell King, Arnd Bergmann,
	Olof Johansson, linux-arm-kernel, Stephen Warren

On 12/26/2012 07:27 AM, Shawn Guo wrote:
> On Tue, Nov 27, 2012 at 04:29:11PM -0700, Stephen Warren wrote:
>> From: Grant Likely <grant.likely@secretlab.ca>
>>
>> The current rules have the .dtb files build in a different directory
>> from the .dts files. The only reason for this is that it was what
>> PowerPC has done historically. This patch changes ARM to use the generic
>> dtb rule which builds .dtb files in the same directory as the source .dts.
>
> It's a pity that after merging the patch, all the enabled dts files
> will be rebuilt anyway no matter whether they are actually changed
> or not.

Oops. I thought I'd tested that quite extensively, but I somehow missed
something. I've sent patches to fix this.


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2012-12-29  0:43 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-27 23:29 [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Stephen Warren
2012-11-27 23:29 ` [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory Stephen Warren
2012-11-27 23:50   ` Olof Johansson
2012-12-03 16:15   ` Rob Herring
2012-12-03 17:26     ` Stephen Warren
2012-12-26 14:27   ` Shawn Guo
2012-12-29  0:43     ` Stephen Warren
2012-11-27 23:29 ` [PATCH V7 3/7] arm64: use new common dtc rule Stephen Warren
2012-11-29 14:30   ` Catalin Marinas
2012-12-03 17:27     ` Stephen Warren
2012-11-27 23:29 ` [PATCH V7 4/7] openrisc: " Stephen Warren
2012-11-27 23:29 ` [PATCH V7 5/7] c6x: " Stephen Warren
2012-11-28 18:09   ` Mark Salter
2012-11-27 23:29 ` [PATCH V7 6/7] microblaze: " Stephen Warren
2012-11-27 23:29 ` [PATCH V7 7/7] xtensa: " Stephen Warren
2012-11-28 17:44 ` [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule Catalin Marinas
2012-11-28 18:33 ` Stephen Warren
2012-11-28 23:28   ` Benjamin Herrenschmidt
2012-11-30 16:01 ` Rob Herring
2012-11-30 19:34   ` Stephen Warren
2012-12-01  4:43   ` Max Filippov

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).