diff options
author | Simon Glass <sjg@chromium.org> | 2019-07-08 14:25:50 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2019-07-24 12:54:08 -0700 |
commit | f667e45b1c0a7f21d433ee8f3ec18858d87dd2e5 (patch) | |
tree | ae849665f80553e7689976d578e90250545f5423 /tools/binman/etype/blob.py | |
parent | eea264ead3ca198ed66f62a78dc4940075621ae7 (diff) |
binman: Allow reading an entry from an image
It is useful to be able to extract entry contents from an image to see
what is inside. Add a simple function to read the contents of an entry,
decompressing it by default.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/etype/blob.py')
-rw-r--r-- | tools/binman/etype/blob.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py index a4ff0efceb..00cad33718 100644 --- a/tools/binman/etype/blob.py +++ b/tools/binman/etype/blob.py @@ -9,6 +9,7 @@ from entry import Entry import fdt_util import state import tools +import tout class Entry_blob(Entry): """Entry containing an arbitrary binary blob @@ -66,3 +67,15 @@ class Entry_blob(Entry): def GetDefaultFilename(self): return self._filename + + def ReadData(self, decomp=True): + indata = Entry.ReadData(self, decomp) + if decomp: + data = tools.Decompress(indata, self.compress) + if self.uncomp_size: + tout.Info("%s: Decompressing data size %#x with algo '%s' to data size %#x" % + (self.GetPath(), len(indata), self.compress, + len(data))) + else: + data = indata + return data |