Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ced3ce6d authored by Alessandro Astone's avatar Alessandro Astone Committed by Michael Bestas
Browse files

recovery: Allow custom bootloader msg offset in block misc

Squash of changes
  * Allow custom bootloader msg offset in block misc
    Change-Id: I6f3de1c2e3745c5535c3b95399abb8b2e2d01446

  * recovery: Move bldrmsg offset symbols to bootloader_message.cpp
    Change-Id: I2b902bcce7f5ca13472e0ac30ac01b4991294dbe

Adapted for Android.bp version of libbootloader_message

Change-Id: I5768660569d56b0d7c358f562e79483fd5f6db53
parent e61adcc1
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -26,4 +26,12 @@ cc_library_static {
        "libfs_mgr",
    ],
    export_include_dirs: ["include"],

    product_variables: {
        lineage: {
            bootloader_message_offset : {
                cflags: ["-DBOARD_RECOVERY_BLDRMSG_OFFSET=%d"],
            },
        },
    },
}
+10 −0
Original line number Diff line number Diff line
@@ -29,6 +29,16 @@
#include <android-base/unique_fd.h>
#include <fs_mgr.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.
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 get_misc_blk_device(std::string* err) {
  std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)> fstab(fs_mgr_read_fstab_default(),
                                                             fs_mgr_free_fstab);
+0 −10
Original line number Diff line number Diff line
@@ -21,16 +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.
static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = 0;
static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024;

/* Bootloader Message (2-KiB)
 *
 * This structure describes the content of a block in flash