summaryrefslogtreecommitdiffstats
path: root/fastboot/fastboot.cpp
diff options
context:
space:
mode:
authorHridya Valsaraju <hridya@google.com>2018-07-17 11:14:01 -0700
committerHridya Valsaraju <hridya@google.com>2018-08-02 09:43:23 -0700
commitdea91b4b5354af2f9470845cb05cca1207142c98 (patch)
tree43feca6abba0a331b255b8f995fc9f296d8cd068 /fastboot/fastboot.cpp
parentff01e542850718844d14d207de14a57eae708d2a (diff)
downloadsystem_core-dea91b4b5354af2f9470845cb05cca1207142c98.tar.gz
system_core-dea91b4b5354af2f9470845cb05cca1207142c98.tar.bz2
system_core-dea91b4b5354af2f9470845cb05cca1207142c98.zip
Add fastbootd.
Fastbootd is started by recovery, and communicates over usb with the fastboot protocol. Add additional fastboot commands to move in and out of fastbootd. "fastboot reboot recovery" and "fastboot reboot fastboot" Bug: 78793464 Test: fastboot reboot recovery, fastboot reboot fastboot Change-Id: Iffb77b2d3ceefb7335c38aa9fba7bd17821484f0
Diffstat (limited to 'fastboot/fastboot.cpp')
-rw-r--r--fastboot/fastboot.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 263ea1780..5aef85e5c 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1327,6 +1327,8 @@ int FastBootTool::Main(int argc, char* argv[]) {
bool wants_wipe = false;
bool wants_reboot = false;
bool wants_reboot_bootloader = false;
+ bool wants_reboot_recovery = false;
+ bool wants_reboot_fastboot = false;
bool skip_reboot = false;
bool wants_set_active = false;
bool skip_secondary = false;
@@ -1549,6 +1551,12 @@ int FastBootTool::Main(int argc, char* argv[]) {
if (what == "bootloader") {
wants_reboot = false;
wants_reboot_bootloader = true;
+ } else if (what == "recovery") {
+ wants_reboot = false;
+ wants_reboot_recovery = true;
+ } else if (what == "fastboot") {
+ wants_reboot = false;
+ wants_reboot_fastboot = true;
} else {
syntax_error("unknown reboot target %s", what.c_str());
}
@@ -1557,6 +1565,10 @@ int FastBootTool::Main(int argc, char* argv[]) {
if (!args.empty()) syntax_error("junk after reboot command");
} else if (command == "reboot-bootloader") {
wants_reboot_bootloader = true;
+ } else if (command == "reboot-recovery") {
+ wants_reboot_recovery = true;
+ } else if (command == "reboot-fastboot") {
+ wants_reboot_fastboot = true;
} else if (command == "continue") {
fb_queue_command("continue", "resuming boot");
} else if (command == "boot") {
@@ -1674,6 +1686,12 @@ int FastBootTool::Main(int argc, char* argv[]) {
} else if (wants_reboot_bootloader) {
fb_queue_command("reboot-bootloader", "rebooting into bootloader");
fb_queue_wait_for_disconnect();
+ } else if (wants_reboot_recovery) {
+ fb_queue_command("reboot-recovery", "rebooting into recovery");
+ fb_queue_wait_for_disconnect();
+ } else if (wants_reboot_fastboot) {
+ fb_queue_command("reboot-fastboot", "rebooting into fastboot");
+ fb_queue_wait_for_disconnect();
}
int status = fb_execute_queue() ? EXIT_FAILURE : EXIT_SUCCESS;