From 195e06be59d1868b00544634da673a0eae3b103e Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sun, 29 May 2011 19:33:42 -0700 Subject: [PATCH 1/3] allow flashing only bml8 if explicitly specified. Change-Id: Ie0d282105413b3a448436c9ee69206718e924754 --- bmlutils/bmlutils.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bmlutils/bmlutils.c b/bmlutils/bmlutils.c index 9f8ee2f..d81cf11 100644 --- a/bmlutils/bmlutils.c +++ b/bmlutils/bmlutils.c @@ -61,13 +61,17 @@ int cmd_bml_restore_raw_partition(const char *partition, const char *filename) 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; + int ret = -1; + if (strcmp(partition, "recoveryonly") != 0) { + // 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); + if (ret != 0) + return ret; + } - if (strcmp(partition, "recovery") == 0) + if (strcmp(partition, "recovery") == 0 || strcmp(partition, "recoveryonly") == 0) ret = restore_internal("/dev/block/bml8", filename); return ret; } From b2d30187d6884ddbca35cd0fb81e55be2ab78f4c Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Mon, 30 May 2011 15:21:44 -0700 Subject: [PATCH 2/3] remove logging, fix bug Change-Id: Ia7d0f5e7cdf64235bb2142d9143fff3f289ad605 --- bmlutils/bmlutils.c | 2 +- flashutils/flashutils.c | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/bmlutils/bmlutils.c b/bmlutils/bmlutils.c index d81cf11..9ef04b4 100644 --- a/bmlutils/bmlutils.c +++ b/bmlutils/bmlutils.c @@ -58,7 +58,7 @@ static int restore_internal(const char* bml, const char* filename) int cmd_bml_restore_raw_partition(const char *partition, const char *filename) { - if (strcmp(partition, "boot") != 0 && strcmp(partition, "recovery") != 0) + if (strcmp(partition, "boot") != 0 && strcmp(partition, "recovery") != 0 && strcmp(partition, "recoveryonly") != 0) return 6; int ret = -1; diff --git a/flashutils/flashutils.c b/flashutils/flashutils.c index 2addc72..fa4b1f5 100644 --- a/flashutils/flashutils.c +++ b/flashutils/flashutils.c @@ -71,7 +71,6 @@ __system(const char *command) } int get_flash_type(const char* partitionType) { - printf("get_flash_type partitionType: %s\n", partitionType); int type = UNSUPPORTED; if (strcmp(partitionType, "mtd") == 0) type = MTD; @@ -79,7 +78,6 @@ int get_flash_type(const char* partitionType) { type = MMC; else if (strcmp(partitionType, "bml") == 0) type = BML; - printf("get_flash_type type: %d\n", type); return type; } @@ -97,10 +95,7 @@ static int detect_partition(const char *partitionType, const char *partition) type = get_flash_type(partitionType); } - printf("partitionType: %s\n", partitionType); - printf("partition: %s\n", partition); - printf("detected type: %d\n", type); - return type; + return type; } int restore_raw_partition(const char* partitionType, const char *partition, const char *filename) { From 01143a5630e9d5fd38652b1d848b26efb1a6e69d Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Mon, 30 May 2011 15:22:04 -0700 Subject: [PATCH 3/3] remove logging, fix bug Change-Id: Ie300222a3754a1ed7de5851a2298526a416da5d3 --- flashutils/flashutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flashutils/flashutils.c b/flashutils/flashutils.c index fa4b1f5..27f0c66 100644 --- a/flashutils/flashutils.c +++ b/flashutils/flashutils.c @@ -95,7 +95,7 @@ static int detect_partition(const char *partitionType, const char *partition) type = get_flash_type(partitionType); } - return type; + return type; } int restore_raw_partition(const char* partitionType, const char *partition, const char *filename) {