Browse Source

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
Alessandro Astone 4 years ago
parent
commit
548d6c8d31

+ 8
- 0
bootloader_message/Android.bp View File

@@ -26,4 +26,12 @@ cc_library_static {
26 26
         "libfs_mgr",
27 27
     ],
28 28
     export_include_dirs: ["include"],
29
+
30
+    product_variables: {
31
+        lineage: {
32
+            bootloader_message_offset : {
33
+                cflags: ["-DBOARD_RECOVERY_BLDRMSG_OFFSET=%d"],
34
+            },
35
+        },
36
+    },
29 37
 }

+ 10
- 0
bootloader_message/bootloader_message.cpp View File

@@ -29,6 +29,16 @@
29 29
 #include <android-base/unique_fd.h>
30 30
 #include <fs_mgr.h>
31 31
 
32
+// Spaces used by misc partition are as below:
33
+// 0   - 2K     For bootloader_message
34
+// 2K  - 16K    Used by Vendor's bootloader (the 2K - 4K range may be optionally used
35
+//              as bootloader_message_ab struct)
36
+// 16K - 64K    Used by uncrypt and recovery to store wipe_package for A/B devices
37
+// Note that these offsets are admitted by bootloader,recovery and uncrypt, so they
38
+// are not configurable without changing all of them.
39
+static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = BOARD_RECOVERY_BLDRMSG_OFFSET;
40
+static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024 + BOOTLOADER_MESSAGE_OFFSET_IN_MISC;
41
+
32 42
 static std::string get_misc_blk_device(std::string* err) {
33 43
   std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)> fstab(fs_mgr_read_fstab_default(),
34 44
                                                              fs_mgr_free_fstab);

+ 0
- 10
bootloader_message/include/bootloader_message/bootloader_message.h View File

@@ -21,16 +21,6 @@
21 21
 #include <stddef.h>
22 22
 #include <stdint.h>
23 23
 
24
-// Spaces used by misc partition are as below:
25
-// 0   - 2K     For bootloader_message
26
-// 2K  - 16K    Used by Vendor's bootloader (the 2K - 4K range may be optionally used
27
-//              as bootloader_message_ab struct)
28
-// 16K - 64K    Used by uncrypt and recovery to store wipe_package for A/B devices
29
-// Note that these offsets are admitted by bootloader,recovery and uncrypt, so they
30
-// are not configurable without changing all of them.
31
-static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = 0;
32
-static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024;
33
-
34 24
 /* Bootloader Message (2-KiB)
35 25
  *
36 26
  * This structure describes the content of a block in flash