init: allow reboot recovery on devices without bootloader
if there is no /misc partition it makes no sense to wait and block
Change-Id: I4a69fef9e3e750c569adff28eb8e474d8c5cc87d
diff --git a/init/reboot.cpp b/init/reboot.cpp
index 150f8f4..a55e9e1 100644
--- a/init/reboot.cpp
+++ b/init/reboot.cpp
@@ -1071,16 +1071,18 @@
}
} else if (reboot_target == "recovery") {
bootloader_message boot = {};
- if (std::string err; !read_bootloader_message(&boot, &err)) {
- LOG(ERROR) << "Failed to read bootloader message: " << err;
- }
- // Update the boot command field if it's empty, and preserve
- // the other arguments in the bootloader message.
- if (!CommandIsPresent(&boot)) {
- strlcpy(boot.command, "boot-recovery", sizeof(boot.command));
- if (std::string err; !write_bootloader_message(boot, &err)) {
- LOG(ERROR) << "Failed to set bootloader message: " << err;
- return;
+ if (std::string err; !get_misc_blk_device(&err).empty()) {
+ if (std::string err; !read_bootloader_message(&boot, &err)) {
+ LOG(ERROR) << "Failed to read bootloader message: " << err;
+ }
+ // Update the boot command field if it's empty, and preserve
+ // the other arguments in the bootloader message.
+ if (!CommandIsPresent(&boot)) {
+ strlcpy(boot.command, "boot-recovery", sizeof(boot.command));
+ if (std::string err; !write_bootloader_message(boot, &err)) {
+ LOG(ERROR) << "Failed to set bootloader message: " << err;
+ return;
+ }
}
}
} else if (std::find(cmd_params.begin(), cmd_params.end(), "quiescent")