diff --git a/Android.mk b/Android.mk index 31f0be7..6779312 100644 --- a/Android.mk +++ b/Android.mk @@ -39,7 +39,7 @@ LOCAL_MODULE := recovery LOCAL_FORCE_STATIC_EXECUTABLE := true -RECOVERY_VERSION := ClockworkMod Recovery v2.5.1.5 +RECOVERY_VERSION := ClockworkMod Recovery v2.5.1.8 LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)" RECOVERY_API_VERSION := 2 LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION) diff --git a/bmlutils/bmlutils.c b/bmlutils/bmlutils.c index 6062ac9..1cc28b2 100644 --- a/bmlutils/bmlutils.c +++ b/bmlutils/bmlutils.c @@ -23,14 +23,8 @@ extern int __system(const char *command); #define BML_UNLOCK_ALL 0x8A29 ///< unlock all partition RO -> RW -int cmd_bml_restore_raw_partition(const char *partition, const char *filename) +static int restore_internal(const char* bml, const char* filename) { - char *bml; - if (strcmp(partition, "boot") == 0 || strcmp(partition, "recovery") == 0) - bml = "/dev/block/bml7"; - else - return 6; - char buf[4096]; int dstfd, srcfd, bytes_read, bytes_written, total_read = 0; if (filename == NULL) @@ -54,14 +48,33 @@ int cmd_bml_restore_raw_partition(const char *partition, const char *filename) if (write(dstfd, buf, 4096) < 4096) return 5; } while(bytes_read == 4096); - + + close(dstfd); + close(srcfd); + return 0; } +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 + return 6; + + int ret = restore_internal("/dev/block/bml7", filename); + if (ret != 0) + return ret; + + ret = restore_internal("/dev/block/bml8", filename); + return ret; +} + int cmd_bml_backup_raw_partition(const char *partition, const char *filename) { char tmp[PATH_MAX]; - sprintf("dd of=%s if=/dev/block/bml7 bs=4096", filename); + sprintf(tmp, "dd of=%s if=/dev/block/bml7 bs=4096", filename); return __system(tmp); } diff --git a/flashutils/flash_image.c b/flashutils/flash_image.c index 560370c..3966c42 100644 --- a/flashutils/flash_image.c +++ b/flashutils/flash_image.c @@ -147,5 +147,8 @@ int main(int argc, char **argv) return 2; } - return restore_raw_partition(argv[1], argv[2]); + int ret = restore_raw_partition(argv[1], argv[2]); + if (ret != 0) + fprintf(stderr, "failed with error: %d\n", ret); + return ret; }