finalize: Support FPMCU FW write protection
BUG=b:141172626
TEST=manaully test on DUT
Change-Id: I7095d291ca628a418e74dc4c11673e737985db65
Reviewed-on: https://chromium-review.googlesource.com/1900503
Tested-by: Philip Chen <philipchen@chromium.org>
Commit-Ready: Philip Chen <philipchen@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
diff --git a/py/gooftool/commands.py b/py/gooftool/commands.py
index 06be772..6d47682 100755
--- a/py/gooftool/commands.py
+++ b/py/gooftool/commands.py
@@ -382,6 +382,16 @@
ro_offset, ro_size)
crosfw.Flashrom(fw.target).EnableWriteProtection(ro_offset, ro_size)
+ if HasFpmcu():
+ # TODO(b/143991572): Implement enable_fpmcu_write_protection in gooftool.
+ cmd = os.path.join(
+ paths.FACTORY_DIR, 'sh', 'enable_fpmcu_write_protection.sh')
+ cmd_result = Shell(cmd)
+ if not cmd_result.success:
+ raise Error(
+ 'Failed to enable FPMCU write protection, stdout=%r, stderr=%r' %
+ (cmd_result.stdout, cmd_result.stderr))
+
WriteProtect(crosfw.LoadMainFirmware())
event_log.Log('wp', fw='main')