summaryrefslogtreecommitdiff
path: root/tools/binman/image.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-09-14 04:57:36 -0600
committerSimon Glass <sjg@chromium.org>2018-09-29 11:49:35 -0600
commit163ed6c342cfd15b623a46f3755203c712374a9a (patch)
tree5de0842cb24244db853f5253f84b865a8668206a /tools/binman/image.py
parentfe1ae3ecc3a2203babd7837bd2d5cf514a374c1f (diff)
binman: Allow writing a map file when something goes wrong
When we get a problem like overlapping regions it is sometimes hard to figure what what is going on. At present we don't write the map file in this case. However the file does provide useful information. Catch any packing errors and write a map file (if enabled with -m) to aid debugging. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/image.py')
-rw-r--r--tools/binman/image.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/binman/image.py b/tools/binman/image.py
index e113a60ac9..f237ae302d 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -139,10 +139,15 @@ class Image:
return self._section.GetEntries()
def WriteMap(self):
- """Write a map of the image to a .map file"""
+ """Write a map of the image to a .map file
+
+ Returns:
+ Filename of map file written
+ """
filename = '%s.map' % self._name
fname = tools.GetOutputFilename(filename)
with open(fname, 'w') as fd:
print('%8s %8s %8s %s' % ('ImagePos', 'Offset', 'Size', 'Name'),
file=fd)
self._section.WriteMap(fd, 0)
+ return fname