aboutsummaryrefslogtreecommitdiffstats
path: root/bmlutils
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2011-07-07 12:55:02 -0700
committerKoushik Dutta <koushd@gmail.com>2011-07-07 12:55:02 -0700
commita75c067df4a08df6e734aba607c941eef7f261e0 (patch)
treed3521d5bdd77d0ed479d9afb354c7806b5bb7e00 /bmlutils
parent50732e3c67454e174f008ba5443b21070f360a56 (diff)
downloadbootable_recovery-a75c067df4a08df6e734aba607c941eef7f261e0.zip
bootable_recovery-a75c067df4a08df6e734aba607c941eef7f261e0.tar.gz
bootable_recovery-a75c067df4a08df6e734aba607c941eef7f261e0.tar.bz2
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
Diffstat (limited to 'bmlutils')
-rw-r--r--bmlutils/Android.mk10
-rw-r--r--bmlutils/bmlutils.c15
2 files changed, 20 insertions, 5 deletions
diff --git a/bmlutils/Android.mk b/bmlutils/Android.mk
index e95cb5f..6d9ab83 100644
--- a/bmlutils/Android.mk
+++ b/bmlutils/Android.mk
@@ -1,7 +1,15 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_CFLAGS += -DBOARD_BOOT_DEVICE=\"$(BOARD_BOOT_DEVICE)\"
+
+BOARD_RECOVERY_DEFINES := BOARD_BML_BOOT BOARD_BML_RECOVERY
+
+$(foreach board_define,$(BOARD_RECOVERY_DEFINES), \
+ $(if $($(board_define)), \
+ $(eval LOCAL_CFLAGS += -D$(board_define)=\"$($(board_define))\") \
+ ) \
+ )
+
LOCAL_SRC_FILES := bmlutils.c
LOCAL_MODULE := libbmlutils
LOCAL_MODULE_TAGS := eng
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 @@ int cmd_bml_restore_raw_partition(const char *partition, const char *filename)
// 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 @@ int cmd_bml_backup_raw_partition(const char *partition, const char *out_file)
{
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;