Is there an API to read the Open-Firmware device tree from userspace?
For example, reading /sys/firmware/fdt (flattened device tree)?
If not, is the file format published so a userspace application can read entries from the fdt?
A: U-boot allows the user to load a Device Tree Overlay and apply it on the base Device Tree Blob just before booting Linux, thus making it transparent for Linux (Linux will see just one Device Tree Blob like it expects).
There are few tools: visualize FDT/DTB/DTBO -> https://github.com/dev-0x7C6/fdt-viewer. visualize DTS (dead) -> https://github.com/TheCodeArtist/dtv-demo. visualize DTS (my fork) -> https://github.com/bmx666/dtv-demo.
3.3 Phandle More simply put, it is a property in one node that contains a pointer to another node. A phandle is created either by the device tree compiler or U-Boot for each label. In the following example, <&label> is converted to the phandle for the labeled node by the DTC. name@address {
This is easier than I first thought. On devices that support Open-Firmware, the linux kernel mounts it as a virtual filesystem at /proc/device-tree/
.
In my case, on the systems I happened to be checking, this was a symbolic link to /sys/firmware/devicetree/base
. But either way, walking through the files and directories in /proc/device-tree/
is relatively easy to do, regardless of the language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With