summaryrefslogtreecommitdiff
path: root/tools/binman/entry.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-08-13 11:40:50 -0600
committerSimon Glass <sjg@chromium.org>2022-08-20 18:07:32 -0600
commitd626e825f5d45ca543999340428a5a809024b0db (patch)
treeb2d03be426e039bee37c16b832e33c42ba72ba63 /tools/binman/entry.py
parent9db9e932c79b653e81d5e11241b8f20e8fd61bdd (diff)
binman: Allow collection to use entries from other sections
At present the collections etype only works with entries in the same section. This can be limiting, since in some cases the data may be inside a subsection, e.g. if there are alignment constraints. Add a function to find the entries in an etype and have it search recursively. Make use of this for mkimage also. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/entry.py')
-rw-r--r--tools/binman/entry.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index d159d90e4c5..d413c91f181 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -679,6 +679,7 @@ class Entry(object):
self.WriteMapLine(fd, indent, self.name, self.offset, self.size,
self.image_pos)
+ # pylint: disable=assignment-from-none
def GetEntries(self):
"""Return a list of entries contained by this entry
@@ -688,6 +689,28 @@ class Entry(object):
"""
return None
+ def FindEntryByNode(self, find_node):
+ """Find a node in an entry, searching all subentries
+
+ This does a recursive search.
+
+ Args:
+ find_node (fdt.Node): Node to find
+
+ Returns:
+ Entry: entry, if found, else None
+ """
+ entries = self.GetEntries()
+ if entries:
+ for entry in entries.values():
+ if entry._node == find_node:
+ return entry
+ found = entry.FindEntryByNode(find_node)
+ if found:
+ return found
+
+ return None
+
def GetArg(self, name, datatype=str):
"""Get the value of an entry argument or device-tree-node property