diff options
author | Tom Rini <trini@konsulko.com> | 2022-02-23 12:28:54 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-02-23 13:34:08 -0500 |
commit | 4cb9bd834e6a63ab56797b362a288709e867ccfb (patch) | |
tree | d4bfbd7d8ad58b103d8d2e9e3f54b7f18589da2f /tools/dtoc/fdt.py | |
parent | 17a0dc6abfdbf392f6a27074f2633608038c4221 (diff) | |
parent | 70f42e720c90faa2fa27836288559e0d647862b7 (diff) |
Merge tag 'dm-pull-22222' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
binman fixes/improvements to FIT generator
binman SPL fixes
moveconfig support regex matches
Diffstat (limited to 'tools/dtoc/fdt.py')
-rw-r--r-- | tools/dtoc/fdt.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 7e13757a1be..c16909a8769 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -356,6 +356,8 @@ class Node: offset = fdt_obj.first_subnode(self._offset, QUIET_NOTFOUND) for subnode in self.subnodes: + if subnode._offset is None: + continue if subnode.name != fdt_obj.get_name(offset): raise ValueError('Internal error, node name mismatch %s != %s' % (subnode.name, fdt_obj.get_name(offset))) @@ -501,6 +503,24 @@ class Node: val = bytes(val, 'utf-8') return self.AddData(prop_name, val + b'\0') + def AddStringList(self, prop_name, val): + """Add a new string-list property to a node + + The device tree is marked dirty so that the value will be written to + the blob on the next sync. + + Args: + prop_name: Name of property to add + val (list of str): List of strings to add + + Returns: + Prop added + """ + out = b'' + for string in val: + out += bytes(string, 'utf-8') + b'\0' + return self.AddData(prop_name, out) + def AddInt(self, prop_name, val): """Add a new integer property to a node @@ -530,6 +550,23 @@ class Node: self.subnodes.append(subnode) return subnode + def Delete(self): + """Delete a node + + The node is deleted and the offset cache is invalidated. + + Args: + node (Node): Node to delete + + Raises: + ValueError if the node does not exist + """ + CheckErr(self._fdt._fdt_obj.del_node(self.Offset()), + "Node '%s': delete" % self.path) + parent = self.parent + self._fdt.Invalidate() + parent.subnodes.remove(self) + def Sync(self, auto_resize=False): """Sync node changes back to the device tree |