aboutsummaryrefslogtreecommitdiffstats
path: root/roots.c
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2010-07-22 20:14:44 -0700
committerKoushik Dutta <koushd@gmail.com>2010-07-22 20:14:44 -0700
commitd4060c3eb656ba475a4d9fea7f1fa786a82960f6 (patch)
tree1846337c8c9433a53023d02e9329ada989f06647 /roots.c
parente074d8d543cdbb2c130d7defa9b89d8f97a25dfc (diff)
downloadandroid_bootable_recovery-d4060c3eb656ba475a4d9fea7f1fa786a82960f6.tar.gz
android_bootable_recovery-d4060c3eb656ba475a4d9fea7f1fa786a82960f6.tar.bz2
android_bootable_recovery-d4060c3eb656ba475a4d9fea7f1fa786a82960f6.zip
Galaxy S initial support. Fix firmware flash on inc. May need to fix other phones.
Diffstat (limited to 'roots.c')
-rw-r--r--roots.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/roots.c b/roots.c
index fc2d177a..df49cc3a 100644
--- a/roots.c
+++ b/roots.c
@@ -39,20 +39,20 @@ static const char g_raw[] = "@\0g_raw";
static const char g_package_file[] = "@\0g_package_file";
static RootInfo g_roots[] = {
- { "BOOT:", g_mtd_device, NULL, "boot", NULL, g_raw },
- { "CACHE:", CACHE_DEVICE, NULL, "cache", "/cache", CACHE_FILESYSTEM },
- { "DATA:", DATA_DEVICE, NULL, "userdata", "/data", DATA_FILESYSTEM },
+ { "BOOT:", g_mtd_device, NULL, "boot", NULL, g_raw, NULL },
+ { "CACHE:", CACHE_DEVICE, NULL, "cache", "/cache", CACHE_FILESYSTEM, CACHE_FILESYSTEM_OPTIONS },
+ { "DATA:", DATA_DEVICE, NULL, "userdata", "/data", DATA_FILESYSTEM, DATA_FILESYSTEM_OPTIONS },
#ifdef HAS_DATADATA
- { "DATADATA:", DATADATA_DEVICE, NULL, "datadata", "/datadata", DATADATA_FILESYSTEM },
+ { "DATADATA:", DATADATA_DEVICE, NULL, "datadata", "/datadata", DATADATA_FILESYSTEM, DATADATA_FILESYSTEM_OPTIONS },
#endif
- { "MISC:", g_mtd_device, NULL, "misc", NULL, g_raw },
- { "PACKAGE:", NULL, NULL, NULL, NULL, g_package_file },
- { "RECOVERY:", g_mtd_device, NULL, "recovery", "/", g_raw },
- { "SDCARD:", SDCARD_DEVICE_PRIMARY, SDCARD_DEVICE_SECONDARY, NULL, "/sdcard", "vfat" },
- { "SDEXT:", SDEXT_DEVICE, NULL, NULL, "/sd-ext", SDEXT_FILESYSTEM },
- { "SYSTEM:", SYSTEM_DEVICE, NULL, "system", "/system", SYSTEM_FILESYSTEM },
- { "MBM:", g_mtd_device, NULL, "mbm", NULL, g_raw },
- { "TMP:", NULL, NULL, NULL, "/tmp", NULL },
+ { "MISC:", g_mtd_device, NULL, "misc", NULL, g_raw, NULL },
+ { "PACKAGE:", NULL, NULL, NULL, NULL, g_package_file, NULL },
+ { "RECOVERY:", g_mtd_device, NULL, "recovery", "/", g_raw, NULL },
+ { "SDCARD:", SDCARD_DEVICE_PRIMARY, SDCARD_DEVICE_SECONDARY, NULL, "/sdcard", "vfat", NULL },
+ { "SDEXT:", SDEXT_DEVICE, NULL, NULL, "/sd-ext", SDEXT_FILESYSTEM, NULL },
+ { "SYSTEM:", SYSTEM_DEVICE, NULL, "system", "/system", SYSTEM_FILESYSTEM, SYSTEM_FILESYSTEM_OPTIONS },
+ { "MBM:", g_mtd_device, NULL, "mbm", NULL, g_raw, NULL },
+ { "TMP:", NULL, NULL, NULL, "/tmp", NULL, NULL },
};
#define NUM_ROOTS (sizeof(g_roots) / sizeof(g_roots[0]))
@@ -207,14 +207,15 @@ is_root_path_mounted(const char *root_path)
return internal_root_mounted(info) >= 0;
}
-static int mount_internal(const char* device, const char* mount_point, const char* filesystem)
+static int mount_internal(const char* device, const char* mount_point, const char* filesystem, const char* filesystem_options)
{
- if (strcmp(filesystem, "auto") != 0) {
+ if (strcmp(filesystem, "auto") != 0 && filesystem_options == NULL) {
return mount(device, mount_point, filesystem, MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
}
else {
char mount_cmd[PATH_MAX];
- sprintf(mount_cmd, "mount -onoatime,nodiratime,nodev %s %s", device, mount_point);
+ const char* options = filesystem_options == NULL ? "noatime,nodiratime,nodev" : filesystem_options;
+ sprintf(mount_cmd, "mount -t %s -o%s %s %s", filesystem, options, device, mount_point);
return __system(mount_cmd);
}
}
@@ -259,7 +260,7 @@ ensure_root_path_mounted(const char *root_path)
}
mkdir(info->mount_point, 0755); // in case it doesn't already exist
- if (mount_internal(info->device, info->mount_point, info->filesystem)) {
+ if (mount_internal(info->device, info->mount_point, info->filesystem, info->filesystem_options)) {
if (info->device2 == NULL) {
LOGE("Can't mount %s\n(%s)\n", info->device, strerror(errno));
return -1;
@@ -311,7 +312,12 @@ get_root_mtd_partition(const char *root_path)
if (info == NULL || info->device != g_mtd_device ||
info->partition_name == NULL)
{
+#ifdef BOARD_HAS_MTD_CACHE
+ if (strcmp(root_path, "CACHE:") != 0)
+ return NULL;
+#else
return NULL;
+#endif
}
mtd_scan_partitions();
return mtd_find_partition_by_name(info->partition_name);
@@ -377,14 +383,6 @@ format_root_device(const char *root)
}
}
}
-
-#ifdef BOARD_USES_FFORMAT
- if (info->filesystem != NULL && strcmp("rfs", info->filesystem) == 0) {
- char cmd[PATH_MAX];
- sprintf("/sbin/fformat %s", info->device);
- return __system(cmd);
- }
-#endif
-
+
return format_non_mtd_device(root);
}