Support overriding of the bml partition used for boot and recovery. This is not ideal, because that means that there are different flash_image binaries for different samsung phones. But as far as I know, there is no way to find out which bml device is boot or recovery.
Change-Id: I5e3b83dd9267a275def003182c1bd5d2cf585896
diff --git a/bmlutils/bmlutils.c b/bmlutils/bmlutils.c
index 9ef04b4..db80501 100644
--- a/bmlutils/bmlutils.c
+++ b/bmlutils/bmlutils.c
@@ -23,6 +23,13 @@
extern int __system(const char *command);
#define BML_UNLOCK_ALL 0x8A29 ///< unlock all partition RO -> RW
+#ifndef BOARD_BML_BOOT
+#define BOARD_BML_BOOT "/dev/block/bml7"
+#endif
+
+#ifndef BOARD_BML_RECOVERY
+#define BOARD_BML_RECOVERY "/dev/block/bml8"
+#endif
static int restore_internal(const char* bml, const char* filename)
{
@@ -66,13 +73,13 @@
// always restore boot, regardless of whether recovery or boot is flashed.
// this is because boot and recovery are the same on some samsung phones.
// unless of course, recoveryonly is explictly chosen (bml8)
- ret = restore_internal("/dev/block/bml7", filename);
+ ret = restore_internal(BOARD_BML_BOOT, filename);
if (ret != 0)
return ret;
}
if (strcmp(partition, "recovery") == 0 || strcmp(partition, "recoveryonly") == 0)
- ret = restore_internal("/dev/block/bml8", filename);
+ ret = restore_internal(BOARD_BML_RECOVERY, filename);
return ret;
}
@@ -80,9 +87,9 @@
{
char* bml;
if (strcmp("boot", partition) == 0)
- bml = "/dev/block/bml7";
+ bml = BOARD_BML_BOOT;
else if (strcmp("recovery", partition) == 0)
- bml = "/dev/block/bml8";
+ bml = BOARD_BML_RECOVERY;
else {
printf("Invalid partition.\n");
return -1;