diff options
author | David Anderson <dvander@google.com> | 2019-11-05 23:43:29 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-11-05 23:43:29 +0100 |
commit | c9548fce847998d9b7c72cd9926078d7faf7fcc5 (patch) | |
tree | 5e00be37fe3565db457f525329bf228dfe0ecaae | |
parent | Merge "Start adbd in user mode if bootloader is unlocked" am: b65dd9cb0c am: e5288e6b69 (diff) | |
parent | Merge "bootloader_message: Carve out space reserved for system." am: 8243388d57 (diff) | |
download | android_bootable_recovery-c9548fce847998d9b7c72cd9926078d7faf7fcc5.tar android_bootable_recovery-c9548fce847998d9b7c72cd9926078d7faf7fcc5.tar.gz android_bootable_recovery-c9548fce847998d9b7c72cd9926078d7faf7fcc5.tar.bz2 android_bootable_recovery-c9548fce847998d9b7c72cd9926078d7faf7fcc5.tar.lz android_bootable_recovery-c9548fce847998d9b7c72cd9926078d7faf7fcc5.tar.xz android_bootable_recovery-c9548fce847998d9b7c72cd9926078d7faf7fcc5.tar.zst android_bootable_recovery-c9548fce847998d9b7c72cd9926078d7faf7fcc5.zip |
-rw-r--r-- | bootloader_message/bootloader_message.cpp | 7 | ||||
-rw-r--r-- | bootloader_message/include/bootloader_message/bootloader_message.h | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/bootloader_message/bootloader_message.cpp b/bootloader_message/bootloader_message.cpp index b15a9b9fd..f838930fd 100644 --- a/bootloader_message/bootloader_message.cpp +++ b/bootloader_message/bootloader_message.cpp @@ -250,6 +250,13 @@ bool write_wipe_package(const std::string& package_data, std::string* err) { if (misc_blk_device.empty()) { return false; } + static constexpr size_t kMaximumWipePackageSize = + SYSTEM_SPACE_OFFSET_IN_MISC - WIPE_PACKAGE_OFFSET_IN_MISC; + if (package_data.size() > kMaximumWipePackageSize) { + *err = "Wipe package size " + std::to_string(package_data.size()) + " exceeds " + + std::to_string(kMaximumWipePackageSize) + " bytes"; + return false; + } return write_misc_partition(package_data.data(), package_data.size(), misc_blk_device, WIPE_PACKAGE_OFFSET_IN_MISC, err); } diff --git a/bootloader_message/include/bootloader_message/bootloader_message.h b/bootloader_message/include/bootloader_message/bootloader_message.h index b78783083..e3425fc8b 100644 --- a/bootloader_message/include/bootloader_message/bootloader_message.h +++ b/bootloader_message/include/bootloader_message/bootloader_message.h @@ -25,12 +25,15 @@ // 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 +// 16K - 32K Used by uncrypt and recovery to store wipe_package for A/B devices +// 32K - 64K System space, used for miscellanious AOSP features. See below. // Note that these offsets are admitted by bootloader,recovery and uncrypt, so they // are not configurable without changing all of them. constexpr size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = 0; constexpr size_t VENDOR_SPACE_OFFSET_IN_MISC = 2 * 1024; constexpr size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024; +constexpr size_t SYSTEM_SPACE_OFFSET_IN_MISC = 32 * 1024; +constexpr size_t SYSTEM_SPACE_SIZE_IN_MISC = 32 * 1024; /* Bootloader Message (2-KiB) * |