mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 08:42:12 +02:00
dtoc: Move to using bytearray
Since we want to be able to change the in-memory device tree using libfdt, use a bytearray instead of a string. This makes interfacing from Python easier. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -75,6 +75,14 @@ struct fdt_property {
|
|||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%typemap(in) (const void *) {
|
||||||
|
if (!PyByteArray_Check($input)) {
|
||||||
|
SWIG_exception_fail(SWIG_TypeError, "in method '" "$symname" "', argument "
|
||||||
|
"$argnum"" of type '" "$type""'");
|
||||||
|
}
|
||||||
|
$1 = (void *) PyByteArray_AsString($input);
|
||||||
|
}
|
||||||
|
|
||||||
const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
|
const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
|
||||||
int fdt_path_offset(const void *fdt, const char *path);
|
int fdt_path_offset(const void *fdt, const char *path);
|
||||||
int fdt_first_property_offset(const void *fdt, int nodeoffset);
|
int fdt_first_property_offset(const void *fdt, int nodeoffset);
|
||||||
|
@@ -110,7 +110,7 @@ class FdtNormal(Fdt):
|
|||||||
self._fname = fdt_util.EnsureCompiled(self._fname)
|
self._fname = fdt_util.EnsureCompiled(self._fname)
|
||||||
|
|
||||||
with open(self._fname) as fd:
|
with open(self._fname) as fd:
|
||||||
self._fdt = fd.read()
|
self._fdt = bytearray(fd.read())
|
||||||
|
|
||||||
def GetFdt(self):
|
def GetFdt(self):
|
||||||
"""Get the contents of the FDT
|
"""Get the contents of the FDT
|
||||||
|
Reference in New Issue
Block a user