summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2019-11-22 21:16:10 +0100
committerandroid-build-merger <android-build-merger@google.com>2019-11-22 21:16:10 +0100
commitda8658b78b9e4fe3a13dd2447872ef38996aafbf (patch)
tree7bc15d8f2749bb75524470b3f7be7f4d9c99fd17
parentMerge "Clear the warm_reset flag after boot is successful" (diff)
parentMerge "bootloader_message: Add a magic header to the Virtual A/B message block." (diff)
downloadandroid_bootable_recovery-da8658b78b9e4fe3a13dd2447872ef38996aafbf.tar
android_bootable_recovery-da8658b78b9e4fe3a13dd2447872ef38996aafbf.tar.gz
android_bootable_recovery-da8658b78b9e4fe3a13dd2447872ef38996aafbf.tar.bz2
android_bootable_recovery-da8658b78b9e4fe3a13dd2447872ef38996aafbf.tar.lz
android_bootable_recovery-da8658b78b9e4fe3a13dd2447872ef38996aafbf.tar.xz
android_bootable_recovery-da8658b78b9e4fe3a13dd2447872ef38996aafbf.tar.zst
android_bootable_recovery-da8658b78b9e4fe3a13dd2447872ef38996aafbf.zip
-rw-r--r--boot_control/libboot_control.cpp4
-rw-r--r--bootloader_message/include/bootloader_message/bootloader_message.h6
2 files changed, 7 insertions, 3 deletions
diff --git a/boot_control/libboot_control.cpp b/boot_control/libboot_control.cpp
index 702183979..ab9ce971b 100644
--- a/boot_control/libboot_control.cpp
+++ b/boot_control/libboot_control.cpp
@@ -365,13 +365,15 @@ bool InitMiscVirtualAbMessageIfNeeded() {
return false;
}
- if (message.version == MISC_VIRTUAL_AB_MESSAGE_VERSION) {
+ if (message.version == MISC_VIRTUAL_AB_MESSAGE_VERSION &&
+ message.magic == MISC_VIRTUAL_AB_MAGIC_HEADER) {
// Already initialized.
return true;
}
message = {};
message.version = MISC_VIRTUAL_AB_MESSAGE_VERSION;
+ message.magic = MISC_VIRTUAL_AB_MAGIC_HEADER;
if (!WriteMiscVirtualAbMessage(message, &err)) {
LOG(ERROR) << "Could not write merge status: " << err;
return false;
diff --git a/bootloader_message/include/bootloader_message/bootloader_message.h b/bootloader_message/include/bootloader_message/bootloader_message.h
index a27e80bcc..9a482d423 100644
--- a/bootloader_message/include/bootloader_message/bootloader_message.h
+++ b/bootloader_message/include/bootloader_message/bootloader_message.h
@@ -189,12 +189,14 @@ static_assert(sizeof(struct bootloader_control) ==
// must be added to the end.
struct misc_virtual_ab_message {
uint8_t version;
+ uint32_t magic;
uint8_t merge_status; // IBootControl 1.1, MergeStatus enum.
uint8_t source_slot; // Slot number when merge_status was written.
- uint8_t reserved[61];
+ uint8_t reserved[57];
} __attribute__((packed));
-#define MISC_VIRTUAL_AB_MESSAGE_VERSION 1
+#define MISC_VIRTUAL_AB_MESSAGE_VERSION 2
+#define MISC_VIRTUAL_AB_MAGIC_HEADER 0x56740AB0
#if (__STDC_VERSION__ >= 201112L) || defined(__cplusplus)
static_assert(sizeof(struct misc_virtual_ab_message) == 64,