7 TIMEOUT=600 # 10 minutes
9 # Are we native, or running under full emulation?
13 if [ "$MACH"x = ""x ] || \
14 [ "$MACH"x = "aarch64"x ] || \
15 [ "$MACH"x = "arm64" ] ; then
17 CPU_OPTS="-cpu host --enable-kvm"
18 MACH_OPTS="-machine virt,gic-version=host,kernel_irqchip=on"
19 elif [ "$MACH"x = "arm"x ]; then
21 CPU_OPTS="-cpu host,aarch64=off --enable-kvm"
22 MACH_OPTS="-machine virt,gic-version=host,kernel_irqchip=on"
24 echo "Unknown MACH $MACH; abort"
29 if [ "$MACH"x = ""x ] || \
30 [ "$MACH"x = "aarch64"x ] || \
31 [ "$MACH"x = "arm64" ] ; then
33 CPU_OPTS="-cpu cortex-a57"
35 elif [ "$MACH"x = "arm"x ]; then
37 CPU_OPTS="-cpu cortex-a15"
40 echo "Unknown MACH $MACH; abort"
46 if [ "$DISK"x = ""x ] ; then
50 #DISPLAY="-vga none -nographic"
51 DISPLAY="-daemonize -vnc :1"
52 PFLASH="-pflash $MACH-OVMF.fd -pflash $MACH-storage.fd"
55 if [ "$NOSHARE"x = ""x ]; then
56 P9="-virtfs local,path=$SHARE/,mount_tag=host0,security_model=passthrough,id=host0"
57 if [ -f ~/.ssh/authorized_keys ]; then
58 cp ~/.ssh/authorized_keys $SHARE/runtime/vagrant-pub-key
60 touch $SHARE/runtime/waiting_runtime_vm
65 NET="$NET,hostfwd=tcp:${VM_IP}:${SSH_PORT}-10.0.2.15:22"
66 NET="$NET -device virtio-net-device,netdev=eth0"
68 CMD="qemu-system-$MACH -m $MEM \
70 $MACH_OPTS $CPU_OPTS \
72 -drive file=$DISK,format=raw,if=virtio \
81 echo "Waiting for VM to come ready ($i seconds)"
82 if [ ! -f $SHARE/runtime/waiting_runtime_vm ]; then
83 echo "ready after $i seconds"
90 # else the VM timed out
91 echo "qemu VM startup took too long: $i seconds. Abort"