Allow custom bootloader msg offset in block misc

Globally define BOARD_RECOVERY_BLDRMSG_OFFSET with a decimal integer
to offset the read/write location in misc where the bootloader message
should appear. Example:

  BOARD_GLOBAL_CFLAGS := -DBOARD_RECOVERY_BLDRMSG_OFFSET=2048

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: Ifdb5ffe3e893a651be59ae63e3a0ebadd828c9f2
This commit is contained in:
Matt Mower
2014-07-09 11:50:05 -05:00
committed by Dees Troy
parent 6e4114f8b7
commit 8df3191bee
4 changed files with 12 additions and 5 deletions

View File

@@ -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);