faft: also check the integrity of rootfs when checking kernel

Checking kernel alone is not enough to make sure the kernel is bootable.
We also need to check if the rootfs is good. Comparing the two rootfs
copies takes too long, so we only check if the kernel is good enough to
pass dmverity check.

BUG=None
TEST=Zero out part of rootfs B and run firmware_CorruptKernelA.

Change-Id: I475464e49d8cc2ae770b8f0952735603a89bc24f
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185811
diff --git a/client/cros/faft/rpc_functions.py b/client/cros/faft/rpc_functions.py
index 166af86..1146f84 100755
--- a/client/cros/faft/rpc_functions.py
+++ b/client/cros/faft/rpc_functions.py
@@ -16,6 +16,7 @@
                                                  firmware_updater,
                                                  flashrom_handler,
                                                  kernel_handler,
+                                                 rootfs_handler,
                                                  saft_flashrom_util,
                                                  tpm_handler,
                                                 )
@@ -139,6 +140,9 @@
                 'SHORT', self._chromeos_interface, self._system_get_root_dev(),
                 self._cgpt_handler)
 
+        self._rootfs_handler = rootfs_handler.RootfsHandler()
+        self._rootfs_handler.init(self._chromeos_interface)
+
         self._updater = firmware_updater.FirmwareUpdater(self._chromeos_interface)
 
         # Initialize temporary directory path
@@ -158,7 +162,7 @@
             method = method.rsplit('.', 1)[0]
 
         categories = ('system', 'bios', 'ec', 'kernel',
-                      'tpm', 'cgpt', 'updater')
+                      'tpm', 'cgpt', 'updater', 'rootfs')
         try:
             if method.split('.', 1)[0] in categories:
                 func = getattr(self, '_%s_%s' % (method.split('.', 1)[0],
@@ -758,6 +762,13 @@
         """Get updater's work directory path."""
         return self._updater.get_work_path()
 
+    def _rootfs_verify_rootfs(self, section):
+        """Verifies the integrity of the root FS.
+
+        @param section: The rootfs to verify. May be A or B.
+        """
+        return self._rootfs_handler.verify_rootfs(section)
+
     def cleanup(self):
         """Cleanup for the RPC server. Currently nothing."""
         pass