custom-image: setting CPU type for custom base image
authorminkee.lee <minkee.lee@samsung.com>
Wed, 25 Nov 2015 07:53:57 +0000 (16:53 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Wed, 25 Nov 2015 10:42:37 +0000 (19:42 +0900)
Setting CPU type is needed to create launch config file.
(image_arch=xxx)

Change-Id: I5de59006e7b93a075657cd4e2abe986cf25b11c2
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
src/org/tizen/emulator/manager/platform/BaseImage.java
src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java
src/org/tizen/emulator/manager/vms/option/CommonOption.java

index aa19ed1..e768dd9 100644 (file)
@@ -112,6 +112,18 @@ public class BaseImage {
                loadTemplate();
        }
 
+       public void settingCPU() {
+               if (cpu != null || path == null ) {
+                       return;
+               }
+
+               String arch = FilePathResources.getFileExtention(path);
+               cpu = Architecture.getType(arch);
+               if (cpu == null) {
+                       cpu = Architecture.x86;
+               }
+       }
+
        @Override
        public String toString() {
                return  information;
index a0bb4d2..c1fe320 100644 (file)
@@ -234,6 +234,7 @@ public class BaseImageViewItem extends ComboViewItem {
 
                                        BaseImage newItem;
                                        newItem = new BaseImage(ProfileList.getProfile(currentBaseImage.getProfile()).getPlatformByLatestVersion(), newPath);
+                                       newItem.settingCPU();
                                        if (storeCustomImage(newItem)) {
                                                baseImageList.add(newItem);
                                                resetComboList();
index 960dba3..58d0647 100644 (file)
@@ -33,6 +33,7 @@ import java.io.File;
 import org.tizen.emulator.manager.EmulatorManager;
 import org.tizen.emulator.manager.resources.FilePathResources;
 import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.VMProperty.Architecture;
 import org.tizen.emulator.manager.vms.helper.VMLauncherException;
 
 public class CommonOption extends Option {
@@ -48,7 +49,11 @@ public class CommonOption extends Option {
                                + (property.getPropertyValue().baseImage.getProfileExtension().isEmpty()
                                                ? "" : "-"+ property.getPropertyValue().baseImage.getProfileExtension()));
 
-               config.addVariable(OPTION_KEY.VAR_IMAGE_ARCH, property.getArchInternal().toString());
+               Architecture arch = property.getArchInternal();
+               if (arch == null) {
+                       arch = Architecture.x86;
+               }
+               config.addVariable(OPTION_KEY.VAR_IMAGE_ARCH, arch.toString());
 
                // kernel log
                config.addKernelOption("console", "ttyS0"); //$NON-NLS-1$ //$NON-NLS-2$