summaryrefslogtreecommitdiff
path: root/recovery_main.cpp
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2018-08-21 13:10:45 -0700
committerDavid Anderson <dvander@google.com>2018-08-21 16:04:57 -0700
commiteee4e260f9f65cda362c073fdc62c2f897f331b7 (patch)
treea79922cb716be22ee38fbaca877c3763519d5f48 /recovery_main.cpp
parentfae088152838c3e562d06dac951d4d79b027d51b (diff)
recovery: Add "boot-fastboot" command to BCB.
This change adds a new "boot-fastboot" command in order to boot into fastboot without overwriting recovery tasks. This also allows bootloaders to boot directly into userspace fastboot from the bootloader menu, or via bootloader fastboot. Bug: 112277594 Test: adb reboot fastboot Change-Id: Ia0c9a0961a76c6cbe19486590179abaa50d93f58
Diffstat (limited to 'recovery_main.cpp')
-rw-r--r--recovery_main.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/recovery_main.cpp b/recovery_main.cpp
index 99f96509..020a5314 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -97,8 +97,13 @@ static std::vector<std::string> get_args(const int argc, char** const argv) {
}
stage = std::string(boot.stage);
+ std::string boot_command;
if (boot.command[0] != 0) {
- std::string boot_command = std::string(boot.command, sizeof(boot.command));
+ if (memchr(boot.command, '\0', sizeof(boot.command))) {
+ boot_command = std::string(boot.command);
+ } else {
+ boot_command = std::string(boot.command, sizeof(boot.command));
+ }
LOG(INFO) << "Boot command: " << boot_command;
}
@@ -149,6 +154,12 @@ static std::vector<std::string> get_args(const int argc, char** const argv) {
LOG(ERROR) << "Failed to set BCB message: " << err;
}
+ // Finally, if no arguments were specified, check whether we should boot
+ // into fastboot.
+ if (args.size() == 1 && boot_command == "boot-fastboot") {
+ args.emplace_back("--fastboot");
+ }
+
return args;
}