summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2020-05-15 16:26:03 -0700
committerCommit Bot <commit-bot@chromium.org>2020-05-20 00:12:30 +0000
commit8a85d198bc5c4e3384779774a447f2d0bd7a5813 (patch)
treedc5461b70167223b9e26e01e88842994cd0bf4ae
parentca83aee50469799a9b70b03ef6bd3fc1e86d6c38 (diff)
downloadchrome-ec-8a85d198bc5c4e3384779774a447f2d0bd7a5813.tar.gz
ap_ro_flash.py: add new values and clean up
Add new error values reported by the VENDOR_CC_SEED_AP_RO_CHECK vendor command, and clean up the command line error processing to report all collected errors instead of just complaining that the ranges were not specified in the command line. BUG=b:153764696 TEST=used the script and observed expected error values reported. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I0f5e6a28776af2afc550bd2c44e6cc3a0cb80153 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2204977 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
-rwxr-xr-xutil/ap_ro_hash.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/util/ap_ro_hash.py b/util/ap_ro_hash.py
index 2961a51f1f..a432eccfba 100755
--- a/util/ap_ro_hash.py
+++ b/util/ap_ro_hash.py
@@ -514,6 +514,9 @@ def main(args):
3 : 'Bad offset value',
4 : 'Bad range size',
5 : 'Already programmed',
+ 6 : 'Flash write failed',
+ 7 : 'BID programmed',
+ 8 : 'Flash erase failed',
VENDOR_RC_NO_SUCH_COMMAND_ERROR : 'Insufficient C50 version',
}
@@ -545,9 +548,6 @@ def main(args):
continue
ranges.append(fmap[arg])
- if not ranges:
- raise ApRoHashCmdLineError('no hashing ranges specified')
-
error_msg = ''
if bad_ranges:
error_msg += 'Ranges %s not valid\n' % ' '.join(bad_ranges)
@@ -555,14 +555,19 @@ def main(args):
error_msg += ('Section(s) "%s" not in FMAP\n' %
'" "'.join(bad_section_names))
- # Make sure the list is sorted by the first element.
- ranges.sort(key=lambda x: x[0])
+ if ranges:
+ # Make sure the list is sorted by the first element.
+ ranges.sort(key=lambda x: x[0])
+
+ # Make sure ranges do not overlap and fall into the WP_RO section.
+ error_msg += verify_ranges(ranges, fmap['WP_RO'])
- # Make sure ranges do not overlap and fall into the WP_RO section.
- error_msg += verify_ranges(ranges, fmap['WP_RO'])
if error_msg:
raise ApRoHashCmdLineError(error_msg)
+ if not ranges:
+ raise ApRoHashCmdLineError('no hashing ranges specified')
+
ro_check_file = os.path.join(tmpd, 'ro_check.bin')
read_ro_ranges(ro_check_file, tmpd, ranges)
digest = calculate_hash(ro_check_file, ranges)