summaryrefslogtreecommitdiff
path: root/tools/binman/etype
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-07-08 14:25:30 -0600
committerSimon Glass <sjg@chromium.org>2019-07-24 12:54:08 -0700
commit8287ee852d23b81bda364f9a4ed11c2fcc17da43 (patch)
treee734e227334726175e954647d66d7b3452d53f41 /tools/binman/etype
parent53cd5d921dd76d4651f2c99681a3c050743b6ba1 (diff)
binman: Move compression into the Entry base class
Compression is currently available only with blobs. However we want to report the compression algorithm and uncompressed size for all entries, so that other entry types can support compression. This will help with the forthcoming 'list' feature which lists entries in the image. Move the compression properties into the base class. Also fix up the docs which had the wrong property name. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/etype')
-rw-r--r--tools/binman/etype/blob.py19
1 files changed, 4 insertions, 15 deletions
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index a91e784700..ec94568ac0 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -33,8 +33,7 @@ class Entry_blob(Entry):
def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node)
self._filename = fdt_util.GetString(self._node, 'filename', self.etype)
- self._compress = fdt_util.GetString(self._node, 'compress', 'none')
- self._uncompressed_size = None
+ self.compress = fdt_util.GetString(self._node, 'compress', 'none')
def ObtainContents(self):
self._filename = self.GetDefaultFilename()
@@ -50,21 +49,11 @@ class Entry_blob(Entry):
# the data in chunks and avoid reading it all at once. For now
# this seems like an unnecessary complication.
indata = tools.ReadFile(self._pathname)
- if self._compress != 'none':
- self._uncompressed_size = len(indata)
- data = tools.Compress(indata, self._compress)
+ if self.compress != 'none':
+ self.uncomp_size = len(indata)
+ data = tools.Compress(indata, self.compress)
self.SetContents(data)
return True
def GetDefaultFilename(self):
return self._filename
-
- def AddMissingProperties(self):
- Entry.AddMissingProperties(self)
- if self._compress != 'none':
- state.AddZeroProp(self._node, 'uncomp-size')
-
- def SetCalculatedProperties(self):
- Entry.SetCalculatedProperties(self)
- if self._uncompressed_size is not None:
- state.SetInt(self._node, 'uncomp-size', self._uncompressed_size)