6 TIMEOUT=600 # 10 minutes
8 # Are we native, or running under full emulation?
12 if [ "$MACH"x = ""x ] || \
13 [ "$MACH"x = "aarch64"x ] || \
14 [ "$MACH"x = "arm64" ] ; then
16 CPU_OPTS="-cpu host --enable-kvm"
17 MACH_OPTS="-machine virt,gic-version=host,kernel_irqchip=on"
18 elif [ "$MACH"x = "arm"x ]; then
20 CPU_OPTS="-cpu host,aarch64=off --enable-kvm"
21 MACH_OPTS="-machine virt,gic-version=host,kernel_irqchip=on"
23 echo "Unknown MACH $MACH; abort"
28 if [ "$MACH"x = ""x ] || \
29 [ "$MACH"x = "aarch64"x ] || \
30 [ "$MACH"x = "arm64" ] ; then
32 CPU_OPTS="-cpu cortex-a57"
34 elif [ "$MACH"x = "arm"x ]; then
36 CPU_OPTS="-cpu cortex-a15"
39 echo "Unknown MACH $MACH; abort"
45 if [ "$DISK"x = ""x ] ; then
49 #DISPLAY="-vga none -nographic"
50 DISPLAY="-daemonize -vnc :1"
51 PFLASH="-pflash $MACH-OVMF.fd -pflash $MACH-storage.fd"
54 if [ "$NOSHARE"x = ""x ]; then
55 P9="-virtfs local,path=$SHARE/,mount_tag=host0,security_model=passthrough,id=host0"
56 if [ -f ~/.ssh/authorized_keys ]; then
57 cp ~/.ssh/authorized_keys $SHARE/runtime/vagrant-pub-key
59 touch $SHARE/runtime/waiting_runtime_vm
64 NET="$NET,hostfwd=tcp:127.0.0.1:${SSH_PORT}-10.0.2.15:22"
65 NET="$NET -device virtio-net-device,netdev=eth0"
67 CMD="qemu-system-$MACH -m $MEM \
69 $MACH_OPTS $CPU_OPTS \
71 -drive file=$DISK,format=raw,if=virtio \
80 echo "Waiting for qemu VM to come ready ($i seconds)"
81 if [ ! -f $SHARE/runtime/waiting_runtime_vm ]; then
82 echo "ready after $i seconds"
89 # else the VM timed out
90 echo "qemu VM startup took too long: $i seconds. Abort"