Merge "bootloader_message: Add a magic header to the Virtual A/B message block."
am: f78b7a7b94
Change-Id: I81378cf209b929390c88bc83e51fd1f7bfa6fcb3
This commit is contained in:
@@ -365,13 +365,15 @@ bool InitMiscVirtualAbMessageIfNeeded() {
|
|||||||
return false;
|
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.
|
// Already initialized.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
message = {};
|
message = {};
|
||||||
message.version = MISC_VIRTUAL_AB_MESSAGE_VERSION;
|
message.version = MISC_VIRTUAL_AB_MESSAGE_VERSION;
|
||||||
|
message.magic = MISC_VIRTUAL_AB_MAGIC_HEADER;
|
||||||
if (!WriteMiscVirtualAbMessage(message, &err)) {
|
if (!WriteMiscVirtualAbMessage(message, &err)) {
|
||||||
LOG(ERROR) << "Could not write merge status: " << err;
|
LOG(ERROR) << "Could not write merge status: " << err;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -189,12 +189,14 @@ static_assert(sizeof(struct bootloader_control) ==
|
|||||||
// must be added to the end.
|
// must be added to the end.
|
||||||
struct misc_virtual_ab_message {
|
struct misc_virtual_ab_message {
|
||||||
uint8_t version;
|
uint8_t version;
|
||||||
|
uint32_t magic;
|
||||||
uint8_t merge_status; // IBootControl 1.1, MergeStatus enum.
|
uint8_t merge_status; // IBootControl 1.1, MergeStatus enum.
|
||||||
uint8_t source_slot; // Slot number when merge_status was written.
|
uint8_t source_slot; // Slot number when merge_status was written.
|
||||||
uint8_t reserved[61];
|
uint8_t reserved[57];
|
||||||
} __attribute__((packed));
|
} __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)
|
#if (__STDC_VERSION__ >= 201112L) || defined(__cplusplus)
|
||||||
static_assert(sizeof(struct misc_virtual_ab_message) == 64,
|
static_assert(sizeof(struct misc_virtual_ab_message) == 64,
|
||||||
|
|||||||
Reference in New Issue
Block a user