#! /bin/sh

HERE=`dirname $0`
case "$HERE" in
/*)
    ;;
*)
    HERE=$PWD/$HERE
    ;;
esac

#export SDL_VIDEODRIVER=x11

# SDL_AUDIODRIVER=oss or alsa. Only meaningful if QEMU_AUDIO_DRV=sdl.
#export SDL_AUDIODRIVER=alsa

# QEMU_AUDIO_DRV=oss, sdl, wav, spice or none. See qemu -audio-help.
export QEMU_AUDIO_DRV=spice

CORE_PARAMS="-machine type=pc,accel=kvm -m 512 -vga std -name squeeze-x86 \
	-daemonize -global qxl.vram_size=67108864 -smp 2 -balloon virtio \
	-soundhw ac97 -chardev \
	socket,id=monsock,host=127.0.0.1,port=2936,ipv4,server,telnet,nowait \
	-mon chardev=monsock,mode=readline -uuid \
	4bc9a15a-95cd-b24a-79c1-2cbaa6598c7b"

SPICE_PARAMS="-spice port=5936,disable-ticketing,agent-mouse=on \
	-device piix3-usb-uhci -device usb-tablet \
	-device virtio-serial-pci,id=virtio-serial0 \
	-chardev spicevmc,id=vdagent,name=vdagent \
	-device virtserialport,nr=1,bus=virtio-serial0.0,chardev=vdagent"

NET_PARAMS="-net nic,macaddr=52:54:00:59:8c:7b,model=virtio \
	-net tap,ifname=squeeze-x86"

DISK_PARAMS="-drive file=$HERE/squeeze-x86.raw,if=virtio,aio=native"

# One of: a (floppy), c (hard disk), d (cdrom), n (network using PXE)
BOOT_PARAMS='-boot order=c'

echo '== Display on 5936, monitor on 2936 ==='

eval qemu-system-x86_64 $CORE_PARAMS $SPICE_PARAMS $NET_PARAMS $DISK_PARAMS \
	$BOOT_PARAMS
