emulator: cleaned some start-up logics up
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Fri, 31 Jul 2015 05:54:25 +0000 (14:54 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 3 Aug 2015 05:52:56 +0000 (14:52 +0900)
Change-Id: I8cf17778ceddacf7f1b5ca6acc1aa5b894b99f2a
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
tizen/src/emulator.c

index dd3854dc61afdbee4f86051104832ccafc469078..764f1bffa823b0075038f97b9dc307e5678119bb 100644 (file)
@@ -61,8 +61,7 @@ DECLARE_DEBUG_CHANNEL(main);
 
 #define INPUT_TOUCH_PARAMETER "virtio-touchscreen-pci"
 #define ARGS_LIMIT  128
-#define LEN_MARU_KERNEL_CMDLINE 512
-char maru_kernel_cmdline[LEN_MARU_KERNEL_CMDLINE];
+char *maru_kernel_cmdline;
 
 char tizen_target_path[PATH_MAX];
 
@@ -121,6 +120,8 @@ static void emulator_notify_exit(Notifier *notifier, void *data)
     reset_variables();
 
     LOG_INFO("Exit emulator...\n");
+
+    maru_atexit();
 }
 
 static Notifier emulator_exit = { .notify = emulator_notify_exit };
@@ -180,7 +181,7 @@ static void print_options_info(void)
 
     fprintf(stdout, "qemu args: =========================================\n");
     for (i = 0; i < _qemu_argc; ++i) {
-        fprintf(stdout, "%s ", _qemu_argv[i]);
+        fprintf(stdout, "\"%s\" ", _qemu_argv[i]);
     }
     fprintf(stdout, "\n====================================================\n");
 
@@ -197,38 +198,19 @@ static void print_options_info(void)
     fflush(stdout);
 }
 
-#define PROXY_BUFFER_LEN  128
-static void prepare_basic_features(gchar * const kernel_cmdline)
-{
-    gchar * tmp_str;
-
-    LOG_INFO("Prepare_basic_features\n");
-    set_base_port();
-    tmp_str = g_strdup_printf(" sdb_port=%d,"
-            " vm_resolution=%dx%d", get_emul_vm_base_port(),
-            get_emul_resolution_width(), get_emul_resolution_height());
-    set_emul_host_ip(kernel_cmdline);
-    g_strlcat(kernel_cmdline, tmp_str, LEN_MARU_KERNEL_CMDLINE);
-    g_free(tmp_str);
-}
-
-const char *prepare_maru(const gchar * const kernel_cmdline)
+const char *prepare_maru(const char * const kernel_cmdline)
 {
-    LOG_INFO("Prepare maru specified feature\n");
-
-    atexit(maru_atexit);
     emulator_add_exit_notifier(&emulator_exit);
-
     socket_init();
-
     print_system_info();
+    set_base_port();
 
-    g_strlcpy(maru_kernel_cmdline, kernel_cmdline, LEN_MARU_KERNEL_CMDLINE);
-
-    /* Prepare basic features */
-    prepare_basic_features(maru_kernel_cmdline);
-
-    LOG_INFO("kernel command : %s\n", maru_kernel_cmdline);
+    // assemble new kernel cmdline
+    maru_kernel_cmdline = g_strdup_printf("%s sdb_port=%d, "
+            "vm_resolution=%dx%d", kernel_cmdline, get_emul_vm_base_port(),
+            get_emul_resolution_width(), get_emul_resolution_height());
+    set_emul_host_ip(maru_kernel_cmdline);
+    LOG_INFO("kernel commandline : %s\n", maru_kernel_cmdline);
 
     return maru_kernel_cmdline;
 }