aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2016-11-18 14:01:26 -0600
committerTao Bao2016-11-18 14:04:48 -0600
commitbedf5fc11cea9cc6b92f37597fe8624d25b8d371 (patch)
tree20e6f71aeb7ea2615f1fad19abc8f28d821079fc /bootloader_message/include
parent23e785935e2e373a2f4882619b35b34bcd95a1e6 (diff)
downloadplatform-bootable-recovery-bedf5fc11cea9cc6b92f37597fe8624d25b8d371.tar.gz
platform-bootable-recovery-bedf5fc11cea9cc6b92f37597fe8624d25b8d371.tar.xz
platform-bootable-recovery-bedf5fc11cea9cc6b92f37597fe8624d25b8d371.zip
updater: Refactor set_stage() and get_stage() functions.
Add read_bootloader_message_from() and write_bootloader_message_to() to allow specifying the BCB device (/misc). Also add testcases for set_stage() and get_stage(). Test: recovery_component_test passes. Test: Build a recovery image and apply a two-step OTA package. Change-Id: If5ab06a1aaaea168d2a9e5dd63c07c0a3190e4ae
Diffstat (limited to 'bootloader_message/include')
-rw-r--r--bootloader_message/include/bootloader_message/bootloader_message.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/bootloader_message/include/bootloader_message/bootloader_message.h b/bootloader_message/include/bootloader_message/bootloader_message.h
index 5a5dd879..e45f4248 100644
--- a/bootloader_message/include/bootloader_message/bootloader_message.h
+++ b/bootloader_message/include/bootloader_message/bootloader_message.h
@@ -178,15 +178,33 @@ static_assert(sizeof(struct bootloader_control) ==
178#include <string> 178#include <string>
179#include <vector> 179#include <vector>
180 180
181// Read bootloader message into boot. Error message will be set in err.
181bool read_bootloader_message(bootloader_message* boot, std::string* err); 182bool read_bootloader_message(bootloader_message* boot, std::string* err);
183
184// Read bootloader message from the specified misc device into boot.
185bool read_bootloader_message_from(bootloader_message* boot, const std::string& misc_blk_device,
186 std::string* err);
187
188// Write bootloader message to BCB.
182bool write_bootloader_message(const bootloader_message& boot, std::string* err); 189bool write_bootloader_message(const bootloader_message& boot, std::string* err);
190
191// Write bootloader message to the specified BCB device.
192bool write_bootloader_message_to(const bootloader_message& boot,
193 const std::string& misc_blk_device, std::string* err);
194
195// Write bootloader message (boots into recovery with the options) to BCB.
183bool write_bootloader_message(const std::vector<std::string>& options, std::string* err); 196bool write_bootloader_message(const std::vector<std::string>& options, std::string* err);
197
198// Clear BCB.
184bool clear_bootloader_message(std::string* err); 199bool clear_bootloader_message(std::string* err);
185 200
186// Writes the reboot-bootloader reboot reason to the bootloader_message. 201// Writes the reboot-bootloader reboot reason to the bootloader_message.
187bool write_reboot_bootloader(std::string* err); 202bool write_reboot_bootloader(std::string* err);
188 203
204// Read the wipe package from BCB (from offset WIPE_PACKAGE_OFFSET_IN_MISC).
189bool read_wipe_package(std::string* package_data, size_t size, std::string* err); 205bool read_wipe_package(std::string* package_data, size_t size, std::string* err);
206
207// Write the wipe package into BCB (to offset WIPE_PACKAGE_OFFSET_IN_MISC).
190bool write_wipe_package(const std::string& package_data, std::string* err); 208bool write_wipe_package(const std::string& package_data, std::string* err);
191 209
192#else 210#else