bml devices that are using rfs are automatically upgraded to ext4. Version 3.0.0.0.
Change-Id: I069f0c5122e8d48ce311f519f08890d3e569dbb3
diff --git a/Android.mk b/Android.mk
index 6d94c17..e4a3ad0 100644
--- a/Android.mk
+++ b/Android.mk
@@ -25,7 +25,7 @@
LOCAL_FORCE_STATIC_EXECUTABLE := true
-RECOVERY_VERSION := ClockworkMod Recovery v2.5.1.8
+RECOVERY_VERSION := ClockworkMod Recovery v3.0.0.0
LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
RECOVERY_API_VERSION := 2
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
diff --git a/common.h b/common.h
index 7d46cc0..a4acc39 100644
--- a/common.h
+++ b/common.h
@@ -112,6 +112,7 @@
const char* device2; // alternative device to try if fs_type
// == "ext4" or "vfat" and mounting
// 'device' fails
+ const char* fallback_fs_type;
} Volume;
#endif // RECOVERY_COMMON_H
diff --git a/extendedcommands.c b/extendedcommands.c
index 762b15a..7c97979 100644
--- a/extendedcommands.c
+++ b/extendedcommands.c
@@ -914,6 +914,58 @@
LOGI("Completed outputting fstab.\n");
}
+int bml_check_volume(const char *path) {
+ ui_print("Checking %s...\n", path);
+ ensure_path_unmounted(path);
+ if (0 == ensure_path_mounted(path)) {
+ ensure_path_unmounted(path);
+ return 0;
+ }
+
+ Volume *vol = volume_for_path(path);
+ if (vol == NULL) {
+ LOGE("Unable process volume! Skipping...\n");
+ return 0;
+ }
+
+ ui_print("%s may be rfs. Checking...\n");
+ char tmp[PATH_MAX];
+ sprintf(tmp, "mount -t rfs %s %s", vol->device, path);
+ int ret = __system(tmp);
+ printf("%d\n", ret);
+ return ret == 0 ? 1 : 0;
+}
+
+void process_volumes() {
+ create_fstab();
+
+ if (device_flash_type() != BML)
+ return;
+
+ ui_print("Checking for ext4 partitions...\n");
+ int ret = 0;
+ ret = bml_check_volume("/system");
+ ret |= bml_check_volume("/data");
+ if (has_datadata())
+ ret |= bml_check_volume("/datadata");
+ ret |= bml_check_volume("/cache");
+
+ if (ret == 0) {
+ ui_print("Done!\n");
+ return;
+ }
+
+ ui_set_show_text(1);
+ ui_print("Filesystems need to be converted to ext4.\n");
+ ui_print("A backup and restore will now take place.\n");
+ ui_print("If anything goes wrong, your back will be\n");
+ ui_print("named before-ext4-convert.\n");
+
+ nandroid_backup("/sdcard/clockworkmod/backup/before-ext4-convert");
+ nandroid_restore("/sdcard/clockworkmod/backup/before-ext4-convert", 1, 1, 1, 1, 1);
+ ui_set_show_text(0);
+}
+
void handle_failure(int ret)
{
if (ret == 0)
diff --git a/recovery.c b/recovery.c
index e1641c0..5e25e68 100644
--- a/recovery.c
+++ b/recovery.c
@@ -795,7 +795,7 @@
ui_init();
ui_print(EXPAND(RECOVERY_VERSION)"\n");
load_volume_table();
- create_fstab();
+ process_volumes();
LOGI("Processing arguments.\n");
get_args(&argc, &argv);
diff --git a/roots.c b/roots.c
index bfb828f..45e0727 100644
--- a/roots.c
+++ b/roots.c
@@ -160,21 +160,10 @@
LOGE("failed to mount %s (%s)\n", v->mount_point, strerror(errno));
return -1;
} else {
- // let's just give it a shot and see what happens...
- result = mount(v->device, v->mount_point, v->fs_type,
- MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
- if (result == 0) return 0;
-
- if (v->device2) {
- LOGW("failed to mount %s (%s); trying %s\n",
- v->device, strerror(errno), v->device2);
- result = mount(v->device2, v->mount_point, v->fs_type,
- MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
- if (result == 0) return 0;
- }
-
- LOGE("failed to mount %s (%s)\n", v->mount_point, strerror(errno));
- return -1;
+ // let's try mounting with the mount binary and hope for the best.
+ char mount_cmd[PATH_MAX];
+ sprintf(mount_cmd, "mount %s", path);
+ return __system(mount_cmd);
}
LOGE("unknown fs_type \"%s\" for %s\n", v->fs_type, v->mount_point);