* [PATCH V3 0/2] dtc: enable use of pre-processor
@ 2012-10-01 15:45 Stephen Warren
2012-10-01 15:45 ` [PATCH V3 1/2] kbuild: centralize .dts->.dtb rule Stephen Warren
2012-10-01 15:45 ` [PATCH V3 2/2] kbuild: introduce cmd_dtc_cpp Stephen Warren
0 siblings, 2 replies; 3+ messages in thread
From: Stephen Warren @ 2012-10-01 15:45 UTC (permalink / raw)
To: Michal Marek
Cc: linux-kbuild, David Gibson, Jon Loeliger, Grant Likely,
Rob Herring, Scott Wood, Mark Brown,
Jean-Christophe PLAGNIOL-VILLARD, devicetree-discuss,
linux-kernel, linux-arch, Stephen Warren
From: Stephen Warren <swarren@nvidia.com>
This series adds a build rule to run cpp on *.dtsp prior to invoking dtc.
This patch relies on the patch I recently posted to update the in-kernel
copy of dtc to match the latest upstream version ("[PATCH] dtc: import
latest upstream dtc"; http://www.spinics.net/lists/kernel/msg1410063.html.
Stephen Warren (2):
kbuild: centralize .dts->.dtb rule
kbuild: introduce cmd_dtc_cpp
arch/arm/boot/Makefile | 4 ----
arch/arm/boot/dts/skeleton.dtsip | 13 +++++++++++++
arch/c6x/boot/Makefile | 3 ---
arch/openrisc/boot/Makefile | 3 ---
arch/powerpc/boot/Makefile | 4 ----
scripts/Makefile.lib | 9 +++++++++
6 files changed, 22 insertions(+), 14 deletions(-)
create mode 100644 arch/arm/boot/dts/skeleton.dtsip
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH V3 1/2] kbuild: centralize .dts->.dtb rule
2012-10-01 15:45 [PATCH V3 0/2] dtc: enable use of pre-processor Stephen Warren
@ 2012-10-01 15:45 ` Stephen Warren
2012-10-01 15:45 ` [PATCH V3 2/2] kbuild: introduce cmd_dtc_cpp Stephen Warren
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2012-10-01 15:45 UTC (permalink / raw)
To: Michal Marek
Cc: linux-kbuild, David Gibson, Jon Loeliger, Grant Likely,
Rob Herring, Scott Wood, Mark Brown,
Jean-Christophe PLAGNIOL-VILLARD, devicetree-discuss,
linux-kernel, linux-arch, Stephen Warren
From: Stephen Warren <swarren@nvidia.com>
All architectures that use cmd_dtc do so in the same way. Move the build
rule to a central location to avoid duplication.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v3: No change.
v2: New patch.
---
arch/arm/boot/Makefile | 4 ----
arch/c6x/boot/Makefile | 3 ---
arch/openrisc/boot/Makefile | 3 ---
arch/powerpc/boot/Makefile | 4 ----
scripts/Makefile.lib | 3 +++
5 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index 3fdab01..da33331 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -61,10 +61,6 @@ 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
diff --git a/arch/c6x/boot/Makefile b/arch/c6x/boot/Makefile
index 6891257..ad605fb 100644
--- a/arch/c6x/boot/Makefile
+++ b/arch/c6x/boot/Makefile
@@ -12,9 +12,6 @@ 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)
diff --git a/arch/openrisc/boot/Makefile b/arch/openrisc/boot/Makefile
index 0995835..fd329bd 100644
--- a/arch/openrisc/boot/Makefile
+++ b/arch/openrisc/boot/Makefile
@@ -10,6 +10,3 @@ obj-y += $(BUILTIN_DTB)
clean-files := *.dtb.S
#DTC_FLAGS ?= -p 1024
-
-$(obj)/%.dtb: $(src)/dts/%.dts FORCE
- $(call if_changed_dep,dtc)
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 6a15c96..90206f2 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -356,10 +356,6 @@ $(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
$(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
$(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb)
-# Rule to build device tree blobs
-$(obj)/%.dtb: $(src)/dts/%.dts FORCE
- $(call if_changed_dep,dtc)
-
# If there isn't a platform selected then just strip the vmlinux.
ifeq (,$(image-y))
image-y := vmlinux.strip
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 0be6f11..425578e 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/%.dts FORCE
+ $(call if_changed_dep,dtc)
+
# Bzip2
# ---------------------------------------------------------------------------
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH V3 2/2] kbuild: introduce cmd_dtc_cpp
2012-10-01 15:45 [PATCH V3 0/2] dtc: enable use of pre-processor Stephen Warren
2012-10-01 15:45 ` [PATCH V3 1/2] kbuild: centralize .dts->.dtb rule Stephen Warren
@ 2012-10-01 15:45 ` Stephen Warren
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2012-10-01 15:45 UTC (permalink / raw)
To: Michal Marek
Cc: linux-kbuild, David Gibson, Jon Loeliger, Grant Likely,
Rob Herring, Scott Wood, Mark Brown,
Jean-Christophe PLAGNIOL-VILLARD, devicetree-discuss,
linux-kernel, linux-arch, Stephen Warren
From: Stephen Warren <swarren@nvidia.com>
cmd_dtc_cpp runs the C pre-processor on the input .dts file before
passing it to dtc for final compilation. This allows used of #define
within the .dts file.
Introduce a new rule for %.dtsp -> %.dtb, which uses cmd_dtc_cpp. A new
file extension is introduced for this purpose, since use of the pre-
processor must be optional; any property or node name that starts with
"#" must be escaped to prevent the pre-processor attempting to interpret
it as a directive. For this reason, skeleton.dtsi-cpp is introduced for
*.dts-cpp to include.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v3: Pass "-x c" not "-xc" to cpp.
v2: Place make %.dtb: %.dtsp rule into Makefile.lib.
---
arch/arm/boot/dts/skeleton.dtsip | 13 +++++++++++++
scripts/Makefile.lib | 6 ++++++
2 files changed, 19 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/boot/dts/skeleton.dtsip
diff --git a/arch/arm/boot/dts/skeleton.dtsip b/arch/arm/boot/dts/skeleton.dtsip
new file mode 100644
index 0000000..8bf6729
--- /dev/null
+++ b/arch/arm/boot/dts/skeleton.dtsip
@@ -0,0 +1,13 @@
+/*
+ * Skeleton device tree; the bare minimum needed to boot; just include and
+ * add a compatible value. The bootloader will typically populate the memory
+ * node.
+ */
+
+/ {
+ \#address-cells = <1>;
+ \#size-cells = <1>;
+ chosen { };
+ aliases { };
+ memory { device_type = "memory"; reg = <0 0>; };
+};
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 425578e..1980078 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -269,6 +269,12 @@ cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile
$(obj)/%.dtb: $(src)/dts/%.dts FORCE
$(call if_changed_dep,dtc)
+quiet_cmd_dtc_cpp = DTC+CPP $@
+cmd_dtc_cpp = $(CC) -E -Wp,-MD,$(depfile) -x c $< | $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -
+
+$(obj)/%.dtb: $(src)/dts/%.dtsp FORCE
+ $(call if_changed_dep,dtc_cpp)
+
# Bzip2
# ---------------------------------------------------------------------------
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-01 15:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-01 15:45 [PATCH V3 0/2] dtc: enable use of pre-processor Stephen Warren
2012-10-01 15:45 ` [PATCH V3 1/2] kbuild: centralize .dts->.dtb rule Stephen Warren
2012-10-01 15:45 ` [PATCH V3 2/2] kbuild: introduce cmd_dtc_cpp Stephen Warren
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).