diff options
author | Mary Ruthven <mruthven@google.com> | 2015-10-06 10:42:31 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-10-13 14:02:26 -0700 |
commit | 12a55f255aaea2f12362e4f832a0bd48eb29f5dd (patch) | |
tree | f235ebf2cd846c852371a96cf76e3282ff0c26be /host/lib/crossystem.c | |
parent | 73a6372d22f74d0396253f6e5080442edec55d7f (diff) | |
download | vboot-12a55f255aaea2f12362e4f832a0bd48eb29f5dd.tar.gz |
Add NV flag to default boot legacy OS
In developer mode, this option will make the system try to boot into
a legacy OS first after the 30 second timeout. This removes the need to
press a key during boot to try legacy mode and the need to remove the
write protect screw to boot legacy as default.
BUG=chromium:310697
BRANCH=none
TEST=make runtests
Change-Id: I9a9f64c14ad015e21d08eec36e8fc187189cd2f2
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/304077
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'host/lib/crossystem.c')
-rw-r--r-- | host/lib/crossystem.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c index 3080344d..e2066cee 100644 --- a/host/lib/crossystem.c +++ b/host/lib/crossystem.c @@ -61,6 +61,7 @@ typedef enum VbBuildOption { } VbBuildOption; static const char *fw_results[] = {"unknown", "trying", "success", "failure"}; +static const char *default_boot[] = {"disk", "usb", "legacy"}; /* Masks for kern_nv usage by kernel. */ #define KERN_NV_FWUPDATE_TRIES_MASK 0x0000000F @@ -586,6 +587,12 @@ const char* VbGetSystemPropertyString(const char* name, char* dest, return fw_results[v]; else return "unknown"; + } else if (!strcasecmp(name,"dev_default_boot")) { + int v = VbGetNvStorage(VBNV_DEV_DEFAULT_BOOT); + if (v < ARRAY_SIZE(default_boot)) + return default_boot[v]; + else + return "unknown"; } return NULL; @@ -694,6 +701,14 @@ int VbSetSystemPropertyString(const char* name, const char* value) { return VbSetNvStorage(VBNV_FW_RESULT, i); } return -1; + } else if (!strcasecmp(name, "dev_default_boot")) { + int i; + + for (i = 0; i < ARRAY_SIZE(default_boot); i++) { + if (!strcasecmp(value, default_boot[i])) + return VbSetNvStorage(VBNV_DEV_DEFAULT_BOOT, i); + } + return -1; } return -1; |