mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 07:34:31 +00:00
binman: Add DecompressData function to entry class
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> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
fa24f5578c
commit
204a27bbb2
2 changed files with 16 additions and 2 deletions
|
@ -1120,6 +1120,21 @@ features to produce new behaviours.
|
||||||
data = comp_util.compress(indata, self.compress)
|
data = comp_util.compress(indata, self.compress)
|
||||||
return data
|
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
|
@classmethod
|
||||||
def UseExpanded(cls, node, etype, new_etype):
|
def UseExpanded(cls, node, etype, new_etype):
|
||||||
"""Check whether to use an expanded entry type
|
"""Check whether to use an expanded entry type
|
||||||
|
|
|
@ -13,7 +13,6 @@ import concurrent.futures
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from binman import comp_util
|
|
||||||
from binman.entry import Entry
|
from binman.entry import Entry
|
||||||
from binman import state
|
from binman import state
|
||||||
from dtoc import fdt_util
|
from dtoc import fdt_util
|
||||||
|
@ -777,7 +776,7 @@ class Entry_section(Entry):
|
||||||
data = parent_data[offset:offset + child.size]
|
data = parent_data[offset:offset + child.size]
|
||||||
if decomp:
|
if decomp:
|
||||||
indata = data
|
indata = data
|
||||||
data = comp_util.decompress(indata, child.compress)
|
data = child.DecompressData(indata)
|
||||||
if child.uncomp_size:
|
if child.uncomp_size:
|
||||||
tout.info("%s: Decompressing data size %#x with algo '%s' to data size %#x" %
|
tout.info("%s: Decompressing data size %#x with algo '%s' to data size %#x" %
|
||||||
(child.GetPath(), len(indata), child.compress,
|
(child.GetPath(), len(indata), child.compress,
|
||||||
|
|
Loading…
Reference in a new issue