aboutsummaryrefslogtreecommitdiffstats
path: root/bootloader.cpp
diff options
context:
space:
mode:
authorMatt Mower <mowerm@gmail.com>2014-07-08 22:25:38 -0500
committerTom Marshall <tdm@cyngn.com>2015-11-25 15:35:47 -0800
commit21d3a8f8230ae4f1f9210d6ec40f92ae023ec43a (patch)
tree3a927f574cdadc1793342fbb1bbdef7c3af63e10 /bootloader.cpp
parentbea646deee644f24384caf321fb497dd530ba2f0 (diff)
downloadbootable_recovery-21d3a8f8230ae4f1f9210d6ec40f92ae023ec43a.zip
bootable_recovery-21d3a8f8230ae4f1f9210d6ec40f92ae023ec43a.tar.gz
bootable_recovery-21d3a8f8230ae4f1f9210d6ec40f92ae023ec43a.tar.bz2
Allow custom bootloader msg offset in block misc
Use board define BOARD_RECOVERY_BLDRMSG_OFFSET with a decimal integer to define a custom offset where the bootloader message should be read/written. Edify commands get_stage and set_stage need to be aware of the custom bootloader msg offset because they write the stage directly to the BCB. Change-Id: Id13a23dd41bb7d907b96d657b8e21eb839dfeaa9
Diffstat (limited to 'bootloader.cpp')
-rw-r--r--bootloader.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/bootloader.cpp b/bootloader.cpp
index dec296f..9e91b27 100644
--- a/bootloader.cpp
+++ b/bootloader.cpp
@@ -168,6 +168,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) {
@@ -190,6 +193,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));