aboutsummaryrefslogtreecommitdiff
path: root/tools/binman/entry.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-07-20 12:23:55 -0600
committerSimon Glass <sjg@chromium.org>2019-07-29 09:38:06 -0600
commiteba1f0cc942947722f70029c033b915113cec1ba (patch)
tree389003da6941977c16b6edd1e7afdecec5ea3d93 /tools/binman/entry.py
parent7400107e467da52c7e6772b677f69f4464f6d2ce (diff)
downloadu-boot-eba1f0cc942947722f70029c033b915113cec1ba.zip
u-boot-eba1f0cc942947722f70029c033b915113cec1ba.tar.gz
u-boot-eba1f0cc942947722f70029c033b915113cec1ba.tar.bz2
binman: Add more tests for image header position
The positioning does not currently work correctly if at the end of an image with no fixed size. Also if the header is in the middle of an image it can cause a gap in the image since the header position is normally at the image end, so entries after it are placed after the end of the image. Fix these problems and add more tests to cover these cases. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/entry.py')
-rw-r--r--tools/binman/entry.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 74e2808..8dacc61 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -745,3 +745,18 @@ features to produce new behaviours.
ok = self.ProcessContentsUpdate(data)
self.Detail('WriteData: size=%x, ok=%s' % (len(data), ok))
return ok
+
+ def GetSiblingOrder(self):
+ """Get the relative order of an entry amoung its siblings
+
+ Returns:
+ 'start' if this entry is first among siblings, 'end' if last,
+ otherwise None
+ """
+ entries = list(self.section.GetEntries().values())
+ if entries:
+ if self == entries[0]:
+ return 'start'
+ elif self == entries[-1]:
+ return 'end'
+ return 'middle'