Merge "recovery: Add "boot-fastboot" command to BCB." am: 0115b79cbd am: 4ba5c3c7de
am: e105c4996f
Change-Id: Id4244f83eaf4fb8b1fdb2156d6f780bc2702804e
diff --git a/recovery_main.cpp b/recovery_main.cpp
index 99f9650..020a531 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -97,8 +97,13 @@
}
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 @@
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;
}