Cmdline FDT query tool
John Williams
john.williams at petalogix.com
Tue May 18 12:03:19 EST 2010
Hi Grant,
At ELC I mentioned a tool I'd written that basically hacked u-boot's
"fdt" command into a commandline util for querying DTBs. You can do
stuff like this:
$ fdt-tool system.dtp print
<dump entire DTB in text format>
$ fdt-tool system.dtb list /cpus/cpu at 0 xlnx,use-dcache
xlnx,use-dcache = <0x1>
and so on.
I wrote it four our PetaLinux distribution because we need our tools
to make decisions based on contents of device trees, but thought you
might like to look at it, see if it's more broadly useful (maybe could
be a candidate for scripts/ in the kernel for example).
It's pretty rough, I hacked it together in about 20 minutes and threw
in a readline interface so you can also use it interactively as well.
Possible enhancements would be
* clean up!
* support DTS input format (only DTB supported currently)
* Allow modifying and re-writing (current DTB is read-only)
It can also do some interesting things with u-boot FIT images - you
can basically crack out kernel, DTB or rootfs payloads from a FIT.
If it does go into the kernel then MicroBlaze arch would be an
immediate user, we have a few KCONFIG params that drive GCC cpuflag
options - for simpleImage targets we could pull these straight from
the DTS instead to avoid kernel/CPU mismatches. We could do it today
with sed/grep/awk etc, but it's ugly ugly ugly. A DTS-aware tool like
this would make it a no-brainer. I'm sure PPC could find some useful
things to do with it as well.
http://developer.petalogix.com/downloads/fdt-tool.tar.gz
Cheers,
John
--
John Williams, PhD, B.Eng, B.IT
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663 f: +61-7-30090663
More information about the devicetree-discuss
mailing list