4 stable releases

Uses old Rust 2015

1.1.0 Jun 28, 2016
1.0.3 Mar 20, 2016

#1254 in Hardware support

Download history 3307/week @ 2023-12-06 5213/week @ 2023-12-13 2999/week @ 2023-12-20 1909/week @ 2023-12-27 1812/week @ 2024-01-03 3130/week @ 2024-01-10 5145/week @ 2024-01-17 5096/week @ 2024-01-24 3983/week @ 2024-01-31 6109/week @ 2024-02-07 5716/week @ 2024-02-14 2041/week @ 2024-02-21 1610/week @ 2024-02-28 2929/week @ 2024-03-06 4665/week @ 2024-03-13 9560/week @ 2024-03-20

19,324 downloads per month
Used in dbs-boot

MIT license

13KB
257 lines

Parse flattened linux device trees

Device trees are used to describe a lot of hardware, especially in the ARM embedded world and are also used to boot Linux on these device. A device tree describes addresses and other attributes for many parts on these boards

This library allows parsing the so-called flattened device trees, which are the compiled binary forms of these trees.

To read more about device trees, check out the kernel docs. Some example device trees to try out are [the Raspberry Pi ones] (https://github.com/raspberrypi/firmware/tree/master/boot).

The library does not use std, just core.

Examples

fn main() {
    // read file into memory
    let mut input = fs::File::open("sample.dtb").unwrap();
    let mut buf = Vec::new();
    input.read_to_end(&mut buf).unwrap();

    let dt = device_tree::DeviceTree::load(buf.as_slice ()).unwrap();
    println!("{:?}", dt);
}

Load a device tree from a memory buffer.

No runtime deps