[PATCH V7 1/7] kbuild: centralize .dts->.dtb rule

Subsystems: documentation, kernel build + files below scripts/ (unless maintained elsewhere), mips, the rest

STALE4965d

14 messages, 6 authors, 2012-12-29 · open the first message on its own page

[PATCH V7 1/7] kbuild: centralize .dts->.dtb rule

From: Stephen Warren <hidden>
Date: 2012-11-27 23:29:34

From: Stephen Warren <redacted>

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 at lists.infradead.org
Cc: Olof Johansson <redacted>
Cc: Russell King <redacted>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: linux at lists.openrisc.net
Cc: Aurelien Jacquiot <redacted>
Cc: linux-c6x-dev at linux-c6x.org
Cc: Mark Salter <redacted>
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux at itee.uq.edu.au
Cc: Chris Zankel <chris@zankel.net>
Cc: linux-xtensa at linux-xtensa.org
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Ralf Baechle <redacted>
Signed-off-by: Stephen Warren <redacted>
---
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

[PATCH V7 3/7] arm64: use new common dtc rule

From: Stephen Warren <hidden>
Date: 2012-11-27 23:29:36

From: Stephen Warren <redacted>

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 at lists.infradead.org
Signed-off-by: Stephen Warren <redacted>
---
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

Re: [PATCH V7 3/7] arm64: use new common dtc rule

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2012-11-29 14:30:51

On Tue, Nov 27, 2012 at 11:29:12PM +0000, Stephen Warren wrote:
From: Stephen Warren <redacted>

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 at lists.infradead.org
Signed-off-by: Stephen Warren <redacted>
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-arm64-Add-dtbs-target-for-building-all-the-enabled-d.patch
Type: text/x-diff
Size: 2975 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121129/742bd030/attachment.bin>

Re: [PATCH V7 3/7] arm64: use new common dtc rule

From: Stephen Warren <hidden>
Date: 2012-12-03 17:27:51

On 11/29/2012 07:30 AM, Catalin Marinas wrote:
On Tue, Nov 27, 2012 at 11:29:12PM +0000, Stephen Warren wrote:
quoted
From: Stephen Warren <redacted>

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 at lists.infradead.org
Signed-off-by: Stephen Warren <redacted>
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).

[PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory

From: Stephen Warren <hidden>
Date: 2012-11-27 23:31:58

From: Grant Likely <redacted>

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 <redacted>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Olof Johansson <redacted>
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Grant Likely <redacted>
[swarren: added rm command for old stale .dtb files]
Signed-off-by: Stephen Warren <redacted>
---
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

Re: [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory

From: Olof Johansson <hidden>
Date: 2012-11-27 23:50:40

On Tue, Nov 27, 2012 at 3:29 PM, Stephen Warren [off-list ref] wrote:
From: Grant Likely <redacted>

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 <redacted>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Olof Johansson <redacted>
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Grant Likely <redacted>
[swarren: added rm command for old stale .dtb files]
Signed-off-by: Stephen Warren <redacted>
Acked-by: Olof Johansson <redacted>

Re: [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory

From: Rob Herring <hidden>
Date: 2012-12-03 16:15:48

On 11/27/2012 05:29 PM, Stephen Warren wrote:
From: Grant Likely <redacted>

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]
quoted hunk
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

Re: [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory

From: Stephen Warren <hidden>
Date: 2012-12-03 17:26:33

On 12/03/2012 09:15 AM, Rob Herring wrote:
On 11/27/2012 05:29 PM, Stephen Warren wrote:
quoted
From: Grant Likely <redacted>

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]
quoted
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?

Re: [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory

From: Shawn Guo <hidden>
Date: 2012-12-26 14:28:53

On Tue, Nov 27, 2012 at 04:29:11PM -0700, Stephen Warren wrote:
From: Grant Likely <redacted>

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
quoted hunk
Cc: Russell King <redacted>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Olof Johansson <redacted>
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Grant Likely <redacted>
[swarren: added rm command for old stale .dtb files]
Signed-off-by: Stephen Warren <redacted>
---
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 at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Re: [PATCH V7 2/7] ARM: dt: change .dtb build rules to build in dts directory

From: Stephen Warren <hidden>
Date: 2012-12-29 00:43:42

On 12/26/2012 07:27 AM, Shawn Guo wrote:
On Tue, Nov 27, 2012 at 04:29:11PM -0700, Stephen Warren wrote:
quoted
From: Grant Likely <redacted>

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.

Re: [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2012-11-28 17:44:35

On Tue, Nov 27, 2012 at 11:29:10PM +0000, Stephen Warren wrote:
From: Stephen Warren <redacted>

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 at lists.infradead.org
Cc: Olof Johansson <redacted>
Cc: Russell King <redacted>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: linux at lists.openrisc.net
Cc: Aurelien Jacquiot <redacted>
Cc: linux-c6x-dev at linux-c6x.org
Cc: Mark Salter <redacted>
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux at itee.uq.edu.au
Cc: Chris Zankel <chris@zankel.net>
Cc: linux-xtensa at linux-xtensa.org
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Ralf Baechle <redacted>
Signed-off-by: Stephen Warren <redacted>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>

Re: [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule

From: Rob Herring <hidden>
Date: 2012-11-30 16:01:57

On 11/27/2012 05:29 PM, Stephen Warren wrote:
From: Stephen Warren <redacted>

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 at lists.infradead.org
Cc: Olof Johansson <redacted>
Cc: Russell King <redacted>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: linux at lists.openrisc.net
Cc: Aurelien Jacquiot <redacted>
Cc: linux-c6x-dev at linux-c6x.org
Cc: Mark Salter <redacted>
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux at itee.uq.edu.au
Cc: Chris Zankel <chris@zankel.net>
Cc: linux-xtensa at linux-xtensa.org
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Ralf Baechle <redacted>
Signed-off-by: Stephen Warren <redacted>
---
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
quoted hunk
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
 # ---------------------------------------------------------------------------
 

Re: [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule

From: Stephen Warren <hidden>
Date: 2012-11-30 19:34:33

On 11/30/2012 09:01 AM, Rob Herring wrote:
On 11/27/2012 05:29 PM, Stephen Warren wrote:
quoted
From: Stephen Warren <redacted>

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 at lists.infradead.org
Cc: Olof Johansson <redacted>
Cc: Russell King <redacted>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: linux at lists.openrisc.net
Cc: Aurelien Jacquiot <redacted>
Cc: linux-c6x-dev at linux-c6x.org
Cc: Mark Salter <redacted>
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux at itee.uq.edu.au
Cc: Chris Zankel <chris@zankel.net>
Cc: linux-xtensa at linux-xtensa.org
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Ralf Baechle <redacted>
Signed-off-by: Stephen Warren <redacted>
---
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.

Re: [PATCH V7 1/7] kbuild: centralize .dts->.dtb rule

From: Max Filippov <jcmvbkbc@gmail.com>
Date: 2012-12-01 04:43:23

On Fri, Nov 30, 2012 at 8:01 PM, Rob Herring [off-list ref] wrote:

[...]
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help