UNPKG

1.75 kBapplication/x-shView Raw
1#!/bin/bash
2
3EMULATOR_DIR=$1
4PORT=$2
5
6echo "PORT=$PORT"
7if [ "x$2" = "x" ];then
8 PORT="5555"
9fi
10
11
12isEmulatorRunning(){
13 PID=`pgrep "emulator-x86"`
14 if [ "x$PID" = "x" ];then
15 return 0
16 fi
17 return 1
18}
19
20
21isEmulatorRunning
22if [ $? -eq 1 ];then
23 echo "vm is running"
24 exit 0
25fi
26
27
28$EMULATOR_DIR/emulator-x86 "--skin-args" "width=720" "height=1280" "skin.path=$EMULATOR_DIR/skin_conf" "--qemu-args" "-cpu" "qemu64,+ssse3" "-drive" "file=$EMULATOR_DIR/vm-sda.vdi" "-M" "maru-x86-machine" "-m" "2048" "-show-cursor" "-enable-vigs" "-vigs-backend" "gl" "-enable-yagl" "-yagl-backend" "vigs" "-device" "virtio-esm-pci" "-device" "virtio-evdi-pci" "-device" "virtio-keyboard-pci" "-device" "maru-brightness" "-device" "virtio-hwkey-pci" "-device" "virtio-nfc-pci" "-device" "virtio-power-pci" "-device" "virtio-touchscreen-pci,max_point=10" "-device" "virtio-sensor-pci,sensors=accel&geo&gyro&light&proxi" "-device" "virtio-jack-pci,jacks=earjack&charger&usb" "-L" "$EMULATOR_DIR/pc-bios" "-vga" "none" "-kernel" "$EMULATOR_DIR/bzImage" "-boot" "c" "-append" "root=/dev/sda1 console=ttyS0 video=LVDS-1:720x1280-32@60 dpi=2330 ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none vm_name=syberos rootfstype=ext4" "-serial" "stdio" "-net" "user,dhcpstart=10.0.2.16,hostfwd=tcp::$PORT-:22,hostfwd=tcp::10000-:10000,hostfwd=tcp::10001-:10001" "-rtc" "base=utc" "-net" "nic,model=virtio,macaddr=34:17:EB:B0:27:85" "-enable-kvm" &> /dev/null &
29echo "startting vm..."
30
31while true
32do
33 nport=`echo ""|telnet localhost $PORT 2>/dev/null|grep "\^]"|wc -l`
34 if [ $nport -eq 1 ];then
35 sleep 5
36
37 isEmulatorRunning
38 if [ $? -eq 1 ];then
39 echo "vm started!"
40 exit 1
41 else
42 echo "vm startup failed!"
43 exit 2
44 fi
45 fi
46 sleep 2
47done