aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/etype/blob.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-11-23 21:09:52 -0700
committerSimon Glass <sjg@chromium.org>2021-12-05 09:23:15 -0700
commitcc2c50042690151b1b31d9b6d0f1a9dc5831ee5f (patch)
tree2595256751d08dca6d4e5a3144f42a1eae2e3230 /tools/binman/etype/blob.py
parent1b5a5331f3c7ad3ae5688841a7a6e710a2cb4dc7 (diff)
binman: Support lists of external blobs
Sometimes it is useful to have a list of related external blobs in a single entry. An example is the DDR binaries used by meson. There are 9 files in total. Add support for this, so we don't have to have a separate entry for each. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/etype/blob.py')
-rw-r--r--tools/binman/etype/blob.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index fae86ca3ec..8c1b809e8d 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -48,10 +48,10 @@ class Entry_blob(Entry):
self.ReadBlobContents()
return True
- def ReadBlobContents(self):
+ def ReadFileContents(self, pathname):
"""Read blob contents into memory
- This function compresses the data before storing if needed.
+ This function compresses the data before returning if needed.
We assume the data is small enough to fit into memory. If this
is used for large filesystem image that might not be true.
@@ -59,13 +59,23 @@ class Entry_blob(Entry):
new Entry method which can read in chunks. Then we could copy
the data in chunks and avoid reading it all at once. For now
this seems like an unnecessary complication.
+
+ Args:
+ pathname (str): Pathname to read from
+
+ Returns:
+ bytes: Data read
"""
state.TimingStart('read')
- indata = tools.ReadFile(self._pathname)
+ indata = tools.ReadFile(pathname)
state.TimingAccum('read')
state.TimingStart('compress')
data = self.CompressData(indata)
state.TimingAccum('compress')
+ return data
+
+ def ReadBlobContents(self):
+ data = self.ReadFileContents(self._pathname)
self.SetContents(data)
return True