recovery: Move bldrmsg offset symbols to bootloader_message.cpp

* bootloader_message.cpp is the only file using
  BOOTLOADER_MESSAGE_OFFSET_IN_MISC and WIPE_PACKAGE_OFFSET_IN_MISC,
  so we can move their definitions to the cpp.
  This prevents the need to set BOARD_RECOVERY_BLDRMSG_OFFSET
  in every module that includes the header.

* Global cflags are no longer supported Oreo and up,
  so set the BOARD_RECOVERY_BLDRMSG_OFFSET via make variable

* Simplify logic, always set BOARD_RECOVERY_BLDRMSG_OFFSET.

Change-Id: I2b902bcce7f5ca13472e0ac30ac01b4991294dbe
This commit is contained in:
Alessandro Astone
2019-12-22 20:21:16 +00:00
committed by bigbiff
parent 2923defaea
commit 7ec5fd9e6d
3 changed files with 15 additions and 15 deletions
+5
View File
@@ -31,5 +31,10 @@ LOCAL_CFLAGS := -Werror -std=c++11
ifeq ($(TW_IGNORE_MISC_WIPE_DATA), true)
LOCAL_CFLAGS += -DIGNORE_MISC_WIPE_DATA
endif
ifeq ($(BOOTLOADER_MESSAGE_OFFSET),)
LOCAL_CFLAGS += -DBOARD_RECOVERY_BLDRMSG_OFFSET=0
else
LOCAL_CFLAGS += -DBOARD_RECOVERY_BLDRMSG_OFFSET=$(BOOTLOADER_MESSAGE_OFFSET)
endif
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)
@@ -28,6 +28,16 @@
#include <string>
#include <vector>
// Spaces used by misc partition are as below:
// 0 - 2K For bootloader_message
// 2K - 16K Used by Vendor's bootloader (the 2K - 4K range may be optionally used
// as bootloader_message_ab struct)
// 16K - 64K Used by uncrypt and recovery to store wipe_package for A/B devices
// Note that these offsets are admitted by bootloader,recovery and uncrypt, so they
// are not configurable without changing all of them.
static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = BOARD_RECOVERY_BLDRMSG_OFFSET;
static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024 + BOOTLOADER_MESSAGE_OFFSET_IN_MISC;
static std::string misc_blkdev;
void set_misc_device(const char* name) {
@@ -21,21 +21,6 @@
#include <stddef.h>
#include <stdint.h>
// Spaces used by misc partition are as below:
// 0 - 2K For bootloader_message
// 2K - 16K Used by Vendor's bootloader (the 2K - 4K range may be optionally used
// as bootloader_message_ab struct)
// 16K - 64K Used by uncrypt and recovery to store wipe_package for A/B devices
// Note that these offsets are admitted by bootloader,recovery and uncrypt, so they
// are not configurable without changing all of them.
#ifdef BOARD_RECOVERY_BLDRMSG_OFFSET
static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = BOARD_RECOVERY_BLDRMSG_OFFSET;
static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024 + BOOTLOADER_MESSAGE_OFFSET_IN_MISC;
#else
static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = 0;
static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024;
#endif
/* Bootloader Message (2-KiB)
*
* This structure describes the content of a block in flash