summaryrefslogtreecommitdiff
path: root/run-qemu
blob: e3c8aa83df11f6acb080b9179eb8a10e77c12cf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh -e

if test -n "$CONSOLE" ; then
  consoleoption="console=$CONSOLE"
fi

case "$QEMU_ARCH" in
  arm) cpuoption="-M virt -cpu cortex-a15" ;;
  aarch64) cpuoption="-M virt -cpu cortex-a57" ;;
  x86_64) cpuoption="-M pc -cpu qemu64"
esac

exec qemu-system-${QEMU_ARCH} -nographic $cpuoption -smp 4 -m 2G -nodefaults -display none -serial mon:stdio \
  -kernel "$OUTPUT/kernel" \
  -append "root=/dev/vda $consoleoption" \
  -drive if=virtio,file=$OUTPUT/rootfs.qcow2,format=qcow2,media=disk,index=1 \
  -drive if=virtio,file=$OUTPUT/rwfs.qcow2,format=qcow2,media=disk,index=2 \
  -drive if=virtio,file=$OUTPUT/userfs.qcow2,format=qcow2,media=disk,index=3 \
  -netdev user,id=eth0,hostfwd=::2222-10.0.2.1:22 \
  -device virtio-net-device,netdev=eth0