package org.tizen.emulator.manager.console;
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.tool.SelectSkin;
import org.tizen.emulator.manager.ui.detail.VMPropertyView;
import org.tizen.emulator.manager.vms.Creator;
+import org.tizen.emulator.manager.vms.EmulatorVMs;
import org.tizen.emulator.manager.vms.RAM_SIZE;
import org.tizen.emulator.manager.vms.RESOLUTION;
import org.tizen.emulator.manager.vms.VMCreateHelper;
checkVMName(c.getCurrentValue());
prop.vmsName = c.getCurrentValue();
} else if (c.getShortName() == "p") {
- checkImagePath(c.getCurrentValue());
- prop.baseImagePath = c.getCurrentValue();
+ prop.baseImagePath = checkImagePath(c.getCurrentValue());
+ if (prop.baseImagePath.endsWith(".x86")) {
+ EmulatorVMs.getInstance().CustomArch = "x86";
+ } else if (prop.baseImagePath.endsWith(".arm")) {
+ EmulatorVMs.getInstance().CustomArch = "arm";
+ } else {
+ throw new ConsoleException("Avaliable format of base image is .x86 or .arm.");
+ }
} else {
// Options
setOptions(c, prop);
prop.baseName = image.getName();
prop.baseImagePath = image.getPath();
prop.baseImagePathName = image.getImagePathName();
+ prop.archType = image.getCpu();
break;
}
}
"Valid Charater : a-z, A-Z, 0-9, 0, _");
}
- //TODO : x86
- if (helper.checkDupulicateName(name, "x86")) {
+ if (helper.checkDupulicateName(name)) {
throw new ConsoleException("The name (" + name + ") already exists!");
}
}
}
- private void checkImagePath(String value) throws ConsoleException {
+ private String checkImagePath(String value) throws ConsoleException {
if (value == null || value.isEmpty()) {
throw new ConsoleException("Path of disk image is empty.");
}
if (!f.exists()) {
throw new ConsoleException("This directory does not exist. (Path : " + value + ")");
}
+
+ try {
+ return f.getCanonicalPath();
+ } catch (IOException e) {
+ throw new ConsoleException("Path of base image has problem : \n" + e.getMessage());
+ }
}
}
import org.tizen.emulator.manager.ui.MessageDialog;
import org.tizen.emulator.manager.ui.ResourceRegistry;
import org.tizen.emulator.manager.ui.ResourceRegistry.ImageName;
+import org.tizen.emulator.manager.vms.EmulatorVMs;
import org.tizen.emulator.manager.vms.RESOLUTION;
import org.tizen.emulator.manager.vms.VMCreateHelper;
import org.tizen.emulator.manager.vms.VMPropertyValue;
private Button baseImageButton;
private String newPath;
private String newPathName;
- private String arch;
private Image image;
private FileDialog baseImageFD;
private boolean isSelected;
}
public boolean settingWidget(Table table, VMPropertyValue value) {
- arch = value.archType;
newPath = value.baseImagePath;
newPathName = value.baseImagePathName;
baseImageButton = new Button(table, SWT.PUSH);
baseImageFD = new FileDialog(
EmulatorManager.getInstance().getMainDialog().getShell(),
SWT.OPEN);
- baseImageFD.setText(String.format("Select existing Base Image(%s)", arch));
- String[] filter = {String.format("*.%s", arch)};
- String[] filterName = {String.format("Disk Image Files(*.%s)", arch)};
+ baseImageFD.setText(String.format("Select existing Base Image"));
+ String[] filter = {"*.x86", "*.arm"};
+ String[] filterName = {"Disk Image Files(*.x86)", "Disk Image Files(*.arm)"};
baseImageFD.setFilterExtensions(filter);
baseImageFD.setFilterNames(filterName);
}
}
newPath = path;
newPathName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
+
+ EmulatorVMs.getInstance().CustomArch = newPathName.endsWith("x86") ? "x86" : "arm";
+
baseImageButton.setText(newPathName);
isSelected = true;
((NameText)TableWidgetList.getInstance().findVMWidget("name", isCreateMode())).checkImageName();
return null;
}
- if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
- binary = "emulator-x86.exe";
+ if (property.getArch().toString().equals("x86")) {
+ if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
+ binary = "emulator-x86.exe";
+ } else {
+ binary = "emulator-x86";
+ }
} else {
- binary = "emulator-x86";
+ if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
+ binary = "emulator-arm.exe";
+ } else {
+ binary = "emulator-arm";
+ }
}
// check disk image
cmd.add("skin.path=" + skinPath);
}
cmd.add("--qemu-args");
- cmd.add("-drive");
- //cmd.add("file=" + EmulatorVMs.getInstance().getVMsBaseDirectory() + File.separator + property.getArch().toString() + File.separator + property.getName() + File.separator +"emulimg-" + property.getName() + ".x86,if=virtio");
- cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()+ ",if=virtio,index=1");
- cmd.add( "-boot");
- cmd.add("c");
- cmd.add("-append");
- /* is linux and use fileshare [kernel option] */
- if(isLinux > -1 && isFileshare) {
- cmd.add("console=ttyS0 video=uvesafb:ywrap,"
- + width
- + "x"
- + height
- + "-32@60"
- + " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue() * 10
- + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none 5 virtio-9p");
- }
- else {
- cmd.add("console=ttyS0 video=uvesafb:ywrap,"
- + width
- + "x"
- + height
- + "-32@60"
- + " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue() * 10
- + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none 5");
- }
- /* is linux and use fileshare [non-kernel option] */
- if(isLinux > -1 && isFileshare) {
- cmd.add("-virtfs");
- cmd.add("local,path=" + property.getConfiguration().getUsability().getFileSharing().getPath() +",security_model=none,mount_tag=fileshare");
- }
+ // x86 part of cmd
+ if (property.getArch().toString().equals("x86")) {
+ cmd.add("-drive");
+ cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()+ ",if=virtio,index=1");
+ cmd.add( "-boot");
+ cmd.add("c");
+ cmd.add("-append");
+ /* is linux and use fileshare [kernel option] */
+ if(isLinux > -1 && isFileshare) {
+ cmd.add("console=ttyS0 video=uvesafb:ywrap,"
+ + width
+ + "x"
+ + height
+ + "-32@60"
+ + " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue() * 10
+ + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none 5 virtio-9p");
+ }
+ else {
+ cmd.add("console=ttyS0 video=uvesafb:ywrap,"
+ + width
+ + "x"
+ + height
+ + "-32@60"
+ + " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue() * 10
+ + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none 5");
+ }
+ /* is linux and use fileshare [non-kernel option] */
+ if(isLinux > -1 && isFileshare) {
+ cmd.add("-virtfs");
+ cmd.add("local,path=" + property.getConfiguration().getUsability().getFileSharing().getPath() +",security_model=none,mount_tag=fileshare");
+ }
- /* is windows XP and use fileshare */
- if(isWindows > -1 && osVersion.equals("5.1") && isFileshare) {
+ /* is windows XP and use fileshare */
+ if(isWindows > -1 && osVersion.equals("5.1") && isFileshare) {
/* delete if fileshare with the same name existed */
List<String> cmd2 = new ArrayList<String>();
cmd2.add("net");
}
logger.log(Level.WARNING, "Failed to execute fileshare command.\n" + e.getMessage());
}
-
+
/* start net share */
List<String> cmd3 = new ArrayList<String>();
cmd3.add("net");
}
logger.log(Level.WARNING, "Failed to execute fileshare command.\n" + e.getMessage());
}
- }
- /* is windows 7 and use fileshare */
- else if(isWindows > -1 && osVersion.equals("6.1") && isFileshare) {
+ }
+ /* is windows 7 and use fileshare */
+ else if(isWindows > -1 && osVersion.equals("6.1") && isFileshare) {
/* delete if fileshare with the same name existed */
- List<String> cmd2 = new ArrayList<String>();
- cmd2.add("net");
- cmd2.add("share");
- cmd2.add("emulator-" + portNo);
- cmd2.add("/delete");
- logger.log(Level.INFO, cmd2.toString());
- ProcessBuilder pb2 = new ProcessBuilder(cmd2);
- try {
- pb2.start();
- } catch (IOException e) {
- if (!isConsole) {
- new MessageDialog().openWarningDialog("Failed to execute fileshare command.\n" + e.getMessage());
+ List<String> cmd2 = new ArrayList<String>();
+ cmd2.add("net");
+ cmd2.add("share");
+ cmd2.add("emulator-" + portNo);
+ cmd2.add("/delete");
+ logger.log(Level.INFO, cmd2.toString());
+ ProcessBuilder pb2 = new ProcessBuilder(cmd2);
+ try {
+ pb2.start();
+ } catch (IOException e) {
+ if (!isConsole) {
+ new MessageDialog().openWarningDialog("Failed to execute fileshare command.\n" + e.getMessage());
+ }
+ logger.log(Level.WARNING, "Failed to execute fileshare command.\n" + e.getMessage());
}
- logger.log(Level.WARNING, "Failed to execute fileshare command.\n" + e.getMessage());
- }
/* start net share */
- List<String> cmd3 = new ArrayList<String>();
- cmd3.add("net");
- cmd3.add("share");
- cmd3.add("emulator-" + portNo + "=" + fileshare);
- cmd3.add("/grant:"+ System.getProperty("user.name") + ",full");
- logger.log(Level.INFO, cmd3.toString());
- ProcessBuilder pb3 = new ProcessBuilder(cmd3);
- try {
- pb3.start();
- } catch (IOException e) {
- if (isConsole) {
- new MessageDialog().openWarningDialog("Failed to execute fileshare command.\n" + e.getMessage());
+ List<String> cmd3 = new ArrayList<String>();
+ cmd3.add("net");
+ cmd3.add("share");
+ cmd3.add("emulator-" + portNo + "=" + fileshare);
+ cmd3.add("/grant:"+ System.getProperty("user.name") + ",full");
+ logger.log(Level.INFO, cmd3.toString());
+ ProcessBuilder pb3 = new ProcessBuilder(cmd3);
+ try {
+ pb3.start();
+ } catch (IOException e) {
+ if (isConsole) {
+ new MessageDialog().openWarningDialog("Failed to execute fileshare command.\n" + e.getMessage());
+ }
+ logger.log(Level.WARNING, "Failed to execute fileshare command.\n" + e.getMessage());
}
- logger.log(Level.WARNING, "Failed to execute fileshare command.\n" + e.getMessage());
}
- }
- cmd.add("-serial");
- cmd.add("file:" + EmulatorVMs.getInstance().getVMsConfigDirectory() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog");
- cmd.add("-m");
- cmd.add(String.valueOf(property.getConfiguration().getDevice().getRAM().getSize().getValue()));
- cmd.add("-M");
- cmd.add("maru-x86-machine");
- cmd.add("-net");
- cmd.add("nic,model=virtio,macaddr=" + macAddr);
- cmd.add("-soundhw");
- cmd.add("all");
- cmd.add("-usb");
- cmd.add("-usbdevice");
- cmd.add("maru-touchscreen");
- cmd.add("-vga");
- cmd.add("maru");
- cmd.add("-bios");
- cmd.add("bios.bin");
- cmd.add("-L");
- cmd.add(fio.getBiosPath());
- cmd.add("-kernel");
- cmd.add(fio.getKernelPath() + File.separator+ "bzImage." + property.getArch().toString());
- cmd.add("-net");
- cmd.add("user");
- cmd.add("-rtc");
- cmd.add("base=utc");
- if (property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage() != null) {
+ cmd.add("-serial");
+ cmd.add("file:" + EmulatorVMs.getInstance().getVMsConfigDirectory() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog");
+ cmd.add("-m");
+ cmd.add(String.valueOf(property.getConfiguration().getDevice().getRAM().getSize().getValue()));
+ cmd.add("-M");
+ cmd.add("maru-x86-machine");
+ cmd.add("-net");
+ cmd.add("nic,model=virtio,macaddr=" + macAddr);
+ cmd.add("-soundhw");
+ cmd.add("all");
+ cmd.add("-usb");
+ cmd.add("-usbdevice");
+ cmd.add("maru-touchscreen");
+ cmd.add("-vga");
+ cmd.add("maru");
+ cmd.add("-bios");
+ cmd.add("bios.bin");
+ cmd.add("-L");
+ cmd.add(fio.getBiosPath());
+ cmd.add("-kernel");
+ cmd.add(fio.getKernelPath() + File.separator+ "bzImage." + property.getArch().toString());
+ cmd.add("-net");
+ cmd.add("user");
+ cmd.add("-rtc");
+ cmd.add("base=utc");
+ if (property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage() != null) {
+ cmd.add("-drive");
+ cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage().getValue() + ",if=virtio,index=2");
+ }
+ } else { // ARM part of cmd
+ if (path == null || path.isEmpty()) {
+ cmd.add(fio.getBinPath() + File.separator + binary);
+ } else {
+ this.binPath = path;
+ cmd.add(binPath + File.separator + binary);
+ }
+
+ cmd.add("--skin-args");
+ cmd.add("width=" + width);
+ cmd.add("height=" + height);
+ if (skinPath != null) {
+ cmd.add("skin.path=" + skinPath);
+ }
+ cmd.add("--qemu-args");
cmd.add("-drive");
- cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage().getValue() + ",if=virtio,index=2");
+ //cmd.add("file=" + EmulatorVMs.getInstance().getVMsBaseDirectory() + File.separator + property.getArch().toString() + File.separator + property.getName() + File.separator +"emulimg-" + property.getName() + ".x86,if=virtio");
+ cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()+ ",id=virtio-blk");
+ cmd.add( "-device");
+ cmd.add("virtio-blk,drive=virtio-blk");
+ cmd.add("-netdev");
+ cmd.add("user,id=virtio-net");
+ cmd.add("-device");
+ cmd.add("virtio-net,netdev=virtio-net");
+ cmd.add("-append");
+ cmd.add("console=ttySAC2,115200 video=s3cfb:"
+ + width
+ + "x"
+ + height
+ + "-24"
+ + " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue() * 10
+ + " rootwait root=/dev/vda rw rootfstype=ext4"
+ + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none 5"
+ + " virtio_mmio.device=4K@0x10AD0000:423 virtio_mmio.device=4K@0x10AC0000:422");
+ cmd.add("-serial");
+ cmd.add(isLinux > -1 ? "/dev/null" : "none");
+ cmd.add("-serial");
+ cmd.add(isLinux > -1 ? "/dev/null" : "none");
+ cmd.add("-serial");
+ cmd.add("file:" + EmulatorVMs.getInstance().getVMsConfigDirectory() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog");
+ cmd.add("-m");
+ cmd.add(String.valueOf(property.getConfiguration().getDevice().getRAM().getSize().getValue()));
+ cmd.add("-M");
+ cmd.add("maru-arm-machine");
+ cmd.add("-soundhw");
+ cmd.add("all");
+ cmd.add("-usb");
+ cmd.add("-usbdevice");
+ cmd.add("maru-touchscreen");
+ cmd.add("-kernel");
+ cmd.add(fio.getKernelPath() + File.separator+ "bzImage." + property.getArch().toString());
}
/* append HW virtualization option if supports */