summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-07-17 13:25:49 -0600
committerSimon Glass <sjg@chromium.org>2018-08-01 16:30:48 -0600
commit1be70d20d8466c287cd1dc6f590171794ba67f07 (patch)
treea323c2b411d8f721403d99bb48c036d456419ae6 /tools
parentb8ef5b6bc871e12d036869172aa3599f5be7ee09 (diff)
downloadu-boot-1be70d20d8466c287cd1dc6f590171794ba67f07.tar.gz
binman: Show the image position in the map
At present the map only shows the offset and size for each region. The image position provides the actual position of each entry in the image, regardless of the section hierarchy. Add the image position to the map. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/binman/bsection.py3
-rw-r--r--tools/binman/entry.py8
-rw-r--r--tools/binman/ftest.py28
-rw-r--r--tools/binman/image.py3
4 files changed, 23 insertions, 19 deletions
diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index 70a6ec1776..a0bd1b6d34 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -378,7 +378,8 @@ class Section(object):
Args:
fd: File to write the map to
"""
- Entry.WriteMapLine(fd, indent, self._name, self._offset, self._size)
+ Entry.WriteMapLine(fd, indent, self._name, self._offset, self._size,
+ self._image_pos)
for entry in self._entries.values():
entry.WriteMap(fd, indent + 1)
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 996f03e3a6..6ce5dbdc90 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -349,8 +349,9 @@ class Entry(object):
pass
@staticmethod
- def WriteMapLine(fd, indent, name, offset, size):
- print('%s%08x %08x %s' % (' ' * indent, offset, size, name), file=fd)
+ def WriteMapLine(fd, indent, name, offset, size, image_pos):
+ print('%08x %s%08x %08x %s' % (image_pos, ' ' * indent, offset,
+ size, name), file=fd)
def WriteMap(self, fd, indent):
"""Write a map of the entry to a .map file
@@ -359,7 +360,8 @@ class Entry(object):
fd: File to write the map to
indent: Curent indent level of map (0=none, 1=one level, etc.)
"""
- self.WriteMapLine(fd, indent, self.name, self.offset, self.size)
+ self.WriteMapLine(fd, indent, self.name, self.offset, self.size,
+ self.image_pos)
def GetEntries(self):
"""Return a list of entries contained by this entry
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index d09868588c..ce473dfaff 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1052,25 +1052,25 @@ class TestFunctional(unittest.TestCase):
def testMap(self):
"""Tests outputting a map of the images"""
_, _, map_data, _ = self._DoReadFileDtb('55_sections.dts', map=True)
- self.assertEqual(''' Offset Size Name
-00000000 00000028 main-section
- 00000000 00000010 section@0
- 00000000 00000004 u-boot
- 00000010 00000010 section@1
- 00000000 00000004 u-boot
- 00000020 00000004 section@2
- 00000000 00000004 u-boot
+ self.assertEqual('''ImagePos Offset Size Name
+00000000 00000000 00000028 main-section
+00000000 00000000 00000010 section@0
+00000000 00000000 00000004 u-boot
+00000010 00000010 00000010 section@1
+00000010 00000000 00000004 u-boot
+00000020 00000020 00000004 section@2
+00000020 00000000 00000004 u-boot
''', map_data)
def testNamePrefix(self):
"""Tests that name prefixes are used"""
_, _, map_data, _ = self._DoReadFileDtb('56_name_prefix.dts', map=True)
- self.assertEqual(''' Offset Size Name
-00000000 00000028 main-section
- 00000000 00000010 section@0
- 00000000 00000004 ro-u-boot
- 00000010 00000010 section@1
- 00000000 00000004 rw-u-boot
+ self.assertEqual('''ImagePos Offset Size Name
+00000000 00000000 00000028 main-section
+00000000 00000000 00000010 section@0
+00000000 00000000 00000004 ro-u-boot
+00000010 00000010 00000010 section@1
+00000010 00000000 00000004 rw-u-boot
''', map_data)
def testUnknownContents(self):
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 4debc73451..68126bc3e6 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -124,5 +124,6 @@ class Image:
filename = '%s.map' % self._name
fname = tools.GetOutputFilename(filename)
with open(fname, 'w') as fd:
- print('%8s %8s %s' % ('Offset', 'Size', 'Name'), file=fd)
+ print('%8s %8s %8s %s' % ('ImagePos', 'Offset', 'Size', 'Name'),
+ file=fd)
self._section.WriteMap(fd, 0)