views:

38

answers:

1

I am looking to create a utility that validates Embedded (PPC or ARM) Linux *.dts (device tree source) or *.dtb (binary) files against an XML configuration file from another tool. So, I need to parse the dts or dtb files. I would really like to do this with Python. Does anyone know of a Python library or tool out there that parses dts or dtb files? A Python implementation of the device tree compiler (dtc) would be perfect, but I've not seen one yet.

A: 

There is no python binding for libfdt (the device tree manipulation library shipped with dtc) yet, but it should be fairly straightforward to create one.

If you're interested in doing this, the Python docs have a bit about extending python using c modules: http://docs.python.org/release/2.6/extending/extending.html . The swig utility can be used to automatically create the Python-to-C interface, so you just end up writing a small swig configuration file.

If you do end up doing this, send the folks at [email protected] an email - we'd be keen to hear how you go!

Jeremy Kerr