summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjinh0.choi <jinh0.choi@samsung.com>2017-09-21 15:12:52 +0900
committerjinh0.choi <jinh0.choi@samsung.com>2017-09-21 15:12:52 +0900
commit5f155cc177f0bbef4de1263f4843b4e0571844a5 (patch)
treebf10edc26e6462b9bc83e74adf6dbb89fe87829f
parent908f984dc09d2afcd2f291b26982033974589921 (diff)
downloadqemu-5f155cc177f0bbef4de1263f4843b4e0571844a5.tar.gz
qemu-5f155cc177f0bbef4de1263f4843b4e0571844a5.tar.bz2
qemu-5f155cc177f0bbef4de1263f4843b4e0571844a5.zip
sdcard: support vfat sdcard since tizen 3.0
Change-Id: I12309b3b85ad71bf2418ac4eb85b6a6092490403 Signed-off-by: jinh0.choi <jinh0.choi@samsung.com>
-rw-r--r--tizen/src/emul_state.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c
index eff41e8ee5..54e076bf1a 100644
--- a/tizen/src/emul_state.c
+++ b/tizen/src/emul_state.c
@@ -588,14 +588,57 @@ const char* get_vm_data_path(void)
return vm_data_path;
}
+static int compare_version(const char* version1, const char* version2)
+{
+ int res = 0;
+ char *ver1 = strdup(version1);
+ char *ver2 = strdup(version2);
+ char *remove1 = ver1;
+ char *remove2 = ver2;
+ char *next1 = ver1;
+ char *next2 = ver2;
+
+ while (*next1 != '\0' && *next2 != '\0') {
+ long num1 = strtol(ver1, &next1, 10);
+ long num2 = strtol(ver2, &next2, 10);
+
+ res = num1 - num2;
+ if (res) {
+ break;
+ }
+
+ if (*next1 == '\0' || *next2 == '\0') {
+ res = *next1 - *next2;
+ break;
+ }
+ ver1 = next1 + 1;
+ ver2 = next2 + 1;
+ }
+
+ free(remove1);
+ free(remove2);
+ return res;
+}
+
const char *get_sdcard_image_path(void)
{
+ const gchar *sdcard_rel_path;
const char *vm_data_path = get_vm_data_path();
+ const char *vm_platform_version = get_platform_version();
+ // Since tizen-3.0, vfat SDCard images are used instead of ext4. (+6 for "tizen-")
+ if (compare_version(vm_platform_version + 6, "3.0") >= 0) {
+#ifndef CONFIG_WIN32
+ sdcard_rel_path = g_strdup_printf("%s/../../sdcard/vfat/", vm_data_path);
+#else
+ sdcard_rel_path = g_strdup_printf("%s\\..\\..\\sdcard\\vfat\\", vm_data_path);
+#endif
+ } else {
#ifndef CONFIG_WIN32
- const gchar* sdcard_rel_path = g_strdup_printf("%s/../../sdcard/", vm_data_path);
+ sdcard_rel_path = g_strdup_printf("%s/../../sdcard/", vm_data_path);
#else
- const gchar* sdcard_rel_path = g_strdup_printf("%s\\..\\..\\sdcard\\", vm_data_path);
+ sdcard_rel_path = g_strdup_printf("%s\\..\\..\\sdcard\\", vm_data_path);
#endif
+ }
char sdcard_abs_path[PATH_MAX + 1];
char *ptr = realpath(sdcard_rel_path, sdcard_abs_path);