[OpenWrt-Devel] [PATCH v3] Add support for C-style in dtsi files

Jonas Gorski jogo at openwrt.org
Mon Dec 7 11:36:28 EST 2015


On 07.12.2015 17:16, Nikolay Martynov wrote:
> Sorry, I've missed those questions. Let me try answering them.
>
> Now also including the list.
>
> 2015-12-07 10:39 GMT-05:00 Jonas Gorski <jogo at openwrt.org>:
>> Hi,
>>
>> you still haven't answered my questions:
>>
>> On Mon, Dec 7, 2015 at 4:07 PM, Nikolay Martynov <mar.kolya at gmail.com> wrote:
>>> Current way of compuling dts files involves calling C preprocessor on
>>> main dts file only. This means that dtsi includes cannot have C-style includes.
>>
>> Why not? Shouldn't they get processed as well as long as they are
>> included with #include, not /include/? Can you give an example that
>> doesn't work?
>
> You are right and this will work.
> That being said, in my very humble opinion this seems somewhat odd to
> do this not in a way kernel does it. I.e. it is kind of confusing to
> introduce include syntax that is different from one used dts.
> Approach I'm suggesting covers all cases currently used in OpenWrt
> dts files and doesn't force one to use '#include' for dtsi.

Using #include is exactly how the kernel does it, see e.g:

http://lxr.free-electrons.com/source/arch/arm/boot/dts/armada-370.dtsi#L52
http://lxr.free-electrons.com/source/arch/metag/boot/dts/tz1090.dtsi
http://lxr.free-electrons.com/source/arch/mips/boot/dts/ingenic/jz4740.dtsi

(Yes there are examples where /include/ is used, but they are in the
minority and don't use any macros).

>>> This patch addresses this problem. It uses approach similar to one
>>> use in linux kernel: it preprocesses all dtsi's in current dir into
>>> tmp dir and then uses that tmp dir as include dir for main dts compilation.
>>
>> I can't find this code in the kernel at all. Can you please point that out?
> It's in scripts/Makefile.lib, look for cmd_dtc.

That one only produces a list of files the dts includes for Make to
know when to recompile the dts file, but it does not (pre-)process any
of the dependencies.

dtc itself is only invoced once per dts file (unless I'm misreading something).


Jonas
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list