emulator: separate source file for legacy options 90/22990/4
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Sun, 15 Jun 2014 11:54:44 +0000 (20:54 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 16 Jun 2014 06:39:11 +0000 (23:39 -0700)
Separate source file for legay emulator options.
Clean-up some headers.

Change-Id: I1a1835724dcd8ea8c4b5de8d2690202db17b3b79
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
tizen/src/Makefile
tizen/src/Makefile.tizen
tizen/src/emulator.c
tizen/src/emulator_legacy.c [new file with mode: 0644]
tizen/src/osutil-darwin.c
tizen/src/osutil-linux.c

index 4b22511736dd4c58eb26cf064b32556ce8295c22..6080e15e4940650d846a819b5534a55beb91b08d 100644 (file)
@@ -57,12 +57,12 @@ skin_client:
 build_info:
        @echo "Generate a build information file"
        @echo "/* Automatically generated by Makefile - do not modify! */" > build_info.h
-       @echo "const char build_version[] = \"`cat VERSION`\";" >> build_info.h
-       @echo "const char build_date[] = \"`date +"%F %T %Z"`\";" >> build_info.h
-       @echo "const char pkginfo_version[] = \"`sed -n '1p' ./../../package/pkginfo.manifest | sed 's/\"//g'`\";" >> build_info.h
-       @echo "const char pkginfo_maintainer[] = \"`sed -n '2p' ./../../package/pkginfo.manifest | sed 's/\"//g'`\";" >> build_info.h
-       @echo "const char pkginfo_githead[] = \"`git rev-parse HEAD`\";" >> build_info.h
-       @echo "const char latest_gittag[] = \"`git for-each-ref --count=1 --sort=-taggerdate refs/tags/ --format='Latest Git Tag : %(refname:short) (%(subject))' | sed 's/\"//g'`\";" >> build_info.h
+       @echo "static const char build_version[] = \"`cat VERSION`\";" >> build_info.h
+       @echo "static const char build_date[] = \"`date +"%F %T %Z"`\";" >> build_info.h
+       @echo "static const char pkginfo_version[] = \"`sed -n '1p' ./../../package/pkginfo.manifest | sed 's/\"//g'`\";" >> build_info.h
+       @echo "static const char pkginfo_maintainer[] = \"`sed -n '2p' ./../../package/pkginfo.manifest | sed 's/\"//g'`\";" >> build_info.h
+       @echo "static const char pkginfo_githead[] = \"`git rev-parse HEAD`\";" >> build_info.h
+       @echo "static const char latest_gittag[] = \"`git for-each-ref --count=1 --sort=-taggerdate refs/tags/ --format='Latest Git Tag : %(refname:short) (%(subject))' | sed 's/\"//g'`\";" >> build_info.h
 
 
 clean: qemu_clean
index 63559d253755a02417108226c024c57f0d3c835e..43abc06b3a20340910fcfa90eea79084adf9d8e2 100644 (file)
@@ -31,7 +31,7 @@ GL_CFLAGS := -Wall -g -O2 -fno-strict-aliasing
 endif
 
 # maru loader
-obj-y += emulator.o emulator_options.o emul_state.o maru_err_table.o
+obj-y += emulator.o emulator_legacy.o emulator_options.o emul_state.o maru_err_table.o
 
 # osutil
 obj-y += osutil.o
index 856b0857ad81193ca294869a6172bbf5911c68da..d9460767607db34d93549ad8ccad380e1a200ee7 100644 (file)
@@ -1,14 +1,12 @@
 /*
  * Emulator
  *
- * Copyright (C) 2011 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact:
  * SeokYeon Hwang <syeon.hwang@samsung.com>
  * MunKyu Im <munkyu.im@samsung.com>
  * GiWoong Kim <giwoong.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * HyunJun Son
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -31,7 +29,6 @@
  */
 
 #include <stdlib.h>
-#include <string.h>
 #include <getopt.h>
 
 #include "qemu/config-file.h"
 #include "build_info.h"
 #include "emulator.h"
 #include "emul_state.h"
-#include "guest_debug.h"
 #include "guest_server.h"
 #include "emulator_options.h"
-#include "hw/maru_camera_common.h"
-#include "hw/maru_virtio_touchscreen.h"
 #include "check_gl.h"
-#include "maru_common.h"
 #include "maru_err_table.h"
 #include "maru_display.h"
 #include "mloop_event.h"
 #include "osutil.h"
 #include "sdb.h"
 #include "skin/maruskin_server.h"
-#include "skin/maruskin_client.h"
 #include "debug_ch.h"
 #include "ecs/ecs.h"
 #include "tethering/app_tethering.h"
@@ -72,32 +64,14 @@ extern int g_shmid;
 int thread_running = 1; /* Check if we need exit main */
 #endif
 
-MULTI_DEBUG_CHANNEL(qemu, main);
+MULTI_DEBUG_CHANNEL(tizen, main);
 
 #define SUPPORT_LEGACY_ARGS
 
-#ifdef SUPPORT_LEGACY_ARGS
-#define QEMU_ARGS_PREFIX "--qemu-args"
-#define SKIN_ARGS_PREFIX "--skin-args"
-#define IMAGE_PATH_PREFIX   "file="
-//#define IMAGE_PATH_SUFFIX   ",if=virtio"
-#define IMAGE_PATH_SUFFIX   ",if=virtio,index=1"
-#define SDB_PORT_PREFIX     "sdb_port="
-#define LOGS_SUFFIX         "/logs/"
-#define LOGFILE             "emulator.log"
-#define DISPLAY_WIDTH_PREFIX "width="
-#define DISPLAY_HEIGHT_PREFIX "height="
-#define INPUT_TOUCH_PARAMETER "virtio-touchscreen-pci"
-#endif // SUPPORT_LEGACY_ARGS
-
-#define MIDBUF  128
 #define LEN_MARU_KERNEL_CMDLINE 512
-gchar maru_kernel_cmdline[LEN_MARU_KERNEL_CMDLINE];
-
-gchar bin_path[PATH_MAX] = { 0, };
-gchar log_path[PATH_MAX] = { 0, };
+char maru_kernel_cmdline[LEN_MARU_KERNEL_CMDLINE];
 
-gchar *vm_path;
+char bin_path[PATH_MAX] = { 0, };
 
 char tizen_target_path[PATH_MAX];
 char tizen_target_img_path[PATH_MAX];
@@ -110,8 +84,26 @@ static char **_skin_argv;
 static int _qemu_argc;
 static char **_qemu_argv;
 
-const gchar *get_log_path(void)
+const char *get_log_path(void)
 {
+#ifdef SUPPORT_LEGACY_ARGS
+    if (log_path[0]) {
+        return log_path;
+    }
+#endif
+    char *log_path = get_variable("log_path");
+
+    // if "log_path" is not exist, make it first
+    if (!log_path) {
+        char *vm_path = get_variable("vm_path");
+        if (!vm_path) {
+            vm_path = g_strdup("");
+        }
+
+        log_path = g_strdup_printf("%s/logs", vm_path);
+        set_variable("log_path", log_path, false);
+    }
+
     return log_path;
 }
 
@@ -215,12 +207,15 @@ static void print_system_info(void)
     print_system_info_os();
 }
 
