diff options
author | Simon Glass <sjg@chromium.org> | 2018-07-17 13:25:28 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-08-01 16:30:07 -0600 |
commit | 8122f3967f6eaab7134051d1d8c9b1bfc3babadb (patch) | |
tree | 370eb5697e7f8f2d0613c407d86c546eecc66280 /tools/binman/bsection.py | |
parent | ea6922e3d6a1b6b73d7baef4998f8bef0fe332ad (diff) | |
download | u-boot-8122f3967f6eaab7134051d1d8c9b1bfc3babadb.tar.gz |
binman: Enhance the map and fdt-update output
At present the .map file produced for each image does not include the
overall image size. This is useful information.
Update the code to generate it in the .map file as well as the updated
FDT. Also fix a few comments while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/bsection.py')
-rw-r--r-- | tools/binman/bsection.py | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py index d78a25e83d..1604b9915e 100644 --- a/tools/binman/bsection.py +++ b/tools/binman/bsection.py @@ -50,6 +50,7 @@ class Section(object): import entry from entry import Entry + self._name = name self._node = node self._offset = 0 self._size = None @@ -90,11 +91,20 @@ class Section(object): entry.SetPrefix(self._name_prefix) self._entries[node.name] = entry + def SetOffset(self, offset): + self._offset = offset + def AddMissingProperties(self): + """Add new properties to the device tree as needed for this entry""" + for prop in ['offset', 'size']: + if not prop in self._node.props: + self._node.AddZeroProp(prop) for entry in self._entries.values(): entry.AddMissingProperties() def SetCalculatedProperties(self): + self._node.SetInt('offset', self._offset) + self._node.SetInt('size', self._size) for entry in self._entries.values(): entry.SetCalculatedProperties() @@ -269,7 +279,7 @@ class Section(object): fd.write(self.GetData()) def GetData(self): - """Write the section to a file""" + """Get the contents of the section""" section_data = chr(self._pad_byte) * self._size for entry in self._entries.values(): @@ -335,13 +345,31 @@ class Section(object): raise ValueError("%s: No such property '%s'" % (msg, prop_name)) def GetEntries(self): + """Get the number of entries in a section + + Returns: + Number of entries in a section + """ return self._entries + def GetSize(self): + """Get the size of a section in bytes + + This is only meaningful if the section has a pre-defined size, or the + entries within it have been packed, so that the size has been + calculated. + + Returns: + Entry size in bytes + """ + return self._size + def WriteMap(self, fd, indent): """Write a map of the section to a .map file Args: fd: File to write the map to """ + Entry.WriteMapLine(fd, indent, self._name, self._offset, self._size) for entry in self._entries.values(): - entry.WriteMap(fd, indent) + entry.WriteMap(fd, indent + 1) |