From 4eff651c8380f452a91f517313859e6fc6c4a4d6 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Fri, 10 Jun 2011 09:12:52 -0700 Subject: [PATCH 1/4] 4.0.0.1 Change-Id: I0824973915621b86b41bace2abeeb5012cd1ffef --- Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Android.mk b/Android.mk index 91f3a66..cd67016 100644 --- a/Android.mk +++ b/Android.mk @@ -26,7 +26,7 @@ LOCAL_MODULE := recovery LOCAL_FORCE_STATIC_EXECUTABLE := true -RECOVERY_VERSION := ClockworkMod Recovery v4.0.0.0 +RECOVERY_VERSION := ClockworkMod Recovery v4.0.0.1 LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)" RECOVERY_API_VERSION := 2 LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION) From 94caefedb7758b6d520bb98a7e9a7befb57312f4 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Fri, 10 Jun 2011 09:17:30 -0700 Subject: [PATCH 2/4] move the sdcard symlinker into process_volumes Change-Id: I863fbeadea8428c7809260522316c493a6ea33ea --- extendedcommands.c | 6 +++++- recovery.c | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extendedcommands.c b/extendedcommands.c index 9439739..b32ca0b 100644 --- a/extendedcommands.c +++ b/extendedcommands.c @@ -1105,7 +1105,11 @@ int bml_check_volume(const char *path) { void process_volumes() { create_fstab(); - + if (volume_for_path("/sdcard") == NULL) { + rmdir("/sdcard"); + symlink("/data/media", "/sdcard"); + } + return; // dead code. diff --git a/recovery.c b/recovery.c index 51b5366..52d3879 100644 --- a/recovery.c +++ b/recovery.c @@ -795,10 +795,6 @@ main(int argc, char **argv) { return busybox_driver(argc, argv); } __system("/sbin/postrecoveryboot.sh"); - if (volume_for_path("/sdcard") == NULL) { - rmdir("/sdcard"); - symlink("/data/media", "/sdcard"); - } int is_user_initiated_recovery = 0; time_t start = time(NULL); From 38a921435a4050acb0d1db1c3299a131039ea1c6 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Fri, 10 Jun 2011 09:45:52 -0700 Subject: [PATCH 3/4] make tar backups opt in. Change-Id: Ib01131f3a65ce4114e73abe2c7ba42263d281844 --- extendedcommands.c | 6 +++--- nandroid.c | 22 ++++++++++++++++++++++ roots.c | 18 ++++++++++++++---- roots.h | 3 +++ 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/extendedcommands.c b/extendedcommands.c index b32ca0b..4395377 100644 --- a/extendedcommands.c +++ b/extendedcommands.c @@ -1105,9 +1105,9 @@ int bml_check_volume(const char *path) { void process_volumes() { create_fstab(); - if (volume_for_path("/sdcard") == NULL) { - rmdir("/sdcard"); - symlink("/data/media", "/sdcard"); + + if (is_data_media()) { + setup_data_media(); } return; diff --git a/nandroid.c b/nandroid.c index 8cee3be..5a32a76 100644 --- a/nandroid.c +++ b/nandroid.c @@ -139,6 +139,17 @@ static nandroid_backup_handler get_backup_handler(const char *backup_path) { return NULL; } + if (strcmp(backup_path, "/data") == 0 && is_data_media()) { + return tar_compress_wrapper; + } + + char str[255]; + char* partition; + property_get("ro.cwm.prefer_tar", str, "false"); + if (strcmp("true", str) != 0) { + return mkyaffs2image_wrapper; + } + if (strcmp("yaffs2", mv->filesystem) == 0) { return mkyaffs2image_wrapper; } @@ -345,6 +356,17 @@ static nandroid_restore_handler get_restore_handler(const char *backup_path) { return NULL; } + if (strcmp(backup_path, "/data") == 0 && is_data_media()) { + return tar_extract_wrapper; + } + + char str[255]; + char* partition; + property_get("ro.cwm.prefer_tar", str, "false"); + if (strcmp("true", str) != 0) { + return unyaffs_wrapper; + } + if (strcmp("yaffs2", mv->filesystem) == 0) { return unyaffs_wrapper; } diff --git a/roots.c b/roots.c index 49b7729..fa7a5df 100644 --- a/roots.c +++ b/roots.c @@ -164,17 +164,27 @@ int try_mount(const char* device, const char* mount_point, const char* fs_type, return ret; } +int is_data_media() { + Volume *data = volume_for_path("/data"); + return data != NULL && strcmp(data->fs_type, "auto") == 0 && volume_for_path("/sdcard") == NULL; +} + +void setup_data_media() { + rmdir("/sdcard"); + mkdir("/data/media", 0755); + symlink("/data/media", "/sdcard"); +} + int ensure_path_mounted(const char* path) { Volume* v = volume_for_path(path); if (v == NULL) { // no /sdcard? let's assume /data/media - if (strstr(path, "/sdcard") == path) { + if (strstr(path, "/sdcard") == path && is_data_media()) { LOGW("using /data/media, no /sdcard found.\n"); int ret; if (0 != (ret = ensure_path_mounted("/data"))) return ret; - rmdir("/sdcard"); - symlink("/data/media", "/sdcard"); + setup_data_media(); return 0; } LOGE("unknown volume for path [%s]\n", path); @@ -245,7 +255,7 @@ int ensure_path_unmounted(const char* path) { Volume* v = volume_for_path(path); if (v == NULL) { // no /sdcard? let's assume /data/media - if (strstr(path, "/sdcard") == path) { + if (strstr(path, "/sdcard") == path && is_data_media()) { return ensure_path_unmounted("/data"); } LOGE("unknown volume for path [%s]\n", path); diff --git a/roots.h b/roots.h index 7132fed..7914307 100644 --- a/roots.h +++ b/roots.h @@ -42,4 +42,7 @@ int get_num_volumes(); Volume* get_device_volumes(); +int is_data_media(); +void setup_data_media(); + #endif // RECOVERY_ROOTS_H_ From 4fbfc4610e417dc3780de1fd0cc948ba4240b00a Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Fri, 10 Jun 2011 10:52:31 -0700 Subject: [PATCH 4/4] 4.0.0.2 Change-Id: I6db9589e90f78e83201ebda90701b364223274d1 --- Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Android.mk b/Android.mk index cd67016..745473f 100644 --- a/Android.mk +++ b/Android.mk @@ -26,7 +26,7 @@ LOCAL_MODULE := recovery LOCAL_FORCE_STATIC_EXECUTABLE := true -RECOVERY_VERSION := ClockworkMod Recovery v4.0.0.1 +RECOVERY_VERSION := ClockworkMod Recovery v4.0.0.2 LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)" RECOVERY_API_VERSION := 2 LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)