summaryrefslogtreecommitdiff
path: root/host/lib/crossystem.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2014-09-23 12:20:31 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-04 00:59:48 +0000
commit782300d093a2fbf2ca24e446fb6d65f9f28e56a6 (patch)
tree07e711928061b4b1c19845ca6bb17f4992ae5487 /host/lib/crossystem.c
parent80872dbffcb2e0079bfe095d770ccc6c8bd5fd7a (diff)
downloadvboot-782300d093a2fbf2ca24e446fb6d65f9f28e56a6.tar.gz
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>
Diffstat (limited to 'host/lib/crossystem.c')
-rw-r--r--host/lib/crossystem.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index d6555c67..b28fd877 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -560,6 +560,14 @@ const char* VbGetSystemPropertyString(const char* name, char* dest,
return fw_results[v];
else
return "unknown";
+ } else if (!strcasecmp(name, "fw_prev_tried")) {
+ return VbGetNvStorage(VBNV_FW_PREV_TRIED) ? "B" : "A";
+ } else if (!strcasecmp(name, "fw_prev_result")) {
+ int v = VbGetNvStorage(VBNV_FW_PREV_RESULT);
+ if (v < ARRAY_SIZE(fw_results))
+ return fw_results[v];
+ else
+ return "unknown";
}
return NULL;