summaryrefslogtreecommitdiffstats
path: root/bootloader_message
diff options
context:
space:
mode:
authorMatt Mower <mowerm@gmail.com>2014-07-09 18:50:05 +0200
committerDees Troy <dees_troy@teamw.in>2017-02-02 17:03:12 +0100
commit8df3191beed34f7cbfc0bfd4041c692f8b98d9a2 (patch)
tree2b63a8ef3f33a81b94d0a0d34ff88afc2ac230c9 /bootloader_message
parentgui: Fix Android.mk for TW_CUSTOM_THEME (diff)
downloadandroid_bootable_recovery-8df3191beed34f7cbfc0bfd4041c692f8b98d9a2.tar
android_bootable_recovery-8df3191beed34f7cbfc0bfd4041c692f8b98d9a2.tar.gz
android_bootable_recovery-8df3191beed34f7cbfc0bfd4041c692f8b98d9a2.tar.bz2
android_bootable_recovery-8df3191beed34f7cbfc0bfd4041c692f8b98d9a2.tar.lz
android_bootable_recovery-8df3191beed34f7cbfc0bfd4041c692f8b98d9a2.tar.xz
android_bootable_recovery-8df3191beed34f7cbfc0bfd4041c692f8b98d9a2.tar.zst
android_bootable_recovery-8df3191beed34f7cbfc0bfd4041c692f8b98d9a2.zip
Diffstat (limited to 'bootloader_message')
-rw-r--r--bootloader_message/bootloader_message.cpp5
-rw-r--r--bootloader_message/include/bootloader_message/bootloader_message.h5
2 files changed, 9 insertions, 1 deletions
diff --git a/bootloader_message/bootloader_message.cpp b/bootloader_message/bootloader_message.cpp
index 4d1ce5bb4..449f40e11 100644
--- a/bootloader_message/bootloader_message.cpp
+++ b/bootloader_message/bootloader_message.cpp
@@ -159,7 +159,10 @@ static bool write_misc_partition(const void* p, size_t size, size_t offset, std:
*err = "no misc device set";
return false;
}
- int fd = (open(misc_blk_device.c_str(), O_WRONLY | O_SYNC));
+ int open_flags = O_WRONLY | O_SYNC;
+ if (offset > 0)
+ open_flags = O_RDWR | O_APPEND | O_SYNC;
+ int fd = (open(misc_blk_device.c_str(), open_flags));
if (fd == -1) {
*err = "failed to open " + misc_blk_device + ": ";
*err += strerror(errno);
diff --git a/bootloader_message/include/bootloader_message/bootloader_message.h b/bootloader_message/include/bootloader_message/bootloader_message.h
index 52d733105..e0fc2cd8a 100644
--- a/bootloader_message/include/bootloader_message/bootloader_message.h
+++ b/bootloader_message/include/bootloader_message/bootloader_message.h
@@ -25,8 +25,13 @@
// 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
*