diff options
author | Simon Glass <sjg@chromium.org> | 2019-10-31 07:43:02 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2019-11-04 18:15:32 -0700 |
commit | 9a5d3dcff7894a24e493e6ae52d289d190d3ccdf (patch) | |
tree | 6a8d009f7c11b99c571102b5373fb0f1b61b691f /tools | |
parent | 97de532e59be97281aabc327e93939550881e2ea (diff) | |
download | u-boot-9a5d3dcff7894a24e493e6ae52d289d190d3ccdf.tar.gz |
binman: Remember the pre-reset entry size
When preparing to possible expand or contract an entry we reset the size
to the original value from the binman device-tree definition, which is
often None.
This causes binman to forget the original size of the entry. Remember this
so that it can be used when needed.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/binman/entry.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 5bf5be4794..b6f1b2c93f 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -47,6 +47,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 + pre_reset_size: size as it was before ResetForPack(). This allows us to + keep track of the size we started with and detect size changes 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 @@ -71,6 +73,7 @@ class Entry(object): self.name = node and (name_prefix + node.name) or 'none' self.offset = None self.size = None + self.pre_reset_size = None self.uncomp_size = None self.data = None self.contents_size = 0 @@ -314,6 +317,7 @@ class Entry(object): self.Detail('ResetForPack: offset %s->%s, size %s->%s' % (ToHex(self.offset), ToHex(self.orig_offset), ToHex(self.size), ToHex(self.orig_size))) + self.pre_reset_size = self.size self.offset = self.orig_offset self.size = self.orig_size @@ -757,7 +761,10 @@ features to produce new behaviours. True if the data did not result in a resize of this entry, False if the entry must be resized """ - self.contents_size = self.size + if self.size is not None: + self.contents_size = self.size + else: + self.contents_size = self.pre_reset_size ok = self.ProcessContentsUpdate(data) self.Detail('WriteData: size=%x, ok=%s' % (len(data), ok)) section_ok = self.section.WriteChildData(self) |