1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-02 01:02:19 +02:00

dtoc: Add a way to create an Fdt object from a data block

Support creating an Fdt object without having to write the data to a file
first.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2018-09-14 04:57:17 -06:00
parent 6434961b2b
commit 746aee3f2f
2 changed files with 22 additions and 0 deletions

View File

@@ -472,6 +472,20 @@ class Fdt:
with open(self._fname) as fd:
self._fdt_obj = libfdt.Fdt(fd.read())
@staticmethod
def FromData(data):
"""Create a new Fdt object from the given data
Args:
data: Device-tree data blob
Returns:
Fdt object containing the data
"""
fdt = Fdt(None)
fdt._fdt_obj = libfdt.Fdt(bytearray(data))
return fdt
def LookupPhandle(self, phandle):
"""Look up a phandle