On 10/25/19 12:11 PM, Dobrowolski, Lukasz (Nokia - PL/Wroclaw) wrote: > On 10/23/19 4:45 PM, Rob Herring wrote: >> Yes, but would like to understand the use better. >> >> What problem are you trying to solve that fdtget doesn't work? Perhaps >> it is too slow? Loss of type information (the little we have)? > > Unfortunately I don't know how much I'm allowed to tell about my main use case. > I don't think it's applicable outside the company I work for. > > I thought that someone might find tool like this useful, because while working with dts files, > from time to time, I used to find myself lacking convenience of a tool > that would print a node(maybe recursively) or property from dts. > I don't find grep and vim as convenient, especially if the inclusion graph isn't small. > > On 10/24/19 5:13 AM, David Gibson wrote: >> It would be pretty easy to write a script that runs dtc to compile the >> dts, then fdtget to pull out the property you want. >> >> The difficulty with doing something equivalent for dts directly is >> that it essentially needs to include the whole dts parser. That then >> needs to be kept in sync with the version in dtc, which is kind of a >> pain. > > On 10/23/19 4:45 PM, Rob Herring wrote: >> With C preprocessor defines and include files, you still need to run >> the input through something right? Or you want to ignore include >> files? If not, you're still going to need the front end of dtc at >> least. Then you need either some output format or to tap into dtc's In the Linux kernel source tree, scripts/dtc/dtx_diff will do this work when you provide it a single file as input. -Frank >> livetree C structure. The checks code in dtc does the latter. I've >> hacked up dtc checks before to dump out things like all compatible >> strings when building a tree of dts files. Something I'd like to do is >> make that plug-able such that we could have multiple checks modules >> including ones in python. This would make it easier to add in the DT >> schema checking to dtc. Or maybe another way to approach it is making >> the dts->livetree parsing a library. > > Yes, preprocessing is needed for this application to be useful. > > At first I've just included dtc.h (and intended to split dtc's front end into a library and refactor when upstreaming) but approach with a script is much simpler and would still work for me. > > To me either is fine. I can separate out dts->livetree into a lib and make an app that uses it, > or write a script that uses dtc and fdtget as You suggest. > > Let me know if this is compelling enough for inclusion in the repo and if so, which implementation approach You'd find more preferable. > > -- > Łukasz Dobrowolski >