From 180fd6f2baf51cc437c8ba84b053b2b9ed2cca11 Mon Sep 17 00:00:00 2001 From: Lee Campbell Date: Tue, 14 Jun 2016 16:17:12 -0700 Subject: Fix A/B slot_suffix location The slot_suffix has moved to after bootloader_message BUG: 29193360 Change-Id: I3b29b5bd515a57c9be472dc572797f6300b44b89 --- peripheral/bootctrl/bootctrl.c | 6 +++--- peripheral/bootctrl/bootctrl.h | 12 +++++++----- peripheral/bootctrl/hal.mk | 1 + 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'peripheral') diff --git a/peripheral/bootctrl/bootctrl.c b/peripheral/bootctrl/bootctrl.c index 9e8626b..8d6feb9 100644 --- a/peripheral/bootctrl/bootctrl.c +++ b/peripheral/bootctrl/bootctrl.c @@ -207,7 +207,7 @@ int bootctrl_mark_boot_successful(boot_control_module_t *module __unused) { int ret, slot; boot_ctrl_t metadata; - slot_metadata_t *slotp; + slot_metadata_intel_t *slotp; ret = bootctrl_read_metadata(&metadata); if (ret < 0) { @@ -233,7 +233,7 @@ int bootctrl_set_active_boot_slot(boot_control_module_t *module __unused, { int ret, slot2; boot_ctrl_t metadata; - slot_metadata_t *slotp; + slot_metadata_intel_t *slotp; if (slot >= 2) { fprintf(stderr, "Wrong Slot value %u\n", slot); @@ -273,7 +273,7 @@ int bootctrl_set_slot_as_unbootable(boot_control_module_t *module __unused, { int ret; boot_ctrl_t metadata; - slot_metadata_t *slotp; + slot_metadata_intel_t *slotp; if (slot >= 2) { fprintf(stderr, "Wrong Slot value %u\n", slot); diff --git a/peripheral/bootctrl/bootctrl.h b/peripheral/bootctrl/bootctrl.h index 8febd4f..4e2fc11 100644 --- a/peripheral/bootctrl/bootctrl.h +++ b/peripheral/bootctrl/bootctrl.h @@ -21,9 +21,11 @@ #include +#include + /* struct boot_ctrl occupies the slot_suffix field of - * struct bootloader_message */ -#define OFFSETOF_SLOT_SUFFIX 864 + * struct bootloader_message_ab */ +#define OFFSETOF_SLOT_SUFFIX offsetof(struct bootloader_message_ab, slot_suffix) #define BOOTCTRL_MAGIC 0x42424100 #define BOOTCTRL_SUFFIX_A "_a" @@ -31,11 +33,11 @@ #define BOOT_CONTROL_VERSION 1 -typedef struct slot_metadata { +typedef struct slot_metadata_intel { uint8_t priority : 4; uint8_t tries_remaining : 3; uint8_t successful_boot : 1; -} slot_metadata_t; +} slot_metadata_intel_t; typedef struct boot_ctrl { /* Magic for identification - '\0ABB' (Boot Contrl Magic) */ @@ -45,7 +47,7 @@ typedef struct boot_ctrl { uint8_t version; /* Information about each slot. */ - slot_metadata_t slot_info[2]; + slot_metadata_intel_t slot_info[2]; uint8_t recovery_tries_remaining; } boot_ctrl_t; diff --git a/peripheral/bootctrl/hal.mk b/peripheral/bootctrl/hal.mk index cb18a78..ad7dd45 100644 --- a/peripheral/bootctrl/hal.mk +++ b/peripheral/bootctrl/hal.mk @@ -19,6 +19,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := bootctrl.$(TARGET_DEVICE) LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SRC_FILES := bootctrl.c +LOCAL_C_INCLUDES += bootable/recovery/ LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) -- cgit v1.2.3