diff options
author | Mary Ruthven <mruthven@chromium.org> | 2022-05-18 12:08:56 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-05-19 14:29:46 +0000 |
commit | ad1750d53ab6f287d5587a241be09e470c012a7b (patch) | |
tree | 966d5928b287da76425a5a9c91b712d5dc2bf9c5 | |
parent | fae3eadee0f68caab5671a1125d6ac8d46c2bc92 (diff) | |
download | chrome-ec-ad1750d53ab6f287d5587a241be09e470c012a7b.tar.gz |
ap_ro_hash: use dump_fmap flashrom format
Use the dump_fmap flashrom output to calculate the offset and size. All
of the information is included on one line.
BUG=none
TEST=ap_ro_hash.py -v GBB True
Change-Id: I160173caaaf540c20786e892d244ee8a941833b6
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3654254
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rwxr-xr-x | util/ap_ro_hash.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/util/ap_ro_hash.py b/util/ap_ro_hash.py index f43493d902..1cc016c4cf 100755 --- a/util/ap_ro_hash.py +++ b/util/ap_ro_hash.py @@ -382,23 +382,21 @@ def read_fmap(tmpd): """ fmap_file = os.path.join(tmpd, 'fmap.bin') run('flashrom -i FMAP -r %s' % fmap_file, ignore_error=False) - fmap_text = run('dump_fmap ' + fmap_file, ignore_error=False)[0] + fmap_text = run('dump_fmap -F ' + fmap_file, ignore_error=False)[0] fmap = {} offset = 0 size = 0 for line in fmap_text.splitlines(): - tokens = line.split() - if tokens[0] == 'area_offset:': - offset = int(tokens[1], 16) - continue - if tokens[0] == 'area_size:': - size = int(tokens[1], 16) - continue - if tokens[0] == 'area_name:': - fmap[tokens[1]] = (offset, size) - LOG.log('%20s: %08x:%08x' % (tokens[1], offset, offset + size - 1)) - continue + # line format + # start_offset:end_offset secton_name + r, name = line.split() + start, end = r.split(':') + offset = int(start, 16) + end_offset = int(end, 16) + size = end_offset - offset + 1 + fmap[name] = (offset, size) + LOG.log('%20s 0x%08x:0x%08x %s' % (name, offset, size, r)) return fmap |