From 03cf72a4f5897807da89cb06c03396cb892d457b Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Tue, 21 Dec 2010 15:14:21 -0800 Subject: [PATCH] fix restore Change-Id: I97d2bb16b364e701e9c37567b5c07e30be00fafb --- bmlutils/bmlutils.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bmlutils/bmlutils.c b/bmlutils/bmlutils.c index 1cc28b2..f63bc78 100644 --- a/bmlutils/bmlutils.c +++ b/bmlutils/bmlutils.c @@ -23,6 +23,7 @@ extern int __system(const char *command); #define BML_UNLOCK_ALL 0x8A29 ///< unlock all partition RO -> RW + static int restore_internal(const char* bml, const char* filename) { char buf[4096]; @@ -57,17 +58,17 @@ static int restore_internal(const char* bml, const char* filename) int cmd_bml_restore_raw_partition(const char *partition, const char *filename) { - char *bml; - if (strcmp(partition, "boot") == 0 || strcmp(partition, "recovery") == 0) - bml = "/dev/block/bml7"; - else + if (strcmp(partition, "boot") != 0 && strcmp(partition, "recovery") != 0) return 6; + // always restore boot, regardless of whether recovery or boot is flashed. + // this is because boot and recovery are the same on some samsung phones. int ret = restore_internal("/dev/block/bml7", filename); if (ret != 0) return ret; - ret = restore_internal("/dev/block/bml8", filename); + if (strcmp(partition, "recovery") == 0) + ret = restore_internal("/dev/block/bml8", filename); return ret; }