summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2018-10-19 14:59:13 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-11-19 16:28:25 -0800
commit8c52481794295a40c878277357978e309f7f32a0 (patch)
tree0f150f79e3b093d60cde011020dbef7a56657702
parent0f7779862ca4b4973f52c7b851c65ccb8d9cd147 (diff)
downloadvboot-8c52481794295a40c878277357978e309f7f32a0.tar.gz
crossystem: add alt_os_enabled to show Alt OS state
Some user-space applications need to know whether Alt OS is currently enabled or disabled. Add alt_os_enabled to crossystem as a read-only flag for this purpose. It is currently based off of reading VBSD_ALT_OS_SHOW_PICKER from VbSharedDataHeader. We may want to change that to a field dedicated to showing Alt OS state in the future (see b/117195332). BUG=b:117195332,b:117142023 TEST=emerge-eve vboot_reference && \ cros deploy --force --board=eve dut vboot_reference Change-Id: Ic9a120e7d24021eb984d501f09ce4d7b6f85d730 Reviewed-on: https://chromium-review.googlesource.com/1328390 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r--host/lib/crossystem.c5
-rw-r--r--utility/crossystem.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index 0ed88e65..7d5903d6 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -579,6 +579,11 @@ int VbGetSystemPropertyInt(const char *name)
value = vb2_get_nv_storage(VB2_NV_DISABLE_ALT_OS_REQUEST);
} else if (!strcasecmp(name, "post_ec_sync_delay")) {
value = vb2_get_nv_storage(VB2_NV_POST_EC_SYNC_DELAY);
+ } else if (!strcasecmp(name, "alt_os_enabled")) {
+ /* TODO(b/117195332): Change this to read from a field
+ * dedicated to storing Alt OS state. */
+ value = !!(GetVdatInt(VDAT_INT_FLAGS)
+ & VBSD_ALT_OS_SHOW_PICKER);
}
return value;
diff --git a/utility/crossystem.c b/utility/crossystem.c
index d7443487..bef0108f 100644
--- a/utility/crossystem.c
+++ b/utility/crossystem.c
@@ -57,6 +57,7 @@ const Param sys_param_list[] = {
{"enable_alt_os_request", CAN_WRITE, "Enable AltOS mode on next boot"},
{"post_ec_sync_delay", CAN_WRITE,
"Short delay after EC software sync (persistent, writable, eve only)"},
+ {"alt_os_enabled", 0, "Alt OS state (1 if enabled, 0 if disabled)"},
{"fmap_base", 0, "Main firmware flashmap physical address", "0x%08x"},
{"fw_prev_result", IS_STRING, "Firmware result of previous boot (vboot2)"},
{"fw_prev_tried", IS_STRING, "Firmware tried on previous boot (vboot2)"},