binman: Add a new 'image-pos' property
[oweals/u-boot.git] / tools / binman / image.py
index 835b66c99f5f188a74e9934860552e74760fa370..4debc734519d86ec479fb23398a9113710bee135 100644 (file)
@@ -54,18 +54,32 @@ class Image:
             self._filename = filename
         self._section = bsection.Section('main-section', self._node)
 
+    def AddMissingProperties(self):
+        """Add properties that are not present in the device tree
+
+        When binman has completed packing the entries the offset and size of
+        each entry are known. But before this the device tree may not specify
+        these. Add any missing properties, with a dummy value, so that the
+        size of the entry is correct. That way we can insert the correct values
+        later.
+        """
+        self._section.AddMissingProperties()
+
+    def ProcessFdt(self, fdt):
+        return self._section.ProcessFdt(fdt)
+
     def GetEntryContents(self):
         """Call ObtainContents() for the section
         """
         self._section.GetEntryContents()
 
-    def GetEntryPositions(self):
-        """Handle entries that want to set the position/size of other entries
+    def GetEntryOffsets(self):
+        """Handle entries that want to set the offset/size of other entries
 
-        This calls each entry's GetPositions() method. If it returns a list
+        This calls each entry's GetOffsets() method. If it returns a list
         of entries to update, it updates them.
         """
-        self._section.GetEntryPositions()
+        self._section.GetEntryOffsets()
 
     def PackEntries(self):
         """Pack all entries into the image"""
@@ -79,6 +93,12 @@ class Image:
         """Check that entries do not overlap or extend outside the image"""
         self._section.CheckEntries()
 
+    def SetCalculatedProperties(self):
+        self._section.SetCalculatedProperties()
+
+    def SetImagePos(self):
+        self._section.SetImagePos(0)
+
     def ProcessEntryContents(self):
         """Call the ProcessContents() method for each entry
 
@@ -104,5 +124,5 @@ class Image:
         filename = '%s.map' % self._name
         fname = tools.GetOutputFilename(filename)
         with open(fname, 'w') as fd:
-            print('%8s  %8s  %s' % ('Position', 'Size', 'Name'), file=fd)
+            print('%8s  %8s  %s' % ('Offset', 'Size', 'Name'), file=fd)
             self._section.WriteMap(fd, 0)