Parsing DTS file

Ivo Schenk ivo.schenk at delphin.de
Tue Oct 19 02:22:39 EST 2010


>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 ?

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

[root at 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 at 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 at f0000000

-- 
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


More information about the Linuxppc-dev mailing list