Merge "Add 'reboot bootloader' to bootloader_message."
am: a5538b87e8
Change-Id: I432f48453d2627e165fda7cda1945157ff0e83ae
This commit is contained in:
commit
118e814bfe
2 changed files with 22 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue