Skip to content

Instantly share code, notes, and snippets.

@lukego
Created September 18, 2015 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukego/46c61fcade082fbdc43d to your computer and use it in GitHub Desktop.
Save lukego/46c61fcade082fbdc43d to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ "$1" == "1" ]; then
kernel=/home/luke/vm/bzImage
img=/home/luke/vm/vm1.img
virtio=$HOME/vhost-vmA.socket
mac=52:54:00:00:00:00
telnet=5500
mgmt=virtio-net-pci
elif [ "$1" == "2" ]; then
kernel=/home/luke/vm/ubuntu-trusty/arch/x86_64/boot/bzImage
img=/home/luke/vm/vm2.img
virtio=$HOME/vhost-vmB.socket
mac=52:54:00:00:00:01
telnet=5501
mgmt=virtio-net-pci
elif [ "$1" == "3" ]; then
kernel=/home/luke/vm/ubuntu-trusty-novirtio/arch/x86_64/boot/bzImage
img=/home/luke/vm/vm3.img
virtio=$HOME/vhost-vmC.socket
mac=52:54:00:00:00:02
telnet=5502
mgmt=e1000
else
echo "Usage: $0 1|2"
exit 1
fi
#sudo /home/luke/git/snabbco-qemu/x86_64-softmmu/qemu-system-x86_64 \
sudo qemu-system-x86_64 \
-kernel $kernel \
-append "earlyprintk root=/dev/vda rw console=tty0 console=ttyS0" \
-m 1024 -numa node,memdev=mem -object memory-backend-file,id=mem,size=1024M,mem-path=/hugetlbfs,share=on \
-netdev type=user,id=netuser0 \
-device $mgmt,netdev=netuser0 \
-device pci-assign,host=01:00.0 \
-device pci-assign,host=01:00.1 \
-M pc -smp 1 -cpu host --enable-kvm -serial stdio \
-drive if=virtio,file=$img -curses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment