diff options
Diffstat (limited to 'bootloader.cpp')
-rw-r--r-- | bootloader.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/bootloader.cpp b/bootloader.cpp index 600d238..9e91b27 100644 --- a/bootloader.cpp +++ b/bootloader.cpp @@ -34,8 +34,8 @@ static int set_bootloader_message_block(const struct bootloader_message *in, con int get_bootloader_message(struct bootloader_message *out) { Volume* v = volume_for_path("/misc"); if (v == NULL) { - LOGE("Cannot load volume /misc!\n"); - return -1; + LOGI("Cannot load volume /misc.\n"); + return -1; } if (strcmp(v->fs_type, "mtd") == 0) { return get_bootloader_message_mtd(out, v); @@ -49,8 +49,8 @@ int get_bootloader_message(struct bootloader_message *out) { int set_bootloader_message(const struct bootloader_message *in) { Volume* v = volume_for_path("/misc"); if (v == NULL) { - LOGE("Cannot load volume /misc!\n"); - return -1; + LOGI("Cannot load volume /misc.\n"); + return -1; } if (strcmp(v->fs_type, "mtd") == 0) { return set_bootloader_message_mtd(in, v); @@ -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) { @@ -185,11 +188,14 @@ static int get_bootloader_message_block(struct bootloader_message *out, static int set_bootloader_message_block(const struct bootloader_message *in, const Volume* v) { wait_for_device(v->blk_device); - FILE* f = fopen(v->blk_device, "wb"); + FILE* f = fopen(v->blk_device, "rb+"); if (f == NULL) { 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)); |