faft: Check difference between kernel A and B before copying
In kernel related FAFTs, we copy kernel and rootfs from A to B in order
to ensure our next boot (maybe B) successful. We can first check them
before copying to save time. It can reduce 3~5min each test.
Because the signature (some kind of hash) for the kernel body is stored
in the beginning. So compare the first 64KB (including header, preamble,
and signature) should be enough to check them identical.
BUG=chromium-os:22826
TEST=manaul
Make kernel A and B different by installing a new kernel to A.
Run a kernel related FAFT, like CorruptKernelA, to see the copy happened.
Run it again, to see the copy not happened. Because A and B are identical.
Change-Id: If49433168f2a5e02eb349a4c669208ca9b7c5ac6
Reviewed-on: https://gerrit.chromium.org/gerrit/30390
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/faftsequence.py b/server/cros/faftsequence.py
index 677bde6..9998431 100644
--- a/server/cros/faftsequence.py
+++ b/server/cros/faftsequence.py
@@ -661,8 +661,10 @@
part: A string of kernel partition number or 'a'/'b'.
"""
if not self.root_part_checker(part):
- self.copy_kernel_and_rootfs(from_part=self.OTHER_KERNEL_MAP[part],
- to_part=part)
+ if self.faft_client.diff_kernel_a_b():
+ self.copy_kernel_and_rootfs(
+ from_part=self.OTHER_KERNEL_MAP[part],
+ to_part=part)
self.run_faft_step({
'userspace_action': (self.reset_and_prioritize_kernel, part),
})
@@ -910,8 +912,9 @@
part: A string of kernel partition number or 'a'/'b'.
"""
self.ensure_kernel_boot(part)
- self.copy_kernel_and_rootfs(from_part=part,
- to_part=self.OTHER_KERNEL_MAP[part])
+ if self.faft_client.diff_kernel_a_b():
+ self.copy_kernel_and_rootfs(from_part=part,
+ to_part=self.OTHER_KERNEL_MAP[part])
self.reset_and_prioritize_kernel(part)