+#define PROXY_BUFFER_LEN  128
 #define DEFAULT_QEMU_DNS_IP "10.0.2.3"
 static void prepare_basic_features(gchar * const kernel_cmdline)
 {
-    char http_proxy[MIDBUF] ={0}, https_proxy[MIDBUF] = {0,},
-        ftp_proxy[MIDBUF] = {0,}, socks_proxy[MIDBUF] = {0,},
-        dns[MIDBUF] = {0};
+    char http_proxy[PROXY_BUFFER_LEN] ={ 0, },
+        https_proxy[PROXY_BUFFER_LEN] = { 0, },
+        ftp_proxy[PROXY_BUFFER_LEN] = { 0, },
+        socks_proxy[PROXY_BUFFER_LEN] = { 0, },
+        dns[PROXY_BUFFER_LEN] = { 0, };
 
     set_base_port();
 
@@ -302,196 +297,7 @@ void start_skin(void)
 }
 
 int qemu_main(int argc, char **argv, char **envp);
-
-#ifdef SUPPORT_LEGACY_ARGS
-static void set_image_and_log_path(char *qemu_argv)
-{
-    int i, j = 0;
-    int name_len = 0;
-    int prefix_len = 0;
-    int suffix_len = 0;
-    int max = 0;
-    char *path = malloc(PATH_MAX);
-    name_len = strlen(qemu_argv);
-    prefix_len = strlen(IMAGE_PATH_PREFIX);
-    suffix_len = strlen(IMAGE_PATH_SUFFIX);
-    max = name_len - suffix_len;
-    for (i = prefix_len , j = 0; i < max; i++) {
-        path[j++] = qemu_argv[i];
-    }
-    path[j] = '\0';
-    if (!g_path_is_absolute(path)) {
-        strcpy(tizen_target_path, g_get_current_dir());
-    } else {
-        strcpy(tizen_target_path, g_path_get_dirname(path));
-    }
-
-    set_emul_vm_name(g_path_get_basename(tizen_target_path));
-    strcpy(tizen_target_img_path, path);
-    free(path);
-
-    strcpy(log_path, tizen_target_path);
-    strcat(log_path, LOGS_SUFFIX);
-#ifdef CONFIG_WIN32
-    if (access(g_win32_locale_filename_from_utf8(log_path), R_OK) != 0) {
-        g_mkdir(g_win32_locale_filename_from_utf8(log_path), 0755);
-    }
-#else
-    if (access(log_path, R_OK) != 0) {
-        if (g_mkdir(log_path, 0755) < 0) {
-            fprintf(stderr, "failed to create log directory %s\n", log_path);
-        }
-    }
-#endif
-    strcat(log_path, LOGFILE);
-}
-
-static void redir_output(void)
-{
-    FILE *fp;
-
-    fp = freopen(log_path, "a+", stdout);
-    if (fp == NULL) {
-        fprintf(stderr, "log file open error\n");
-    }
-
-    fp = freopen(log_path, "a+", stderr);
-    if (fp == NULL) {
-        fprintf(stderr, "log file open error\n");
-    }
-    setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
-    setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
-}
-
-// deprecated
-static void extract_qemu_info(int qemu_argc, char **qemu_argv)
-{
-    int i = 0;
-
-    for (i = 0; i < qemu_argc; ++i) {
-        if (strstr(qemu_argv[i], IMAGE_PATH_PREFIX) != NULL) {
-            set_image_and_log_path(qemu_argv[i]);
-        } else if (strstr(qemu_argv[i], INPUT_TOUCH_PARAMETER) != NULL) {
-            /* touchscreen */
-            set_emul_input_touch_enable(true);
-
-            char *option = strstr(qemu_argv[i] + strlen(INPUT_TOUCH_PARAMETER), TOUCHSCREEN_OPTION_NAME);
-            if (option != NULL) {
-                option += strlen(TOUCHSCREEN_OPTION_NAME) + 1;
-
-                set_emul_max_touch_point(atoi(option));
-            }
-        }
-    }
-
-    if (is_emul_input_touch_enable() != true) {
-        set_emul_input_mouse_enable(true);
-    }
-}
-
-// deprecated
-static void extract_skin_info(int skin_argc, char **skin_argv)
-{
-    int i = 0;
-    int w = 0, h = 0;
-
-    for (i = 0; i < skin_argc; ++i) {
-        if (strstr(skin_argv[i], DISPLAY_WIDTH_PREFIX) != NULL) {
-            char *width_arg = skin_argv[i] + strlen(DISPLAY_WIDTH_PREFIX);
-            w = atoi(width_arg);
-
-            INFO("display width option : %d\n", w);
-        } else if (strstr(skin_argv[i], DISPLAY_HEIGHT_PREFIX) != NULL) {
-            char *height_arg = skin_argv[i] + strlen(DISPLAY_HEIGHT_PREFIX);
-            h = atoi(height_arg);
-
-            INFO("display height option : %d\n", h);
-        }
-
-        if (w != 0 && h != 0) {
-            set_emul_resolution(w, h);
-            break;
-        }
-    }
-}
-
-// deprecated
-static void legacy_parse_options(int argc, char *argv[], int *skin_argc,
-                        char ***skin_argv, int *qemu_argc, char ***qemu_argv)
-{
-    int i = 0;
-    int skin_args_index = 0;
-
-    if (argc <= 1) {
-        fprintf(stderr, "Arguments are not enough to launch Emulator. "
-                "Please try to use Emulator Manager.\n");
-        exit(1);
-    }
-
-    /* classification */
-    for (i = 1; i < argc; ++i) {
-        if (strstr(argv[i], SKIN_ARGS_PREFIX)) {
-            *skin_argv = &(argv[i + 1]);
-            break;
-        }
-    }
-
-    for (skin_args_index = i; skin_args_index < argc; ++skin_args_index) {
-        if (strstr(argv[skin_args_index], QEMU_ARGS_PREFIX)) {
-            *skin_argc = skin_args_index - i - 1;
-
-            *qemu_argc = argc - skin_args_index - i + 1;
-            *qemu_argv = &(argv[skin_args_index]);
-
-            argv[skin_args_index] = argv[0];
-        }
-    }
-}
-
-// deprecated
-static int legacy_emulator_main(int argc, char * argv[], char **envp)
-{
-    legacy_parse_options(argc, argv, &_skin_argc,
-                &_skin_argv, &_qemu_argc, &_qemu_argv);
-    set_bin_path(_qemu_argv[0]);
-    extract_qemu_info(_qemu_argc, _qemu_argv);
-
-    INFO("Emulator start !!!\n");
-    atexit(maru_atexit);
-
-    extract_skin_info(_skin_argc, _skin_argv);
-
-    print_system_info();
-
-    INFO("Prepare running...\n");
-    /* Redirect stdout and stderr after debug_ch is initialized. */
-    redir_output();
-    INFO("tizen_target_img_path: %s\n", tizen_target_img_path);
-    int i;
-
-    fprintf(stdout, "qemu args: =========================================\n");
-    for (i = 0; i < _qemu_argc; ++i) {
-        fprintf(stdout, "%s ", _qemu_argv[i]);
-    }
-    fprintf(stdout, "\nqemu args: =========================================\n");
-
-    fprintf(stdout, "skin args: =========================================\n");
-    for (i = 0; i < _skin_argc; ++i) {
-        fprintf(stdout, "%s ", _skin_argv[i]);
-    }
-    fprintf(stdout, "\nskin args: =========================================\n");
-
-    INFO("socket initialize\n");
-    socket_init();
-
-    INFO("qemu main start!\n");
-    qemu_main(_qemu_argc, _qemu_argv, envp);
-
-    exit_emulator();
-
-    return 0;
-}
-#endif // SUPPORT_LEGACY_ARGS
+int legacy_emulator_main(int argc, char **argv, char **envp);
 
 static int emulator_main(int argc, char *argv[], char **envp)
 {
diff --git a/tizen/src/emulator_legacy.c b/tizen/src/emulator_legacy.c
new file mode 100644 (file)
index 0000000..014e9a1
--- /dev/null
@@ -0,0 +1,323 @@
+/*
+ * Emulator
+ *
+ * Copyright (C) 2011 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * MunKyu Im <munkyu.im@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * HyunJun Son
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include <stdlib.h>
+
+#include "qemu/config-file.h"
+#include "qemu/sockets.h"
+
+#include "build_info.h"
+#include "emulator.h"
+#include "emul_state.h"
+#include "guest_debug.h"
+#include "guest_server.h"
+#include "hw/maru_virtio_touchscreen.h"
+#include "check_gl.h"
+#include "maru_err_table.h"
+#include "maru_display.h"
+#include "mloop_event.h"
+#include "osutil.h"
+#include "sdb.h"
+#include "skin/maruskin_server.h"
+#include "debug_ch.h"
+#include "ecs/ecs.h"
+
+#ifdef CONFIG_SDL
+#include <SDL.h>
+#endif
+
+MULTI_DEBUG_CHANNEL(qemu, main);
+
+#define QEMU_ARGS_PREFIX "--qemu-args"
+#define SKIN_ARGS_PREFIX "--skin-args"
+#define IMAGE_PATH_PREFIX   "file="
+//#define IMAGE_PATH_SUFFIX   ",if=virtio"
+#define IMAGE_PATH_SUFFIX   ",if=virtio,index=1"
+#define SDB_PORT_PREFIX     "sdb_port="
+#define LOGS_SUFFIX         "/logs/"
+#define LOGFILE             "emulator.log"
+#define DISPLAY_WIDTH_PREFIX "width="
+#define DISPLAY_HEIGHT_PREFIX "height="
+#define INPUT_TOUCH_PARAMETER "virtio-touchscreen-pci"
+
+#define MIDBUF  128
+#define LEN_MARU_KERNEL_CMDLINE 512
+
+// for compatibility
+gchar log_path[PATH_MAX] = { 0, };
+
+extern gchar maru_kernel_cmdline[LEN_MARU_KERNEL_CMDLINE];
+
+extern char tizen_target_path[PATH_MAX];
+extern char tizen_target_img_path[PATH_MAX];
+
+extern int enable_yagl;
+extern int enable_spice;
+
+static int _skin_argc;
+static char **_skin_argv;
+static int _qemu_argc;
+static char **_qemu_argv;
+
+static void set_bin_path(gchar * exec_argv)
+{
+    set_bin_path_os(exec_argv);
+}
+
+static void print_system_info(void)
+{
+#define DIV 1024
+
+    INFO("* Board name : %s\n", build_version);
+    INFO("* Package %s\n", pkginfo_version);
+    INFO("* Package %s\n", pkginfo_maintainer);
+    INFO("* Git Head : %s\n", pkginfo_githead);
+    INFO("* %s\n", latest_gittag);
+    INFO("* User name : %s\n", g_get_real_name());
+    INFO("* Host name : %s\n", g_get_host_name());
+
+    /* time stamp */
+    INFO("* Build date : %s\n", build_date);
+
+    qemu_timeval tval = { 0, };
+    if (qemu_gettimeofday(&tval) == 0) {
+        char timeinfo[64] = {0, };
+
+        time_t ti = tval.tv_sec;
+        struct tm *tm_time = localtime(&ti);
+        strftime(timeinfo, sizeof(timeinfo), "%Y-%m-%d %H:%M:%S", tm_time);
+        INFO("* Current time : %s\n", timeinfo);
+    }
+
+#ifdef CONFIG_SDL
+    /* Gets the version of the dynamically linked SDL library */
+    INFO("* Host sdl version : (%d, %d, %d)\n",
+            SDL_Linked_Version()->major,
+            SDL_Linked_Version()->minor,
+            SDL_Linked_Version()->patch);
+#endif
+
+    print_system_info_os();
+}
+
+int qemu_main(int argc, char **argv, char **envp);
+
+static void set_image_and_log_path(char *qemu_argv)
+{
+    int i, j = 0;
+    int name_len = 0;
+    int prefix_len = 0;
+    int suffix_len = 0;
+    int max = 0;
+    char *path = malloc(PATH_MAX);
+    name_len = strlen(qemu_argv);
+    prefix_len = strlen(IMAGE_PATH_PREFIX);
+    suffix_len = strlen(IMAGE_PATH_SUFFIX);
+    max = name_len - suffix_len;
+    for (i = prefix_len , j = 0; i < max; i++) {
+        path[j++] = qemu_argv[i];
+    }
+    path[j] = '\0';
+    if (!g_path_is_absolute(path)) {
+        strcpy(tizen_target_path, g_get_current_dir());
+    } else {
+        strcpy(tizen_target_path, g_path_get_dirname(path));
+    }
+
+    set_emul_vm_name(g_path_get_basename(tizen_target_path));
+    strcpy(tizen_target_img_path, path);
+    free(path);
+
+    strcpy(log_path, tizen_target_path);
+    strcat(log_path, LOGS_SUFFIX);
+#ifdef CONFIG_WIN32
+    if (access(g_win32_locale_filename_from_utf8(log_path), R_OK) != 0) {
+        g_mkdir(g_win32_locale_filename_from_utf8(log_path), 0755);
+    }
+#else
+    if (access(log_path, R_OK) != 0) {
+        if (g_mkdir(log_path, 0755) < 0) {
+            fprintf(stderr, "failed to create log directory %s\n", log_path);
+        }
+    }
+#endif
+    strcat(log_path, LOGFILE);
+}
+
+static void redir_output(void)
+{
+    FILE *fp;
+
+    fp = freopen(log_path, "a+", stdout);
+    if (fp == NULL) {
+        fprintf(stderr, "log file open error\n");
+    }
+
+    fp = freopen(log_path, "a+", stderr);
+    if (fp == NULL) {
+        fprintf(stderr, "log file open error\n");
+    }
+    setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
+    setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
+}
+
+// deprecated
+static void extract_qemu_info(int qemu_argc, char **qemu_argv)
+{
+    int i = 0;
+
+    for (i = 0; i < qemu_argc; ++i) {
+        if (strstr(qemu_argv[i], IMAGE_PATH_PREFIX) != NULL) {
+            set_image_and_log_path(qemu_argv[i]);
+        } else if (strstr(qemu_argv[i], INPUT_TOUCH_PARAMETER) != NULL) {
+            /* touchscreen */
+            set_emul_input_touch_enable(true);
+
+            char *option = strstr(qemu_argv[i] + strlen(INPUT_TOUCH_PARAMETER), TOUCHSCREEN_OPTION_NAME);
+            if (option != NULL) {
+                option += strlen(TOUCHSCREEN_OPTION_NAME) + 1;
+
+                set_emul_max_touch_point(atoi(option));
+            }
+        }
+    }
+
+    if (is_emul_input_touch_enable() != true) {
+        set_emul_input_mouse_enable(true);
+    }
+}
+
+// deprecated
+static void extract_skin_info(int skin_argc, char **skin_argv)
+{
+    int i = 0;
+    int w = 0, h = 0;
+
+    for (i = 0; i < skin_argc; ++i) {
+        if (strstr(skin_argv[i], DISPLAY_WIDTH_PREFIX) != NULL) {
+            char *width_arg = skin_argv[i] + strlen(DISPLAY_WIDTH_PREFIX);
+            w = atoi(width_arg);
+
+            INFO("display width option : %d\n", w);
+        } else if (strstr(skin_argv[i], DISPLAY_HEIGHT_PREFIX) != NULL) {
+            char *height_arg = skin_argv[i] + strlen(DISPLAY_HEIGHT_PREFIX);
+            h = atoi(height_arg);
+
+            INFO("display height option : %d\n", h);
+        }
+
+        if (w != 0 && h != 0) {
+            set_emul_resolution(w, h);
+            break;
+        }
+    }
+}
+
+// deprecated
+static void legacy_parse_options(int argc, char *argv[], int *skin_argc,
+                        char ***skin_argv, int *qemu_argc, char ***qemu_argv)
+{
+    int i = 0;
+    int skin_args_index = 0;
+
+    if (argc <= 1) {
+        fprintf(stderr, "Arguments are not enough to launch Emulator. "
+                "Please try to use Emulator Manager.\n");
+        exit(1);
+    }
+
+    /* classification */
+    for (i = 1; i < argc; ++i) {
+        if (strstr(argv[i], SKIN_ARGS_PREFIX)) {
+            *skin_argv = &(argv[i + 1]);
+            break;
+        }
+    }
+
+    for (skin_args_index = i; skin_args_index < argc; ++skin_args_index) {
+        if (strstr(argv[skin_args_index], QEMU_ARGS_PREFIX)) {
+            *skin_argc = skin_args_index - i - 1;
+
+            *qemu_argc = argc - skin_args_index - i + 1;
+            *qemu_argv = &(argv[skin_args_index]);
+
+            argv[skin_args_index] = argv[0];
+        }
+    }
+}
+
+// deprecated
+int legacy_emulator_main(int argc, char **argv, char **envp);
+
+int legacy_emulator_main(int argc, char * argv[], char **envp)
+{
+    legacy_parse_options(argc, argv, &_skin_argc,
+                &_skin_argv, &_qemu_argc, &_qemu_argv);
+    set_bin_path(_qemu_argv[0]);
+    extract_qemu_info(_qemu_argc, _qemu_argv);
+
+    INFO("Emulator start !!!\n");
+    atexit(maru_atexit);
+
+    extract_skin_info(_skin_argc, _skin_argv);
+
+    /* Redirect stdout and stderr after debug_ch is initialized. */
+    redir_output();
+
+    print_system_info();
+
+    INFO("Prepare running...\n");
+    INFO("tizen_target_img_path: %s\n", tizen_target_img_path);
+    int i;
+
+    fprintf(stdout, "qemu args: =========================================\n");
+    for (i = 0; i < _qemu_argc; ++i) {
+        fprintf(stdout, "%s ", _qemu_argv[i]);
+    }
+    fprintf(stdout, "\nqemu args: =========================================\n");
+
+    fprintf(stdout, "skin args: =========================================\n");
+    for (i = 0; i < _skin_argc; ++i) {
+        fprintf(stdout, "%s ", _skin_argv[i]);
+    }
+    fprintf(stdout, "\nskin args: =========================================\n");
+
+    INFO("socket initialize\n");
+    socket_init();
+
+    INFO("qemu main start!\n");
+    qemu_main(_qemu_argc, _qemu_argv, envp);
+
+    exit_emulator();
+
+    return 0;
+}
index 76736198159f7fe93a2b924b74af59e19886dc00..a56f47c3df021d69ada410138a31ec7eafb43967 100644 (file)
@@ -170,8 +170,7 @@ void print_system_info_os(void)
 
     /* uname */
     INFO("* Host machine uname :\n");
