#! /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 squeeze-mips -daemonize \
	-display vnc=:40 -chardev \
	socket,id=monsock,host=127.0.0.1,port=2940,ipv4,server,telnet,nowait \
	-mon chardev=monsock,mode=readline -uuid \
	2a29f595-f295-4633-9101-078e824796ee"

NET_PARAMS='-net nic,macaddr=52:54:00:47:96:ee -net tap,ifname=squeeze-mips'

LINUX_PARAMS="-kernel $HERE/vmlinux-mips-2.6.32-5 -initrd \
	$HERE/initrd-mips-2.6.32-5 -append \
	'console=tty0 root=/dev/sda1 ro fbcon=vc:1-6'"

DISK_PARAMS="-drive file=$HERE/squeeze-mips.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 5940, monitor on 2940 ==='

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