Merge "Implement Reboot bootloader via bootloader_message"
am: e759c83bde

Change-Id: Id0a0e9e9c10f3df206138f297d2acafa87dc4ebf
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 0206644..9d1bb80 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -708,6 +708,15 @@
             callback_on_ro_remount = unmount_and_fsck;
         } else if (cmd == ANDROID_RB_RESTART2) {
             reboot_target = &command[len + 1];
+            // When rebooting to the bootloader notify the bootloader writing
+            // also the BCB.
+            if (strcmp(reboot_target, "bootloader") == 0) {
+                std::string err;
+                if (!write_reboot_bootloader(&err)) {
+                    LOG(ERROR) << "reboot-bootloader: Error writing "
+                                  "bootloader_message: " << err;
+                }
+            }
         }
     } else if (command[len] != '\0') {
         LOG(ERROR) << "powerctl: unrecognized reboot target '" << &command[len] << "'";