summaryrefslogtreecommitdiffstats
path: root/tools/binman/fmap_util.py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-09-30 18:16:51 -0400
committerTom Rini <trini@konsulko.com>2018-09-30 18:16:51 -0400
commitd24c1d0f4da3b081a4fedf7ae2a08790871f08d0 (patch)
tree30051c24000bbb640b6296c8a71a8e05f0cc06e4 /tools/binman/fmap_util.py
parent2c1e16b9d2e3a6138acf4ffd9866e47ddbe6d453 (diff)
parent31b8217e83a63d1c8c70edcdcdf5aff3b1791640 (diff)
downloadu-boot-d24c1d0f4da3b081a4fedf7ae2a08790871f08d0.tar.gz
u-boot-d24c1d0f4da3b081a4fedf7ae2a08790871f08d0.tar.xz
u-boot-d24c1d0f4da3b081a4fedf7ae2a08790871f08d0.zip
Merge git://git.denx.de/u-boot-dm
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))