summaryrefslogtreecommitdiffstats
path: root/bootloader.cpp
diff options
context:
space:
mode:
authorMatt Mower <mowerm@gmail.com>2014-07-09 05:25:38 +0200
committerGerrit Code Review <gerrit2@gerrit>2014-07-16 16:09:51 +0200
commitfb60a94f0a1d24c0f6e548df8385cdea25eca758 (patch)
tree2512b6017706958df4d3d2d8525854ab0022cddc /bootloader.cpp
parentDo not wipe block misc on bootloader msg update (diff)
downloadandroid_bootable_recovery-fb60a94f0a1d24c0f6e548df8385cdea25eca758.tar
android_bootable_recovery-fb60a94f0a1d24c0f6e548df8385cdea25eca758.tar.gz
android_bootable_recovery-fb60a94f0a1d24c0f6e548df8385cdea25eca758.tar.bz2
android_bootable_recovery-fb60a94f0a1d24c0f6e548df8385cdea25eca758.tar.lz
android_bootable_recovery-fb60a94f0a1d24c0f6e548df8385cdea25eca758.tar.xz
android_bootable_recovery-fb60a94f0a1d24c0f6e548df8385cdea25eca758.tar.zst
android_bootable_recovery-fb60a94f0a1d24c0f6e548df8385cdea25eca758.zip
Diffstat (limited to 'bootloader.cpp')
-rw-r--r--bootloader.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/bootloader.cpp b/bootloader.cpp
index 033591274..3884c2870 100644
--- a/bootloader.cpp
+++ b/bootloader.cpp
@@ -258,6 +258,9 @@ static int get_bootloader_message_block(struct bootloader_message *out,
LOGE("Can't open %s\n(%s)\n", v->blk_device, strerror(errno));
return -1;
}
+#ifdef BOARD_RECOVERY_BLDRMSG_OFFSET
+ fseek(f, BOARD_RECOVERY_BLDRMSG_OFFSET, SEEK_SET);
+#endif
struct bootloader_message temp;
int count = fread(&temp, sizeof(temp), 1, f);
if (count != 1) {
@@ -280,6 +283,9 @@ static int set_bootloader_message_block(const struct bootloader_message *in,
LOGE("Can't open %s\n(%s)\n", v->blk_device, strerror(errno));
return -1;
}
+#ifdef BOARD_RECOVERY_BLDRMSG_OFFSET
+ fseek(f, BOARD_RECOVERY_BLDRMSG_OFFSET, SEEK_SET);
+#endif
int count = fwrite(in, sizeof(*in), 1, f);
if (count != 1) {
LOGE("Failed writing %s\n(%s)\n", v->blk_device, strerror(errno));
@@ -300,6 +306,9 @@ int get_bootloader_message_block_name(struct bootloader_message *out) {
LOGE("Can't open %s\n(%s)\n", device_name, strerror(errno));
return -1;
}
+#ifdef BOARD_RECOVERY_BLDRMSG_OFFSET
+ fseek(f, BOARD_RECOVERY_BLDRMSG_OFFSET, SEEK_SET);
+#endif
struct bootloader_message temp;
int count = fread(&temp, sizeof(temp), 1, f);
if (count != 1) {
@@ -322,6 +331,9 @@ int set_bootloader_message_block_name(const struct bootloader_message *in,
printf("Can't open %s\n(%s)\n", block_name, strerror(errno));
return -1;
}
+#ifdef BOARD_RECOVERY_BLDRMSG_OFFSET
+ fseek(f, BOARD_RECOVERY_BLDRMSG_OFFSET, SEEK_SET);
+#endif
int count = fwrite(in, sizeof(*in), 1, f);
if (count != 1) {
printf("Failed writing %s\n(%s)\n", block_name, strerror(errno));