diff options
author | Simon Glass <sjg@chromium.org> | 2019-07-08 14:25:38 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2019-07-24 12:54:08 -0700 |
commit | 6c223fda1e624e1e382fcb029e9d60f441444d2e (patch) | |
tree | 46a0b79c43dc8d559bf4f5db3847704b6bdcc65c /tools/binman/etype/blob.py | |
parent | c52c9e7da809e36001d125891e594c4740235055 (diff) |
binman: Allow device-tree entries to be compressed
At present the logic skips the blob class' handling of compression, so
this is not supported with device tree entries. Fix this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/etype/blob.py')
-rw-r--r-- | tools/binman/etype/blob.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py index ec94568ac0..a4ff0efceb 100644 --- a/tools/binman/etype/blob.py +++ b/tools/binman/etype/blob.py @@ -41,17 +41,26 @@ class Entry_blob(Entry): self.ReadBlobContents() return True - def ReadBlobContents(self): - # We assume the data is small enough to fit into memory. If this - # is used for large filesystem image that might not be true. - # In that case, Image.BuildImage() could be adjusted to use a - # new Entry method which can read in chunks. Then we could copy - # the data in chunks and avoid reading it all at once. For now - # this seems like an unnecessary complication. - indata = tools.ReadFile(self._pathname) + def CompressData(self, indata): if self.compress != 'none': self.uncomp_size = len(indata) data = tools.Compress(indata, self.compress) + return data + + def ReadBlobContents(self): + """Read blob contents into memory + + This function compresses the data before storing if needed. + + We assume the data is small enough to fit into memory. If this + is used for large filesystem image that might not be true. + In that case, Image.BuildImage() could be adjusted to use a + new Entry method which can read in chunks. Then we could copy + the data in chunks and avoid reading it all at once. For now + this seems like an unnecessary complication. + """ + indata = tools.ReadFile(self._pathname) + data = self.CompressData(indata) self.SetContents(data) return True |