Skip to contentSkip to conversation

Parsing DTS file

DISCUSSION Guillaume Dargaud 3 participants 3 messages Oct 18, 2010

lore
Share & tools
lore
#0 lore raw

Hello all,
I'm sure there's a standard way of doing this: I'd like to access some info from the DTS file from a usermode program (things like address of device, etc...)
What is the best way to do this ? Write a parser ? Or query the running kernel somehow ?

Signature · 2 lines
Guillaume Dargaud
http://www.gdargaud.net/
#1 lore raw
Quoted 6 lines · Guillaume Dargaud

Hello all,
I'm sure there's a standard way of doing this: I'd like to access some info from the DTS file from a usermode program (things like address of device, etc...)
What is the best way to do this ? Write a parser ? Or query the running kernel somehow ?

Um.. this question doesn't seem to make a lot of sense. What's the context in which you're trying to do this.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#2 lore raw
In reply to Guillaume Dargaud
Quoted 2 lines

Hello all,
I'm sure there's a standard way of doing this: I'd like to access some =

info=20

Quoted 1 line

from the DTS file from a usermode program (things like address of =

device,=20

Quoted 2 lines

etc...)
What is the best way to do this ? Write a parser ? Or query the running =

kernel=20

Quoted 1 line

somehow ?

Compile your kernel with CONFIG_PROC_DEVICETREE, then you can access all = entries via filesystem:

[root@t:~] # ll /proc/device-tree/

-r--r--r--  1 root root  4 Oct 18 17:17 #address-cells
-r--r--r--  1 root root  4 Oct 18 17:17 #size-cells
dr-xr-xr-x  2 root root  0 Oct 18 17:17 chosen
-r--r--r--  1 root root 13 Oct 18 17:17 compatible
dr-xr-xr-x  3 root root  0 Oct 18 17:17 cpus
-r--r--r--  1 root root 13 Oct 18 17:17 dtb-revision
-r--r--r--  1 root root  4 Oct 18 17:17 interrupt-parent
dr-xr-xr-x  8 root root  0 Oct 18 17:17 localbus
dr-xr-xr-x  2 root root  0 Oct 18 17:17 memory
-r--r--r--  1 root root  5 Oct 18 17:17 model
-r--r--r--  1 root root  1 Oct 18 17:17 name
dr-xr-xr-x  2 root root  0 Oct 18 17:17 pci@f0000d00
-r--r--r--  1 root root  9 Oct 18 17:17 serialno

dr-xr-xr-x 32 root root 0 Oct 18 17:17 soc5200@f0000000

--=20
Ivo Schenk
http://www.delphin.de/

Delphin Technology AG
Sitz der Gesellschaft: Bergisch Gladbach
Registergericht: Amtsgericht Koeln, HRB 47544
Vorstand: Ursula Renner (Vorsitzende), Frank Ringsdorf Vorsitzender des Aufsichtsrats: Peter Renner