autotest: Support the flow to update RW firmware for BIOS and EC
This change completes the flow to update RW firmware, through
CrosHost.firmware_install(), Servo.program_bios()/Servo.program_ec(),
ProgrammerV3RwOnly.program_bios(), to FlashromProgrammer.program().
BUG=chromium:555709
TEST=Ran the following script:
import common
from autotest_lib.server import hosts
h = hosts.create_host(DUT_IP, servo_args={})
h.firmware_install(RO_VERSION)
h.firmware_install(RW_VERSION, rw_only=True)
Checked the DUT installed the proper RO and RW firmware (BIOS and EC).
Change-Id: I5dfca7b3d80c6cd23b0c1e3d2605fce008bd60b2
Reviewed-on: https://chromium-review.googlesource.com/320825
Commit-Ready: Wai-Hong Tam <waihong@chromium.org>
Tested-by: Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/server/cros/servo/firmware_programmer.py b/server/cros/servo/firmware_programmer.py
index 7f312f3..afd994b 100644
--- a/server/cros/servo/firmware_programmer.py
+++ b/server/cros/servo/firmware_programmer.py
@@ -399,3 +399,38 @@
"""
self._ec_programmer.prepare_programmer(image)
self._ec_programmer.program()
+
+
+class ProgrammerV3RwOnly(object):
+ """Main programmer class which provides programmer for only updating the RW
+ portion of BIOS with servo V3.
+
+ It does nothing on EC, as EC software sync on the next boot will
+ automatically overwrite the EC RW portion, using the EC RW image inside
+ the BIOS RW image.
+
+ """
+
+ def __init__(self, servo):
+ self._servo = servo
+ self._bios_programmer = FlashromProgrammer(servo, keep_ro=True)
+
+
+ def program_bios(self, image):
+ """Programs the DUT with provide bios image.
+
+ @param image: (required) location of bios image file.
+
+ """
+ self._bios_programmer.prepare_programmer(image)
+ self._bios_programmer.program()
+
+
+ def program_ec(self, image):
+ """Programs the DUT with provide ec image.
+
+ @param image: (required) location of ec image file.
+
+ """
+ # Do nothing. EC software sync will update the EC RW.
+ pass