bml devices that are using rfs are automatically upgraded to ext4. Version 3.0.0.0.

Change-Id: I069f0c5122e8d48ce311f519f08890d3e569dbb3
This commit is contained in:
Koushik Dutta 2010-12-19 03:38:29 -08:00
parent d0fff5633c
commit 4196e0fa5e
5 changed files with 59 additions and 17 deletions

View File

@ -25,7 +25,7 @@ LOCAL_MODULE := recovery
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)

View File

@ -112,6 +112,7 @@ typedef struct {
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

View File

@ -914,6 +914,58 @@ void create_fstab()
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)

View File

@ -795,7 +795,7 @@ main(int argc, char **argv) {
ui_init();
ui_print(EXPAND(RECOVERY_VERSION)"\n");
load_volume_table();
create_fstab();
process_volumes();
LOGI("Processing arguments.\n");
get_args(&argc, &argv);

19
roots.c
View File

@ -160,21 +160,10 @@ int ensure_path_mounted(const char* path) {
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);