diff options
author | Simon Glass <sjg@chromium.org> | 2019-07-08 14:25:30 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2019-07-24 12:54:08 -0700 |
commit | 8287ee852d23b81bda364f9a4ed11c2fcc17da43 (patch) | |
tree | e734e227334726175e954647d66d7b3452d53f41 /tools/binman/entry.py | |
parent | 53cd5d921dd76d4651f2c99681a3c050743b6ba1 (diff) | |
download | u-boot-8287ee852d23b81bda364f9a4ed11c2fcc17da43.zip u-boot-8287ee852d23b81bda364f9a4ed11c2fcc17da43.tar.gz u-boot-8287ee852d23b81bda364f9a4ed11c2fcc17da43.tar.bz2 |
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/entry.py')
-rw-r--r-- | tools/binman/entry.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/binman/entry.py b/tools/binman/entry.py index e1cd0d3..8cccc2e 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -51,6 +51,8 @@ class Entry(object): offset: Offset of entry within the section, None if not known yet (in which case it will be calculated by Pack()) size: Entry size in bytes, None if not known + uncomp_size: Size of uncompressed data in bytes, if the entry is + compressed, else None contents_size: Size of contents in bytes, 0 by default align: Entry start offset alignment, or None align_size: Entry size alignment, or None @@ -58,6 +60,7 @@ class Entry(object): pad_before: Number of pad bytes before the contents, 0 if none pad_after: Number of pad bytes after the contents, 0 if none data: Contents of entry (string of bytes) + compress: Compression algoithm used (e.g. 'lz4'), 'none' if none """ def __init__(self, section, etype, node, read_node=True, name_prefix=''): self.section = section @@ -66,6 +69,7 @@ class Entry(object): self.name = node and (name_prefix + node.name) or 'none' self.offset = None self.size = None + self.uncomp_size = None self.data = None self.contents_size = 0 self.align = None @@ -76,6 +80,7 @@ class Entry(object): self.offset_unset = False self.image_pos = None self._expand_size = False + self.compress = 'none' if read_node: self.ReadNode() @@ -188,6 +193,8 @@ class Entry(object): for prop in ['offset', 'size', 'image-pos']: if not prop in self._node.props: state.AddZeroProp(self._node, prop) + if self.compress != 'none': + state.AddZeroProp(self._node, 'uncomp-size') err = state.CheckAddHashProp(self._node) if err: self.Raise(err) @@ -198,6 +205,8 @@ class Entry(object): state.SetInt(self._node, 'size', self.size) state.SetInt(self._node, 'image-pos', self.image_pos - self.section.GetRootSkipAtStart()) + if self.uncomp_size is not None: + state.SetInt(self._node, 'uncomp-size', self.uncomp_size) state.CheckSetHashValue(self._node, self.GetData) def ProcessFdt(self, fdt): |