Mark the new kernel invalid when starting an update.
Before we overwrite the new kernel, mark it as unbootable by setting the GPT
flags "successful" and "tries" to 0. This is good, but not critical as a
general behavior because it prevents the firmware from even trying a kernel
we think will be bad.
It's more useful, because it gives us a definitive way to know if the other
kernel is expected to be valid for purposes of things like rollback. There
will be a future CL to use it for preventing rollback to a known invalid
installation.
Also adds a MockHardware implementation backed by the FakeHardware
implementation, and switches MockSystemState to use it.
BUG=chromium:280816
TEST=Manual watching of flags, and multiple updates.
CQ-DEPEND=CL:176177
Change-Id: Idb083279cd1438a555c5165c69b25c351207e382
Reviewed-on: https://chromium-review.googlesource.com/176169
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index 0dfa7c4..ea307f5 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -613,10 +613,12 @@
false));
shared_ptr<OmahaResponseHandlerAction> response_handler_action(
new OmahaResponseHandlerAction(system_state_));
- shared_ptr<FilesystemCopierAction> filesystem_copier_action(
- new FilesystemCopierAction(system_state_, false, false));
+ // We start with the kernel so it's marked as invalid more quickly.
shared_ptr<FilesystemCopierAction> kernel_filesystem_copier_action(
new FilesystemCopierAction(system_state_, true, false));
+ shared_ptr<FilesystemCopierAction> filesystem_copier_action(
+ new FilesystemCopierAction(system_state_, false, false));
+
shared_ptr<OmahaRequestAction> download_started_action(
new OmahaRequestAction(system_state_,
new OmahaEvent(