1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

binman: Rename 'position' to 'offset'

After some thought, I believe there is an unfortunate naming flaw in
binman. Entries have a position and size, but now that we support
hierarchical sections it is unclear whether a position should be an
absolute position within the image, or a relative position within its
parent section.

At present 'position' actually means the relative position. This indicates
a need for an 'image position' for code that wants to find the location of
an entry without having to do calculations back through parents to
discover this image position.

A better name for the current 'position' or 'pos' is 'offset'. It is not
always an absolute position, but it is always an offset from its parent
offset.

It is unfortunate to rename this concept now, 18 months after binman was
introduced. However I believe it is the right thing to do. The impact is
mostly limited to binman itself and a few changes to in-tree users to
binman:

   tegra
   sunxi
   x86

The change makes old binman definitions (e.g. downstream or out-of-tree)
incompatible if they use the 'pos = <...>' property. Later work will
adjust binman to generate an error when it is used.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2018-08-01 15:22:37 -06:00
parent 46d61a2f2a
commit 3ab9598df7
44 changed files with 267 additions and 263 deletions

View File

@@ -57,7 +57,7 @@ class Image:
def AddMissingProperties(self):
"""Add properties that are not present in the device tree
When binman has completed packing the entries the position and size of
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
@@ -73,13 +73,13 @@ class Image:
"""
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"""
@@ -121,5 +121,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)