Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Unified Diff: gooftool

Issue 6788005: factory_test_tools: support write protection for ARM (Closed) Base URL: ssh://gitrw.chromium.org:9222/factory_test_tools.git@master
Patch Set: fix by reviewer's comments Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gft_wpfw.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gooftool
diff --git a/gooftool b/gooftool
index a76aace04d2259913706687d3f5807d898f96f31..07f794a8c65dd0f16e33baf423deeb0628bbde44 100755
--- a/gooftool
+++ b/gooftool
@@ -106,9 +106,9 @@ def MatchComponentsDatabases(db_path):
return matched_list
-def EnableWriteProtect(target):
+def EnableWriteProtect(target, image):
""" Enables and verifies firmware write protection. """
- return gft_wpfw.EnableWriteProtect(target)
+ return gft_wpfw.EnableWriteProtect(target, image)
def WriteGBB(db_file):
@@ -312,9 +312,23 @@ def wpfw():
if g_options.debug_dryrun_wpfw:
ErrorMsg('wpfw is by-passed. This device CANNOT be qualified.')
return True
- if EnableWriteProtect('ec') and EnableWriteProtect('bios'):
- return True
- ErrorDie('wpfw: failed to enable firmware write protection.')
+ hwcomp = InitializeHardwareComponents(do_probe=False)
+ # TODO(hungte) chrome-os-partner:3023 We need a cleaner way for EC detection,
+ # for examing using crossystem. Currently we only know there is no EC on arm.
+ with os.popen("uname -m") as uname_process:
+ arch = uname_process.read().strip()
+ read_binary = gft_common.ReadBinaryFile
+ target_set = [('ec', hwcomp.load_ec_firmware),
+ ('bios', hwcomp.load_main_firmware)]
+ if arch.startswith('arm'):
+ VerboseMsg('wpfw: ARM platform detected, ignore EC.')
+ assert target_set[0][0] == 'ec'
+ target_set = target_set[1:]
+ assert len(target_set)
+ for target_name, loader_api in target_set:
+ if not EnableWriteProtect(target_name, read_binary(loader_api())):
+ ErrorDie('wpfw: failed to enable firmware write protection.')
+ return True
@GFTLogCommand
« no previous file with comments | « gft_wpfw.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698