Firmware rollback FAFT test to check verified boot and TPM functionality.
This test requires a USB disk plugged-in, which contains a Chrome OS test
image (built by "build_image --test"). On runtime, this test rollbacks
firmware A and results firmware B boot. It then rollbacks firmware B and
results recovery boot.
BUG=chromium-os:19710
TEST=tested on Alex and Stumpy
$ run_remote_tests.sh --remote=$REMOTE_IP -a "xml_config=$OVERLAY_XML \
servo_serial=$SERIAL" firmware_RollbackFirmware/control$
Change-Id: I51dbde6fff35b15df7bb9364e5d47b7e3b2c827a
Reviewed-on: https://gerrit.chromium.org/gerrit/15476
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/client/cros/faft_client.py b/client/cros/faft_client.py
index e56cc16..5e97e88 100644
--- a/client/cros/faft_client.py
+++ b/client/cros/faft_client.py
@@ -60,7 +60,9 @@
self._flashrom_handler = flashrom_handler.FlashromHandler()
self._flashrom_handler.init(saft_flashrom_util,
- self._chromeos_interface)
+ self._chromeos_interface,
+ None,
+ '/usr/share/vboot/devkeys')
self._flashrom_handler.new_image()
self._kernel_handler = kernel_handler.KernelHandler()
@@ -262,6 +264,33 @@
self._flashrom_handler.restore_firmware_body(section)
+ def _modify_firmware_version(self, section, delta):
+ """Modify firmware version for the requested section, by adding delta.
+
+ The passed in delta, a positive or a negative number, is added to the
+ original firmware version.
+ """
+ original_version = self._flashrom_handler.get_section_version(section)
+ new_version = original_version + delta
+ flags = self._flashrom_handler.get_section_flags(section)
+ self._chromeos_interface.log(
+ 'Setting firmware section %s version from %d to %d' % (
+ section, original_version, new_version))
+ self._flashrom_handler.set_section_version(section, new_version, flags,
+ write_through=True)
+
+ @allow_multiple_section_input
+ def move_firmware_backward(self, section):
+ """Decrement firmware version for the requested section."""
+ self._modify_firmware_version(section, -1)
+
+
+ @allow_multiple_section_input
+ def move_firmware_forward(self, section):
+ """Increase firmware version for the requested section."""
+ self._modify_firmware_version(section, 1)
+
+
@allow_multiple_section_input
def corrupt_kernel(self, section):
"""Corrupt the requested kernel section.