#! /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 etch-arm -daemonize \
	-display vnc=:27 -chardev \
	socket,id=monsock,host=127.0.0.1,port=2927,ipv4,server,telnet,nowait \
	-mon chardev=monsock,mode=readline -uuid \
	e78d06cc-1a18-4b7d-95fb-7318dc2593d7"

NET_PARAMS='-net nic,macaddr=52:54:00:25:93:d7 -net tap,ifname=etch-arm'

LINUX_PARAMS="-kernel $HERE/zImage-arm-2.6.23.12 -initrd \
	$HERE/initrd-arm-2.6.23.12 -append \
	'root=/dev/sda1 ro lockd.nlm_udpport=32767 lockd.nlm_tcpport=32767'"

DISK_PARAMS="-drive file=$HERE/etch-arm.raw,if=scsi,aio=native \
	-drive file=$HERE/arm_home.raw,if=scsi,index=1,aio=native"

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

echo '== Display on 5927, monitor on 2927 ==='

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