diff options
author | Simon Glass <sjg@chromium.org> | 2018-09-14 04:57:29 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-09-29 11:49:35 -0600 |
commit | ba64a0bbb7b7128479a97fdf58baa9ddfbfe4db6 (patch) | |
tree | bda0f81481e31aa9563906e2049124b610652b96 /tools/binman/entry.py | |
parent | 0a98b28b06800da48f006069fe14e47dd399d2ff (diff) |
binman: Support expanding entries
It is useful to have entries which can grow automatically to fill
available space. Add support for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/entry.py')
-rw-r--r-- | tools/binman/entry.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 7316ad43b5e..0915b470b4e 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -76,6 +76,7 @@ class Entry(object): self.pad_after = 0 self.offset_unset = False self.image_pos = None + self._expand_size = False if read_node: self.ReadNode() @@ -161,6 +162,7 @@ class Entry(object): "of two" % (self._node.path, self.align_size)) self.align_end = fdt_util.GetInt(self._node, 'align-end') self.offset_unset = fdt_util.GetBool(self._node, 'offset-unset') + self.expand_size = fdt_util.GetBool(self._node, 'expand-size') def GetDefaultFilename(self): return None @@ -507,3 +509,12 @@ features to produce new behaviours. break name = '%s.%s' % (node.name, name) return name + + def ExpandToLimit(self, limit): + """Expand an entry so that it ends at the given offset limit""" + if self.offset + self.size < limit: + self.size = limit - self.offset + # Request the contents again, since changing the size requires that + # the data grows. This should not fail, but check it to be sure. + if not self.ObtainContents(): + self.Raise('Cannot obtain contents when expanding entry') |