[Title] Remove target, disk option of emulator
authormunkyu.im <munkyu.im@samsung.com>
Tue, 13 Dec 2011 03:47:15 +0000 (12:47 +0900)
committermunkyu.im <munkyu.im@samsung.com>
Tue, 13 Dec 2011 03:47:15 +0000 (12:47 +0900)
[Type]
[Module]
[Priority]
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

tizen/src/configuration.c
tizen/src/defines.h
tizen/src/emul_debug.sh
tizen/src/emulator.c

index afafd70..c5c2fd8 100644 (file)
@@ -70,14 +70,7 @@ int fill_configuration(int status)
 
        /* 1.3 target setting */
 
-       if (startup_option.target != NULL) {
-               configuration.qemu_configuration.diskimg_type = 0;
-               strcpy(configuration.target_path, startup_option.target);
-
-               INFO( "target path is %s\n", configuration.target_path);
-       }
-
-       else if (strlen(startup_option.disk) > 0) {
+       if (strlen(startup_option.disk) > 0) {
                configuration.qemu_configuration.diskimg_type = 1;
                if(strcmp(SYSTEMINFO.virtual_target_name, "default") == 0)
                        strcpy(configuration.qemu_configuration.diskimg_path, startup_option.disk);
index 8f2268b..7b96bd6 100644 (file)
@@ -310,7 +310,6 @@ enum {
  */
 typedef struct _STARTUP_OPTION
 {
-       gchar           *target;                                /**<Target name> */
        gchar           *disk;                                  /**<Target name> */
        gchar           *vtm;                                   /**<VTM name>**/
        int                     run_level;                              /**<run level> */
index 3b90cca..a5af7bb 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
 CURDIR=`pwd`
 
-gdb --args $CURDIR/emulator-x86 --vtm default --disk $CURDIR/../x86/VMs/default/emulimg-default.x86 \
+$CURDIR/emulator-x86 --vtm default \
  -- -net nic,model=virtio -soundhw all -usb -usbdevice wacom-tablet -vga tizen -bios bios.bin -L $CURDIR/../x86/data/pc-bios -kernel $CURDIR/../x86/data/kernel-img/bzImage -usbdevice keyboard -rtc base=utc -net user --enable-kvm -redir tcp:1202:10.0.2.16:22
index 9ea427e..7ae4f72 100644 (file)
@@ -634,12 +634,25 @@ static int startup_option_parser(int *argc, char ***argv)
        struct timeval tval;
        char string[MAXBUF];
        FILE *fp = NULL;
-       //int status = 0;
-       //char *name, *path;
        char *info_file;
+       char *arch = getenv("EMULATOR_ARCH");
+       const gchar *exec_path = get_exec_path();
+       if(!arch) /* for stand alone */
+       {
+               char *binary = g_path_get_basename(exec_path);
+               if(strstr(binary, "emulator-x86"))
+                       arch = g_strdup_printf("x86");
+               else if(strstr(binary, "emulator-arm"))
+                       arch = g_strdup_printf("arm");
+               else 
+               {
+                       ERR( "binary setting failed\n");
+                       exit(1);
+               }
+               free(binary);
+       }
 
        GOptionEntry options[] = {
-               {"target", 0, 0, G_OPTION_ARG_STRING, &startup_option.target, "Virtual root path", "\"target path\""},
                {"disk", 0, 0, G_OPTION_ARG_STRING, &startup_option.disk, "Disk image path", "\"disk path\""},
                {"vtm", 0, 0, G_OPTION_ARG_STRING, &startup_option.vtm, "Virtual target image file", "\"*.x86 or *.arm\""},
                {"run-level", 0, 0, G_OPTION_ARG_INT, &startup_option.run_level, "Run level", "5"},
@@ -678,6 +691,11 @@ static int startup_option_parser(int *argc, char ***argv)
                exit(1);
        }
 
+       if (!startup_option.vtm) 
+               startup_option.vtm = g_strdup_printf("default");
+       startup_option.disk = g_strdup_printf("%semulimg-%s.%s",virtual_target_path, startup_option.vtm, arch); 
+       INFO("target name :%s, disk path: %s", startup_option.vtm, startup_option.disk);
+
        while(fgets(string, MAXBUF, fp)!=NULL)
                INFO("%s", string);
        dbg_printf("\n");
@@ -687,28 +705,6 @@ static int startup_option_parser(int *argc, char ***argv)
        free(virtual_target_path);
        free(info_file);
 
-       if (startup_option.target && !startup_option.disk) {
-               /* parse target option */
-               if (is_valid_target(startup_option.target) == -1) {
-                       fprintf(stderr, "target path (%s)  is invalid. retry target startup option\n", startup_option.target);
-                       exit(1);
-               }
-       }
-       else if (startup_option.disk && !startup_option.target) {
-               /* parse disk option */
-               if (is_exist_file(startup_option.disk) != 1) {
-                       fprintf(stderr, "disk image path (%s)  is invalid. retry disk startup option\n", startup_option.disk);
-                       exit(1);
-               }
-       }
-       else {
-               fprintf(stderr, "Need exactly one of --target or --disk\n");
-               exit(1);
-       }
-
-       if (!startup_option.vtm) {
-               fprintf(stderr, "vtm image is not selected\n");
-       }
        return 0;
 }