Message ID | 20220819142538.24847-8-stefan.herbrechtsmeier-oss@weidmueller.com |
---|---|
State | Accepted |
Commit | 204a27bbb222c61bf5aaecbf7e00a5a8aa835bf9 |
Delegated to: | Simon Glass |
Headers | show |
Series | binman: Rework compression support | expand |
On Fri, 19 Aug 2022 at 08:26, Stefan Herbrechtsmeier <stefan.herbrechtsmeier-oss@weidmueller.com> wrote: > > From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> > > Add a DecompressData function to entry class to allow override in child > classes and to centralize the compress and decompress in a single class. > > Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> > > --- > > (no changes since v5) > > Changes in v5: > - Add commit to add DecompressData function to entry class > > tools/binman/entry.py | 15 +++++++++++++++ > tools/binman/etype/section.py | 3 +-- > 2 files changed, 16 insertions(+), 2 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org>
On Fri, 19 Aug 2022 at 08:26, Stefan Herbrechtsmeier <stefan.herbrechtsmeier-oss@weidmueller.com> wrote: > > From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> > > Add a DecompressData function to entry class to allow override in child > classes and to centralize the compress and decompress in a single class. > > Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> > > --- > > (no changes since v5) > > Changes in v5: > - Add commit to add DecompressData function to entry class > > tools/binman/entry.py | 15 +++++++++++++++ > tools/binman/etype/section.py | 3 +-- > 2 files changed, 16 insertions(+), 2 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org> Applied to u-boot-dm, thanks!
diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 8f846e55b6..6d58410e91 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -1086,6 +1086,21 @@ features to produce new behaviours. data = comp_util.compress(indata, self.compress) return data + def DecompressData(self, indata): + """Decompress data according to the entry's compression method + + Args: + indata: Data to decompress + + Returns: + Decompressed data + """ + data = comp_util.decompress(indata, self.compress) + if self.compress != 'none': + self.uncomp_size = len(data) + self.uncomp_data = data + return data + @classmethod def UseExpanded(cls, node, etype, new_etype): """Check whether to use an expanded entry type diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py index 48165abf6a..b9b2f25345 100644 --- a/tools/binman/etype/section.py +++ b/tools/binman/etype/section.py @@ -13,7 +13,6 @@ import concurrent.futures import re import sys -from binman import comp_util from binman.entry import Entry from binman import state from dtoc import fdt_util @@ -777,7 +776,7 @@ class Entry_section(Entry): data = parent_data[offset:offset + child.size] if decomp: indata = data - data = comp_util.decompress(indata, child.compress) + data = child.DecompressData(indata) if child.uncomp_size: tout.info("%s: Decompressing data size %#x with algo '%s' to data size %#x" % (child.GetPath(), len(indata), child.compress,