Thread (6 messages) 6 messages, 2 authors, 2012-11-14

Re: [PATCH V6 2/2] kbuild: run the pre-processor on *.dts files

From: Stephen Warren <hidden>
Date: 2012-11-14 20:18:30
Also in: linux-arch, lkml

On 11/14/2012 12:25 PM, Grant Likely wrote:
On Mon, 12 Nov 2012 13:58:27 -0700, Stephen Warren [off-list ref] wrote:
quoted
From: Stephen Warren <redacted>

Modify cmd_dtc to run the C pre-processor on the input .dts file before
passing it to dtc for final compilation. This allows the use of #define
and #include within the .dts file.
Ugh, I'm definitely nervous about turning this on because of the long
term implications so I'm going to punt on actually making a decision
about it for the momemnt. However, I do have a question...
Hmmm. So how do we get to a decision on this then?
quoted
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 425578e..33432f4 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -269,6 +269,15 @@ 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)
 
+dtc-tmp = $(subst $(comma),_,$(dot-target).dts)
+
+quiet_cmd_dtc_cpp = DTC+CPP $@
+cmd_dtc_cpp = $(CPP) $(cpp_flags) -D__DTS__ -x assembler-with-cpp -o $(dtc-tmp) $< ; \
+	$(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $(dtc-tmp)
+
+$(obj)/%.dtb: $(src)/dts/%.dtsp FORCE
+	$(call if_changed_dep,dtc_cpp)
Why this instead of a "%.dts: %.dtsp" rule? Then the exact same dtc rule
gets used in both cases.

The .dtb rule is probably already rather oddball in that it puts the
output one directory below the input. That probably should be cleaned
up.
I was a little nervous about potentially having some *.dts be primary
source files, and others be derived from *.dtsp (assuming that we
convert platforms to this new feature as desired, rather than en-mass).
It seems like it'd just cause confusion; people might just end up
accidentally editing a *.dts that was generated without realizing it.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help