Re: [PATCH V8] kbuild: create a rule to run the pre-processor on*.dts files

From: Grant Likely
Date: Fri Feb 08 2013 - 15:51:15 EST

On Fri, Feb 8, 2013 at 5:18 PM, Stephen Warren <swarren@xxxxxxxxxxxxx> wrote:
> On 02/08/2013 07:45 AM, Grant Likely wrote:
>> On Tue, 5 Feb 2013 12:06:28 -0700, Stephen Warren <swarren@xxxxxxxxxxxxx> wrote:
>>> From: Stephen Warren <swarren@xxxxxxxxxx>
>>> Create cmd_dtc_cpp to run the C pre-processor on *.dts file before
>>> passing them to dtc for final compilation. This allows the use of #define
>>> and #include within the .dts file.
>>> Acked-by: Simon Glass <sjg@xxxxxxxxxxxx>
>>> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@xxxxxxxxxxxx>
>>> Acked-by: Michal Marek <mmarek@xxxxxxx>
>>> Acked-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxx>
>>> Signed-off-by: Stephen Warren <swarren@xxxxxxxxxx>
>> I've applied this and was going to push it out, but I've just thought of
>> a problem that could be a show stopper. Once a dtsp file includes a C
>> header, the contents of that header become part of the Device Tree ABI.
>> If someone changes that file (ie. to renumber a series of #defines) then
>> that will break the binding. We need a way to protect against that.
>> Someone changing a .h file may make the assumption that it is only
>> kernel internal and won't realize that it has external implications.
>> I'm thinking that any dts includes need to be treated in the same way as
>> userspace headers. We could put them into include/uapi and piggy back on
>> the protection already afforded by that directory, or come up with
>> something new. Any thoughts?
> Yes, that's true.
> What protection is provided by include/uapi - something programmatic or
> simply stricter review?

I believe there are tools that parse the userspace ABI and flag
incompatibilities, but also stricter review.

> I wondered if we shouldn't put the headers into the .dts directory, then
> update the kernel to include them too. That would also make it obvious
> they were part of the DT ABI.

That would also help be good. In either case the CPP options need to
only include the ABI headers. No normal headers allowed.


Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at