Skip to content

Uotan-Dev/FirmwareKit.DT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FirmwareKit.DeviceTree

A comprehensive .NET library for parsing, editing, and manipulating Device Tree files (DTB, DTS, DTBO).

Features

  • Parse binary Device Tree Blob (DTB) files
  • Parse Device Tree Source (DTS) text format
  • Write/serialize Device Trees to both DTB and DTS formats
  • Apply Device Tree Overlays (DTBO)
  • Navigate and modify device tree structures
  • Memory reservation block support
  • Cross-platform support (.NET 8+, .NET 10, .NET Standard 2.0)

Quick Start

using FirmwareKit.DeviceTree;

// Load a DTB file
var tree = DeviceTree.LoadDtbFile("device.dtb");

// Or parse DTS text
var tree = DeviceTree.FromDts(File.ReadAllText("device.dts"));

// Navigate the tree
var model = tree.Root.Property("model")?.AsString();
var compatible = tree.Root.Property("compatible")?.AsStringList();
var serial = tree.FindNode("soc@0/serial@10000");

// Modify properties
serial?.SetPropertyString("status", "okay");

// Save back
tree.SaveDtbFile("modified.dtb");
tree.SaveDtsFile("modified.dts");

// Convert between formats
var dtbData = tree.ToDtb();
var dtsText = tree.ToDts();

// Apply overlays
var overlay = DeviceTree.LoadDtbFile("overlay.dtbo");
tree.ApplyOverlay(overlay);

Installation

dotnet add package FirmwareKit.DeviceTree

CLI Tool

The dttool command-line tool provides quick operations on Device Tree files:

# Show device tree info
dttool info device.dtb

# Convert between formats
dttool convert device.dtb device.dts
dttool convert device.dts device.dtb

# Dump as DTS text
dttool dump device.dtb

# Get node/property
dttool get device.dtb /soc@0/serial@10000
dttool get device.dtb /soc@0/serial@10000 status

# Set property
dttool set device.dtb /soc@0/serial@10000 status okay

# Display tree structure
dttool tree device.dtb

# Apply overlay
dttool overlay base.dtb overlay.dtbo --output=merged.dtb

# Validate
dttool validate device.dtb

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages