| Crates.io | libfdt-rs |
| lib.rs | libfdt-rs |
| version | 0.0.2 |
| created_at | 2025-07-23 03:49:18.375498+00 |
| updated_at | 2025-07-23 04:34:26.200738+00 |
| description | A library for handling FDT binaries based on libfdt. |
| homepage | |
| repository | https://github.com/rmalmain/libfdt-rs |
| max_upload_size | |
| id | 1764332 |
| size | 430,142 |
libfdt-rs is a library for handling FDT binaries.
It uses libfdt under the hood.
As much as possible, the library avoids copying data. Nodes and properties are cheap references into the FDT binary in memory. Lifetime is property handled, avoiding some pitfalls met while manipulating FDT binaries.
Devicetree compliantThis crates aims at being compliant with the devicetree specification as much as possible.
This crate officially supports the devicetree specification v0.4.
The crate handles special properties used by the Linux kernel. It makes it easy to retrieve phandle links between subnodes, as detected by the Linux kernel.
no_std compatibleThe crate is fully compatible with no_std.
Here is a short example, printing all the subnodes and the properties of the root node.
use std::fs;
use libfdt_rs::Fdt;
fn main() {
let fdt_bin = fs::read("dtb/zuma-a0-foplp.dtb").unwrap();
let fdt = Fdt::new(fdt_bin.into_boxed_slice()).unwrap();
let root_node = fdt.get_node("/").unwrap();
for subnode in root_node.subnodes_iter() {
println!("subnode:?");
}
for property in root_node.properties_iter() {
println!("subnode:?");
}
}