diff mbox series

[U-Boot,v2,18/37] binman: Assume Intel descriptor is at the start of the image

Message ID 20190708191856.138863-19-sjg@chromium.org
State Accepted
Commit 79a0176fae9f5273adbe486ee64e6ef0581bb3fe
Delegated to: Simon Glass
Headers show
Series binman: Add CBFS support | expand

Commit Message

Simon Glass July 8, 2019, 7:18 p.m. UTC
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>
---

Changes in v2: None

 tools/binman/bsection.py               | 8 ++++++++
 tools/binman/etype/intel_descriptor.py | 2 ++
 2 files changed, 10 insertions(+)

Comments

Simon Glass July 18, 2019, 1:59 a.m. UTC | #1
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>
---

Changes in v2: None

 tools/binman/bsection.py               | 8 ++++++++
 tools/binman/etype/intel_descriptor.py | 2 ++
 2 files changed, 10 insertions(+)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index e0e3707db41..49b8ef3e3e0 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -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
 
diff --git a/tools/binman/etype/intel_descriptor.py b/tools/binman/etype/intel_descriptor.py
index 9deb8dcf42c..661063457ed 100644
--- a/tools/binman/etype/intel_descriptor.py
+++ b/tools/binman/etype/intel_descriptor.py
@@ -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)