{"id":21040086,"url":"https://github.com/michael2012z/devicetree-tool","last_synced_at":"2026-03-10T02:31:52.145Z","repository":{"id":64327432,"uuid":"571099382","full_name":"michael2012z/devicetree-tool","owner":"michael2012z","description":"A device tree building and parsing tool with library in Rust","archived":false,"fork":false,"pushed_at":"2024-01-11T03:14:39.000Z","size":89,"stargazers_count":6,"open_issues_count":6,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-15T16:43:01.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michael2012z.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-27T06:34:49.000Z","updated_at":"2025-05-14T16:32:13.000Z","dependencies_parsed_at":"2024-11-19T13:45:17.023Z","dependency_job_id":"7ad4ecb4-1ef0-4bb9-858c-11beff67f3a8","html_url":"https://github.com/michael2012z/devicetree-tool","commit_stats":{"total_commits":91,"total_committers":2,"mean_commits":45.5,"dds":0.01098901098901095,"last_synced_commit":"1a29aec535868080c2b29487c339aa8c608627f9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michael2012z/devicetree-tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael2012z%2Fdevicetree-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael2012z%2Fdevicetree-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael2012z%2Fdevicetree-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael2012z%2Fdevicetree-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michael2012z","download_url":"https://codeload.github.com/michael2012z/devicetree-tool/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michael2012z%2Fdevicetree-tool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30322645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T01:36:58.598Z","status":"online","status_checked_at":"2026-03-10T02:00:06.579Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T13:44:48.224Z","updated_at":"2026-03-10T02:31:52.112Z","avatar_url":"https://github.com/michael2012z.png","language":"Rust","readme":"# devicetree-tool\n\nA device tree building and parsing tool written in Rust\n\n## General\n\n**This project is in early stage and should not be used with production workloads.**\n\n`devicetree-tool` is both:\n- A Rust crate that can be used for manipulating device trees\n- A command line tool based on the crate that can be used to encode and decode device tree files\n\nThe center of `devicetree-tool` is the meta data consisting the device tree:\n- `DeviceTree` - The top level structure of the device tree meta data\n- `Node` - A node in the device tree, representing a device\n- `Property` - A property item of the device node\n- `Reservation` - Physical memeory reservation block of the device tree\n\nThe device tree meta data can be created from the source code, or be built from the content of DTS or DTB files. The meta data can also be managed in source code, or be encoded to DTS or DTB format.\n\n## `devicetree-tool` Crate\n\n### Examples\n\nCreate a device tree from scratch:\n\n``` rust\nuse devicetree_tool::Node;\nuse devicetree_tool::DeviceTree;\n\nfn main() {\n    // Create the root node\n    let mut node = Node::new(\"\");\n\n    // Add a property\n    node.add_property(Property::new_u32(\"prop\", 42));\n\n    // Add a sub node\n    node.add_sub_node(Node::new(\"sub_node\"));\n\n    // Create the device tree from the root node\n    let tree = DeviceTree::new(vec![], node);\n\n    assert_eq!(\n        format!(\"{}\", tree),\n        \"/dts-v1/;\\n\\n/ {\\n\\tprop = \u003c0x0 0x0 0x0 0x2a\u003e;\\\n        \\n\\n\\tsub_node {\\n\\t};\\n};\\n\\n\"\n    );\n}\n```\n\n## `devicetree-tool` Crate\n\n### Examples\n\nEncode a DTS file to DTB:\n\n``` bash\n# Build devicetree-tool\ncargo build --release\n\n# Create a simple DTS file\ncat \u003c\u003c EOF \u003e ./temp.dts\n/dts-v1/;\n\n/ {\n\tcpus {\n\t\t#address-cells = \u003c0x02\u003e;\n\t\t#size-cells = \u003c0x00\u003e;\n\n\t\tcpu@0 {\n\t\t\tdevice_type = \"cpu\";\n\t\t\tcompatible = \"arm,arm-v8\";\n\t\t\tenable-method = \"psci\";\n\t\t\treg = \u003c0x00 0x00\u003e;\n\t\t};\n\t};\n};\nEOF\n\n# Decode the DTS file into DTB\n./target/release/devicetree-tool \\\n    --in-type dts --in-file ./temp.dts \\\n    --out-type dtb --out-file ./temp.dtb\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichael2012z%2Fdevicetree-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichael2012z%2Fdevicetree-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichael2012z%2Fdevicetree-tool/lists"}