Merge branch 'gingerbread' of git://github.com/CyanogenMod/android_bootable_recovery into gingerbread

This commit is contained in:
root 2011-06-11 01:30:05 +01:00
commit 5583712d6f
6 changed files with 45 additions and 10 deletions

View File

@ -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.2
LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)"
RECOVERY_API_VERSION := 2
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)

View File

@ -1096,7 +1096,11 @@ int bml_check_volume(const char *path) {
void process_volumes() {
create_fstab();
if (is_data_media()) {
setup_data_media();
}
return;
// dead code.

View File

@ -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;
}

View File

@ -786,10 +786,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);

18
roots.c
View File

@ -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);

View File

@ -42,4 +42,7 @@ int get_num_volumes();
Volume* get_device_volumes();
int is_data_media();
void setup_data_media();
#endif // RECOVERY_ROOTS_H_