]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
binman: Assume Intel descriptor is at the start of the image
authorSimon Glass <sjg@chromium.org>
Mon, 8 Jul 2019 19:18:37 +0000 (13:18 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 24 Jul 2019 03:27:57 +0000 (20:27 -0700)
At present binman requires that the Intel descriptor has an explicit
offset. Generally this is 0 since the descriptor is at the start of the
image. Add a default to handle this, so users don't need to specify the
offset.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/bsection.py
tools/binman/etype/intel_descriptor.py

index e0e3707db41b39d1b17e63b2751077a6299191a9..49b8ef3e3e0b891f558d61f34a8cf7770254f668 100644 (file)
@@ -477,6 +477,14 @@ class Section(object):
             return self._parent_section.GetRootSkipAtStart()
         return self._skip_at_start
 
+    def GetStartOffset(self):
+        """Get the start offset for this section
+
+        Returns:
+            The first available offset in this section (typically 0)
+        """
+        return self._skip_at_start
+
     def GetImageSize(self):
         """Get the size of the image containing this section
 
index 9deb8dcf42c25da3d142b1ac76619e639b9cd7a6..661063457eda6e6edfd218fd772810e1c105a3be 100644 (file)
@@ -47,6 +47,8 @@ class Entry_intel_descriptor(Entry_blob):
     def __init__(self, section, etype, node):
         Entry_blob.__init__(self, section, etype, node)
         self._regions = []
+        if self.offset is None:
+            self.offset = self.section.GetStartOffset()
 
     def GetOffsets(self):
         offset = self.data.find(FD_SIGNATURE)