-    char uname_cmd[MAXLEN] = "uname -a >> ";
-    strcat(uname_cmd, log_path);
+    char uname_cmd[MAXLEN] = "uname -a";
     if(system(uname_cmd) < 0) {
         INFO("system function command '%s' \
             returns error !", uname_cmd);
@@ -220,8 +219,7 @@ void print_system_info_os(void)
 
     /* java version */
     INFO("* Java version :\n");
-    char lspci_cmd[MAXLEN] = "java -version 2>> ";
-    strcat(lspci_cmd, log_path);
+    char lspci_cmd[MAXLEN] = "java -version";
 
     fflush(stdout);
     if(system(lspci_cmd) < 0) {
index c6b3e67c2c8410881818214db8be7bd4a3501c5c..a5e945452223d66d9a1f6fab5d524e20c8730d26 100644 (file)
@@ -213,13 +213,13 @@ void print_system_info_os(void)
 
     /* get linux distribution information */
     INFO("* Linux distribution infomation :\n");
-    const gchar lsb_release_cmd[MAXLEN] = "lsb_release -d -r -c >> ";
+    const gchar lsb_release_cmd[MAXLEN] = "lsb_release -d -r -c";
     gchar *buffer = NULL;
-    gint buffer_size = strlen(lsb_release_cmd) + strlen(log_path) + 1;
+    gint buffer_size = strlen(lsb_release_cmd) + 1;
 
     buffer = g_malloc(buffer_size);
 
-    g_snprintf(buffer, buffer_size, "%s%s", lsb_release_cmd, log_path);
+    g_snprintf(buffer, buffer_size, "%s", lsb_release_cmd);
 
     if (system(buffer) < 0) {
         INFO("system function command '%s' \
@@ -229,12 +229,12 @@ void print_system_info_os(void)
 
     /* pci device description */
     INFO("* Host PCI devices :\n");
-    const gchar lspci_cmd[MAXLEN] = "lspci >> ";
-    buffer_size = strlen(lspci_cmd) + strlen(log_path) + 1;
+    const gchar lspci_cmd[MAXLEN] = "lspci";
+    buffer_size = strlen(lspci_cmd) + 1;
 
     buffer = g_malloc(buffer_size);
 
-    g_snprintf(buffer, buffer_size, "%s%s", lspci_cmd, log_path);
+    g_snprintf(buffer, buffer_size, "%s", lspci_cmd);
 
     fflush(stdout);
     if (system(buffer) < 0) {