faft: Add methods to backup and restore kernel

To make sure the kernel does not get changed when running a test, we
need methods to backup and restore the kernel partition.

BUG=chromium:215787
TEST=zero out kernel B and run firmware_CorruptKernelA. Check kernel B
is all zero after the test.

Change-Id: I80d4226416c53b952dc9550d045780d048bb5cef
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185320
Reviewed-by: Yusuf Mohsinally <mohsinally@chromium.org>
diff --git a/client/cros/faft/rpc_functions.py b/client/cros/faft/rpc_functions.py
index 6269d77..174a6c6 100755
--- a/client/cros/faft/rpc_functions.py
+++ b/client/cros/faft/rpc_functions.py
@@ -614,6 +614,26 @@
         """Resign kernel with temporary key."""
         self._kernel_handler.resign_kernel(section, key_path)
 
+    def _kernel_dump(self, section, kernel_path):
+        """Dump the specified kernel to a file.
+
+        @param section: The kernel to dump. May be A or B.
+        @param kernel_path: The path to the kernel image to be written.
+        """
+        self._kernel_handler.dump_kernel(section, kernel_path)
+
+    def _kernel_write(self, section, kernel_path):
+        """Write a kernel image to the specified section.
+
+        @param section: The kernel to dump. May be A or B.
+        @param kernel_path: The path to the kernel image.
+        """
+        self._kernel_handler.write_kernel(section, kernel_path)
+
+    def _kernel_get_sha(self, section):
+        """Return the SHA1 hash of the specified kernel section."""
+        return self._kernel_handler.get_sha(section)
+
     def _tpm_get_firmware_version(self):
         """Retrieve tpm firmware body version."""
         return self._tpm_handler.get_fw_version()