diff options
author | Glenn Bergmans <glenn.bergmans@arm.com> | 2015-12-16 15:43:42 +0000 |
---|---|---|
committer | Curtis Dunham <curtis.dunham@arm.com> | 2018-01-29 22:20:06 +0000 |
commit | 3da05785813662f647b07400734337630a9f6f78 (patch) | |
tree | 10fc8a4b9265fc0b057e93f37d7f491c046c6f7d /src/python/m5/ext/pyfdt/README.md | |
parent | 9f5b6e1b74c8289050836abdfb9c2539380f9105 (diff) | |
download | gem5-3da05785813662f647b07400734337630a9f6f78.tar.xz |
ext: DT autogeneration - Add PyFtd to m5 space
This patch adds pyfdt.py to the m5.ext module. This is used in
succeeding patches for generating and editing dtb files and flat
device trees for DT autogeneration.
The file is in the m5_root/src/python/m5/ext directory, as opposed to
the m5_root/ext, because this library is part of the m5 object space
and linking to the m5_root/ext directory from the SConscript file
in src/python can not be done reliably. Linking from the root level
SConscript is also not an option, because it doesn't have the PySource
method defined.
Cloned from: https://github.com/superna9999/pyfdt
Commit: accbcd254584c9295a18878d32999d0c7c156f8e
Version: 0.3
Change-Id: I928bdc912a9507d1f8a3290acf445c7cae496552
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Curtis Dunham <curtis.dunham@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/5961
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/python/m5/ext/pyfdt/README.md')
-rw-r--r-- | src/python/m5/ext/pyfdt/README.md | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/python/m5/ext/pyfdt/README.md b/src/python/m5/ext/pyfdt/README.md new file mode 100644 index 000000000..75769a9a3 --- /dev/null +++ b/src/python/m5/ext/pyfdt/README.md @@ -0,0 +1,55 @@ +## pyfdt : Python Flattened Device Tree Manipulation ## +---------- +The pyfdt library is aimed to facilitate manipulation of the flattened device tree in order to parse it and generate output in various formats. + +It is highly based on fdtdump for the dtc compiler package. + +Support Inputs : + - Device Tree Blob (.dtb) + - Filesystem + - JSON (See JSONDeviceTree.md) + +Supported Outputs : + - Device Tree Blob (DTB) + - Device Tree Structure (text DTS) + - JSON (See JSONDeviceTree.md) + +Device Tree filesystem 'output' is available via the fusemount.py FUSE sample using [fusepy](https://github.com/terencehonles/fusepy) library. + +The object data permits : + - add/delete/pop nodes and attributes + - create attributes dynamically with native python types + - walk throught the tree + - resolve and generate "paths" + - parse from DTB or filesystem + - output DTB or DTS + - output JSON + - compare two tree + - merge two trees + +Any API, code, syntax, tests or whatever enhancement is welcomed, but consider this an alpha version project not yet used in production. + +No DTS parser/compiler is event considered since "dtc" is the official compiler, but i'm open to any compiler implementation over pyfdt... + +Typical usage is : +``` +from pyfdt import FdtBlobParse +with open("myfdt.dtb") as infile: + dtb = FdtBlobParse(infile) + print dtb.to_fdt().to_dts() +``` + +Will open a binary DTB and output an human readable DTS structure. + +The samples directory shows how to : + - checkpath.py : resolve a FDT path to get a node object + - dtbtodts.py : how to convert from DTB to DTS + - fusemount.py : how to mount the DTB into a Device Tree filesystem you can recompile using dtc + - python-generate.py : generate a FDT in 100% python and generate a DTS from it + - walktree.py : List all paths of the device tree + - fstodtb.py : Device Tree blob creation from Filesystem device tree like DTC + +[Device Tree Wiki](http://www.devicetree.org) +[Device Tree Compiler](http://www.devicetree.org/Device_Tree_Compiler) + +[](https://travis-ci.org/superna9999/pyfdt) |