diff options
author | Vineela Tummalapalli <vineela.tummalapalli@intel.com> | 2016-11-10 03:52:18 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-11-10 03:52:18 +0100 |
commit | 118e814bfeae5f761255dd34577b8865ac6d28d1 (patch) | |
tree | 260c86656f36c1856f9046d4df9f738a32a2ec76 /bootloader_message | |
parent | Merge "Touch blocks in care_map in update_verifier" (diff) | |
parent | Merge "Add 'reboot bootloader' to bootloader_message." (diff) | |
download | android_bootable_recovery-118e814bfeae5f761255dd34577b8865ac6d28d1.tar android_bootable_recovery-118e814bfeae5f761255dd34577b8865ac6d28d1.tar.gz android_bootable_recovery-118e814bfeae5f761255dd34577b8865ac6d28d1.tar.bz2 android_bootable_recovery-118e814bfeae5f761255dd34577b8865ac6d28d1.tar.lz android_bootable_recovery-118e814bfeae5f761255dd34577b8865ac6d28d1.tar.xz android_bootable_recovery-118e814bfeae5f761255dd34577b8865ac6d28d1.tar.zst android_bootable_recovery-118e814bfeae5f761255dd34577b8865ac6d28d1.zip |
Diffstat (limited to 'bootloader_message')
-rw-r--r-- | bootloader_message/bootloader_message.cpp | 18 | ||||
-rw-r--r-- | bootloader_message/include/bootloader_message/bootloader_message.h | 4 |
2 files changed, 22 insertions, 0 deletions
diff --git a/bootloader_message/bootloader_message.cpp b/bootloader_message/bootloader_message.cpp index e0c95d223..16e8df14f 100644 --- a/bootloader_message/bootloader_message.cpp +++ b/bootloader_message/bootloader_message.cpp @@ -164,6 +164,19 @@ bool write_bootloader_message(const std::vector<std::string>& options, std::stri return write_bootloader_message(boot, err); } +bool write_reboot_bootloader(std::string* err) { + bootloader_message boot; + if (!read_bootloader_message(&boot, err)) { + return false; + } + if (boot.command[0] != '\0') { + *err = "Bootloader command pending."; + return false; + } + strlcpy(boot.command, "bootonce-bootloader", sizeof(boot.command)); + return write_bootloader_message(boot, err); +} + bool read_wipe_package(std::string* package_data, size_t size, std::string* err) { package_data->resize(size); return read_misc_partition(&(*package_data)[0], size, WIPE_PACKAGE_OFFSET_IN_MISC, err); @@ -174,6 +187,11 @@ bool write_wipe_package(const std::string& package_data, std::string* err) { WIPE_PACKAGE_OFFSET_IN_MISC, err); } +extern "C" bool write_reboot_bootloader(void) { + std::string err; + return write_reboot_bootloader(&err); +} + extern "C" bool write_bootloader_message(const char* options) { std::string err; return write_bootloader_message({options}, &err); diff --git a/bootloader_message/include/bootloader_message/bootloader_message.h b/bootloader_message/include/bootloader_message/bootloader_message.h index f343c64ac..75d2acaf2 100644 --- a/bootloader_message/include/bootloader_message/bootloader_message.h +++ b/bootloader_message/include/bootloader_message/bootloader_message.h @@ -184,6 +184,9 @@ bool write_bootloader_message(const bootloader_message& boot, std::string* err); bool write_bootloader_message(const std::vector<std::string>& options, std::string* err); bool clear_bootloader_message(std::string* err); +// Writes the reboot-bootloader reboot reason to the bootloader_message. +bool write_reboot_bootloader(std::string* err); + bool read_wipe_package(std::string* package_data, size_t size, std::string* err); bool write_wipe_package(const std::string& package_data, std::string* err); @@ -193,6 +196,7 @@ bool write_wipe_package(const std::string& package_data, std::string* err); // C Interface. bool write_bootloader_message(const char* options); +bool write_reboot_bootloader(void); #endif // ifdef __cplusplus |