8

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?

Stéphane
  • 19,459
  • 24
  • 95
  • 136

1 Answers1

12

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.

Stéphane
  • 19,459
  • 24
  • 95
  • 136