summaryrefslogtreecommitdiff
path: root/tools/binman/entry.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-21 08:24:32 +0300
committerSimon Glass <sjg@chromium.org>2021-03-27 06:26:48 +0300
commit631f752de5b8dccbf9a0d4824213e9e6e0d96167 (patch)
treeda5b2d65f3469156265844ef73b19ab4ef44d32b /tools/binman/entry.py
parent189f291914cb867f8782d7224a1073d6e17fc800 (diff)
downloadu-boot-631f752de5b8dccbf9a0d4824213e9e6e0d96167.tar.xz
binman: Support obtaining section contents immediately
Generally the content of sections is not built until the final assembly of the image. This is partly to avoid wasting time, since the entries within sections may change multiple times as binman works through its various stages. This works quite well since sections exist in a strict hierarchy, so they can be processed in a depth-first manner. However the 'collection' entry type does not have this luxury. If it contains a section within its 'content' list, then it must produce the section contents, if available. That section is typically a sibling node, i.e. not part oc the collection's hierarchy. Add a new 'required' argument to section.GetData() to support this. When required is True, any referenced sections are immediately built. If this is not possible (because one of the subentries does not have its data yet) then an error is produced. The test for this uses a 'collection' entry type, referencing a section as its first member. This forces a call to _BuildSectionData() with required set to False, at first, then True later, when the image is assembled. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/entry.py')
-rw-r--r--tools/binman/entry.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index a157038d4e..b7b9791b10 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -482,9 +482,13 @@ class Entry(object):
"""
return self._node.path
- def GetData(self):
+ def GetData(self, required=True):
"""Get the contents of an entry
+ Args:
+ required: True if the data must be present, False if it is OK to
+ return None
+
Returns:
bytes content of the entry, excluding any padding. If the entry is
compressed, the compressed data is returned