#! /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 malta -m 256 -soundhw es1370 -name etch-mipsel -daemonize \
	-display vnc=:36 -chardev \
	socket,id=monsock,host=127.0.0.1,port=2936,ipv4,server,telnet,nowait \
	-mon chardev=monsock,mode=readline -uuid \
	306e3ce1-4042-4252-8201-c3aa089d13b4"

NET_PARAMS='-net nic,macaddr=52:54:00:9d:13:b4 -net tap,ifname=etch-mipsel'

LINUX_PARAMS="-kernel $HERE/vmlinux-mipsel-2.6.24-etchnhalf.1 -initrd \
	$HERE/initrd-mipsel-2.6.24-etchnhalf.1 -append \
	'console=tty0 root=/dev/hda1 ro fbcon=vc:1-6 lockd.nlm_udpport=32767 lockd.nlm_tcpport=32767'"

DISK_PARAMS="-drive file=$HERE/etch-mipsel.raw,if=ide,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-mipsel $CORE_PARAMS $NET_PARAMS $LINUX_PARAMS $DISK_PARAMS $BOOT_PARAMS
