summaryrefslogtreecommitdiff
path: root/tools/binman/entry.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-10-27 02:40:17 +0300
committerSimon Glass <sjg@chromium.org>2020-10-29 23:42:59 +0300
commita9fad07d4b862b4b5d52e04950a374371936f7eb (patch)
tree515149bb2d2472f0f3d131c11877a20b5ca16c2a /tools/binman/entry.py
parent63e7ba6c1820def06e7ba88ce357cb605285e70c (diff)
downloadu-boot-a9fad07d4b862b4b5d52e04950a374371936f7eb.tar.xz
binman: Avoid reporting image-pos with compression
When a section is compressed, all entries within it are grouped together into a compressed block of data. This obscures the start of each individual child entry. Avoid reporting bogus 'image-pos' properties in this case, since it is not possible to access the entry at the location provided. The entire section must be decompressed first. CBFS does not support compressing whole sections, only individual files, so needs no special handling here. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/entry.py')
-rw-r--r--tools/binman/entry.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 01a5fde84e..8fa1dcef2d 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -213,11 +213,20 @@ class Entry(object):
def ExpandEntries(self):
pass
- def AddMissingProperties(self):
- """Add new properties to the device tree as needed for this entry"""
- for prop in ['offset', 'size', 'image-pos']:
+ def AddMissingProperties(self, have_image_pos):
+ """Add new properties to the device tree as needed for this entry
+
+ Args:
+ have_image_pos: True if this entry has an image position. This can
+ be False if its parent section is compressed, since compression
+ groups all entries together into a compressed block of data,
+ obscuring the start of each individual child entry
+ """
+ for prop in ['offset', 'size']:
if not prop in self._node.props:
state.AddZeroProp(self._node, prop)
+ if have_image_pos and 'image-pos' not in self._node.props:
+ state.AddZeroProp(self._node, 'image-pos')
if self.GetImage().allow_repack:
if self.orig_offset is not None:
state.AddZeroProp(self._node, 'orig-offset', True)
@@ -235,7 +244,8 @@ class Entry(object):
state.SetInt(self._node, 'offset', self.offset)
state.SetInt(self._node, 'size', self.size)
base = self.section.GetRootSkipAtStart() if self.section else 0
- state.SetInt(self._node, 'image-pos', self.image_pos - base)
+ if self.image_pos is not None:
+ state.SetInt(self._node, 'image-pos', self.image_pos)
if self.GetImage().allow_repack:
if self.orig_offset is not None:
state.SetInt(self._node, 'orig-offset', self.orig_offset, True)