#! /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=oss

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

CORE_PARAMS="-M vexpress-a9 -m 1024 -name wheezy-armhf -daemonize \
	-display vnc=:45 -chardev \
	socket,id=monsock,host=127.0.0.1,port=2945,ipv4,server,telnet,nowait \
	-mon chardev=monsock,mode=readline -uuid \
	bc99e737-f63c-4782-86b0-7876a8c2580a"

NET_PARAMS='-net nic,macaddr=52:54:00:c2:58:0a -net tap,ifname=wheezy-armhf'

LINUX_PARAMS="-kernel $HERE/zImage-arm-3.2.0-4 -initrd \
	$HERE/initrd-armhf-3.2.0-4 -append 'root=/dev/mmcblk0p1 ro'"

DISK_PARAMS="-drive file=$HERE/wheezy-armhf.raw,if=sd,aio=native"

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

echo '== Display on 5945, monitor on 2945 ==='

eval qemu-system-arm $CORE_PARAMS $NET_PARAMS $LINUX_PARAMS $DISK_PARAMS \
	$BOOT_PARAMS
