summaryrefslogtreecommitdiff
path: root/tools/binman/bsection.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-09-14 04:57:29 -0600
committerSimon Glass <sjg@chromium.org>2018-09-29 11:49:35 -0600
commitba64a0bbb7b7128479a97fdf58baa9ddfbfe4db6 (patch)
treebda0f81481e31aa9563906e2049124b610652b96 /tools/binman/bsection.py
parent0a98b28b06800da48f006069fe14e47dd399d2ff (diff)
downloadu-boot-ba64a0bbb7b7128479a97fdf58baa9ddfbfe4db6.tar.gz
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/bsection.py')
-rw-r--r--tools/binman/bsection.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index 4bf206878d..52ac31a467 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -253,10 +253,26 @@ class Section(object):
for entry in entries:
self._entries[entry._node.name] = entry
+ def _ExpandEntries(self):
+ """Expand any entries that are permitted to"""
+ exp_entry = None
+ for entry in self._entries.values():
+ if exp_entry:
+ exp_entry.ExpandToLimit(entry.offset)
+ exp_entry = None
+ if entry.expand_size:
+ exp_entry = entry
+ if exp_entry:
+ exp_entry.ExpandToLimit(self._size)
+
def CheckEntries(self):
- """Check that entries do not overlap or extend outside the section"""
+ """Check that entries do not overlap or extend outside the section
+
+ This also sorts entries, if needed and expands
+ """
if self._sort:
self._SortEntries()
+ self._ExpandEntries()
offset = 0
prev_name = 'None'
for entry in self._entries.values():
@@ -419,3 +435,7 @@ class Section(object):
return None
return entry.data
source_entry.Raise("Cannot find entry for node '%s'" % node.name)
+
+ def ExpandSize(self, size):
+ if size != self._size:
+ self._size = size