#! /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 hda -name squeeze-mipsel \
	-daemonize -display vnc=:41 -chardev \
	socket,id=monsock,host=127.0.0.1,port=2941,ipv4,server,telnet,nowait \
	-mon chardev=monsock,mode=readline -uuid \
	4b5c0487-0053-443e-8af6-f8698264b3d1"

NET_PARAMS='-net nic,macaddr=52:54:00:64:b3:d1 -net tap,ifname=squeeze-mipsel'

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

DISK_PARAMS="-drive file=$HERE/squeeze-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 5941, monitor on 2941 ==='

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