aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYabin Cui2016-06-24 20:22:02 -0500
committerYabin Cui2016-06-30 13:02:38 -0500
commit2f272c0551f984e83bc5abaf240e0dddb38a3326 (patch)
treed1c787e5f647c51efc1ea3949d9506bd23222069 /bootloader.h
parent6074099cb91e017672bd827a9711b0bfb30ca4e1 (diff)
downloadplatform-bootable-recovery-2f272c0551f984e83bc5abaf240e0dddb38a3326.tar.gz
platform-bootable-recovery-2f272c0551f984e83bc5abaf240e0dddb38a3326.tar.xz
platform-bootable-recovery-2f272c0551f984e83bc5abaf240e0dddb38a3326.zip
Create bootloader_message static library.
bootloader_messages merges bootloader_message_writer and bootloader.cpp, so we can use the same library to manage bootloader_message in normal boot and recovery mode. Bug: 29582118 Change-Id: I9efdf776ef8f02b53911ff43a518e035e0c29618
Diffstat (limited to 'bootloader.h')
-rw-r--r--bootloader.h75
1 files changed, 2 insertions, 73 deletions
diff --git a/bootloader.h b/bootloader.h
index 88d54a5c..9c84a1cf 100644
--- a/bootloader.h
+++ b/bootloader.h
@@ -14,76 +14,5 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17#ifndef _RECOVERY_BOOTLOADER_H 17// TODO: Remove this file once we remove all places that include this file.
18#define _RECOVERY_BOOTLOADER_H 18#include "bootloader_message/include/bootloader_message/bootloader_message.h"
19
20#include <stddef.h>
21
22// Spaces used by misc partition are as below:
23// 0 - 2K Bootloader Message
24// 2K - 16K Used by Vendor's bootloader
25// 16K - 64K Used by uncrypt and recovery to store wipe_package for A/B devices
26// Note that these offsets are admitted by bootloader,recovery and uncrypt, so they
27// are not configurable without changing all of them.
28static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = 0;
29static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024;
30
31/* Bootloader Message
32 *
33 * This structure describes the content of a block in flash
34 * that is used for recovery and the bootloader to talk to
35 * each other.
36 *
37 * The command field is updated by linux when it wants to
38 * reboot into recovery or to update radio or bootloader firmware.
39 * It is also updated by the bootloader when firmware update
40 * is complete (to boot into recovery for any final cleanup)
41 *
42 * The status field is written by the bootloader after the
43 * completion of an "update-radio" or "update-hboot" command.
44 *
45 * The recovery field is only written by linux and used
46 * for the system to send a message to recovery or the
47 * other way around.
48 *
49 * The stage field is written by packages which restart themselves
50 * multiple times, so that the UI can reflect which invocation of the
51 * package it is. If the value is of the format "#/#" (eg, "1/3"),
52 * the UI will add a simple indicator of that status.
53 *
54 * The slot_suffix field is used for A/B implementations where the
55 * bootloader does not set the androidboot.ro.boot.slot_suffix kernel
56 * commandline parameter. This is used by fs_mgr to mount /system and
57 * other partitions with the slotselect flag set in fstab. A/B
58 * implementations are free to use all 32 bytes and may store private
59 * data past the first NUL-byte in this field.
60 */
61struct bootloader_message {
62 char command[32];
63 char status[32];
64 char recovery[768];
65
66 // The 'recovery' field used to be 1024 bytes. It has only ever
67 // been used to store the recovery command line, so 768 bytes
68 // should be plenty. We carve off the last 256 bytes to store the
69 // stage string (for multistage packages) and possible future
70 // expansion.
71 char stage[32];
72 char slot_suffix[32];
73 char reserved[192];
74};
75
76/* Read and write the bootloader command from the "misc" partition.
77 * These return zero on success.
78 */
79int get_bootloader_message(struct bootloader_message *out);
80int set_bootloader_message(const struct bootloader_message *in);
81
82#ifdef __cplusplus
83
84#include <string>
85
86bool read_wipe_package(size_t size, std::string* out);
87#endif
88
89#endif