#! /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 versatilepb -m 256 -name wheezy-armel -daemonize \
CORE_PARAMS="-M versatilepb -cpu cortex-a9 -m 1024 -name wheezy-armel \
	-daemonize -display vnc=:46 -chardev \
	socket,id=monsock,host=127.0.0.1,port=2946,ipv4,server,telnet,nowait \
	-mon chardev=monsock,mode=readline -uuid \
	09c9de94-8c95-4a9e-be6e-b6a729f38c2b"

NET_PARAMS='-net nic,macaddr=52:54:00:f3:8c:2b -net tap,ifname=wheezy-armel'

#LINUX_PARAMS="-kernel $HERE/zImage-arm-3.2.0-4 -initrd \
#	$HERE/initrd-armel-3.2.0-4 -append 'root=/dev/sda1 ro'"
LINUX_PARAMS="-kernel $HERE/zImage-arm-3.2.27-1 -initrd \
	$HERE/initrd-armel-3.2.27-1 -append 'root=/dev/sda1 ro'"

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

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

echo '== Display on 5946, monitor on 2946 ==='

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