Stéphane
Stéphane

Reputation: 20340

API to read the device tree from userspace

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?

Upvotes: 8

Views: 5291

Answers (1)

Stéphane
Stéphane

Reputation: 20340

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.

Upvotes: 12

Related Questions