vboot2: Add previously tried slot and result to NV storage

This gives recovery mode information on two boots back instead of one,
which may be handy for debugging.

It also allows determining whether a failure of the current boot
should try the other slot or go to recovery, using only information
stored in NV storage.

Added crossystem support for printing the fields, and unit tests.

BUG=chrome-os-partner:32585
BRANCH=none
TEST=make runtests; VBOOT2=1 make runtests

Change-Id: Ia9f4186210d30217b902db7c513ae4ab8851f8f4
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/221230
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
This commit is contained in:
Randall Spangler
2014-09-23 12:20:31 -07:00
committed by chrome-internal-fetch
parent 80872dbffc
commit 782300d093
9 changed files with 96 additions and 4 deletions

View File

@@ -74,9 +74,13 @@ enum vb2_nv_param {
VB2_NV_FW_TRIED,
/* Result of trying that firmware (see vb2_fw_result) */
VB2_NV_FW_RESULT,
/* Firmware slot tried previous boot (0=A, 1=B) */
VB2_NV_FW_PREV_TRIED,
/* Result of trying that firmware (see vb2_fw_result) */
VB2_NV_FW_PREV_RESULT,
};
/* Result of trying the firmware in VB2_NV_FW_TRIED */
/* Firmware result codes for VB2_NV_FW_RESULT and VB2_NV_FW_PREV_RESULT */
enum vb2_fw_result {
/* Unknown */
VB2_FW_RESULT_UNKNOWN = 0,