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)
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
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
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):
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)