NameDateSize

..26-Mar-20194 KiB

__init__.pyH A D30-Jan-20180

LICENCEH A D30-Jan-20189 KiB

pyfdt.pyH A D26-Mar-201937.8 KiB

README.mdH A D30-Jan-20182.1 KiB

README.md

1## pyfdt : Python Flattened Device Tree Manipulation ##
2----------
3The pyfdt library is aimed to facilitate manipulation of the flattened device tree in order to parse it and generate output in various formats.
4
5It is highly based on fdtdump for the dtc compiler package.
6
7Support Inputs :
8 - Device Tree Blob (.dtb)
9 - Filesystem
10 - JSON (See JSONDeviceTree.md)
11
12Supported Outputs :
13 - Device Tree Blob (DTB)
14 - Device Tree Structure (text DTS)
15 - JSON (See JSONDeviceTree.md)
16
17Device Tree filesystem 'output' is available via the fusemount.py FUSE sample using [fusepy](https://github.com/terencehonles/fusepy) library.
18
19The object data permits :
20 - add/delete/pop nodes and attributes
21 - create attributes dynamically with native python types
22 - walk throught the tree
23 - resolve and generate "paths"
24 - parse from DTB or filesystem
25 - output DTB or DTS
26 - output JSON
27 - compare two tree
28 - merge two trees
29
30Any API, code, syntax, tests or whatever enhancement is welcomed, but consider this an alpha version project not yet used in production.
31
32No DTS parser/compiler is event considered since "dtc" is the official compiler, but i'm open to any compiler implementation over pyfdt...
33
34Typical usage is :
35```
36from pyfdt import FdtBlobParse
37with open("myfdt.dtb") as infile:
38    dtb = FdtBlobParse(infile)
39    print dtb.to_fdt().to_dts()
40```
41
42Will open a binary DTB and output an human readable DTS structure.
43
44The samples directory shows how to :
45 - checkpath.py : resolve a FDT path to get a node object
46 - dtbtodts.py : how to convert from DTB to DTS
47 - fusemount.py : how to mount the DTB into a Device Tree filesystem you can recompile using dtc
48 - python-generate.py : generate a FDT in 100% python and generate a DTS from it
49 - walktree.py : List all paths of the device tree
50 - fstodtb.py : Device Tree blob creation from Filesystem device tree like DTC
51
52[Device Tree Wiki](http://www.devicetree.org)
53[Device Tree Compiler](http://www.devicetree.org/Device_Tree_Compiler)
54
55[![Build Status](https://travis-ci.org/superna9999/pyfdt.svg?branch=master)](https://travis-ci.org/superna9999/pyfdt)
56