summaryrefslogtreecommitdiff
path: root/tools/binman/fmap_util.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-09-14 04:57:34 -0600
committerSimon Glass <sjg@chromium.org>2018-09-29 11:49:35 -0600
commitf8f8df6eb870b53e025aa447f8d40cd2ce2a77f6 (patch)
tree855c9fc502d44854dd969a1ea671088c09f089a9 /tools/binman/fmap_util.py
parent08723a7abbc7e28b22d18684faf5142fc6f155e8 (diff)
binman: Correct fmap output on x86
Normally x86 platforms use the end-at-4gb option. This currently produces an FMAP with positions which have a large offset. The use of end-at-4gb is a useful convenience within binman, but we don't really want to export a map with these offsets. Fix this by subtracting the 'skip at start' parameter. Also put the code which convers names to fmap format, for clarity. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/fmap_util.py')
-rw-r--r--tools/binman/fmap_util.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/binman/fmap_util.py b/tools/binman/fmap_util.py
index 7d520e3391..be3cbee87b 100644
--- a/tools/binman/fmap_util.py
+++ b/tools/binman/fmap_util.py
@@ -49,6 +49,9 @@ FmapHeader = collections.namedtuple('FmapHeader', FMAP_HEADER_NAMES)
FmapArea = collections.namedtuple('FmapArea', FMAP_AREA_NAMES)
+def NameToFmap(name):
+ return name.replace('\0', '').replace('-', '_').upper()
+
def ConvertName(field_names, fields):
"""Convert a name to something flashrom likes
@@ -62,7 +65,7 @@ def ConvertName(field_names, fields):
value: value of that field (string for the ones we support)
"""
name_index = field_names.index('name')
- fields[name_index] = fields[name_index].replace('\0', '').replace('-', '_').upper()
+ fields[name_index] = NameToFmap(fields[name_index])
def DecodeFmap(data):
"""Decode a flashmap into a header and list of areas
@@ -100,6 +103,7 @@ def EncodeFmap(image_size, name, areas):
"""
def _FormatBlob(fmt, names, obj):
params = [getattr(obj, name) for name in names]
+ ConvertName(names, params)
return struct.pack(fmt, *params)
values = FmapHeader(FMAP_SIGNATURE, 1, 0, 0, image_size, name, len(areas))