#! /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 r2d -m 64 -name squeeze-sh4 -usb -usbdevice mouse \
	-rtc base=utc,clock=host -daemonize -display vnc=:43 -chardev \
	socket,id=monsock,host=127.0.0.1,port=2943,ipv4,server,telnet,nowait \
	-mon chardev=monsock,mode=readline -uuid \
	56c40400-3b87-4d6c-930c-c2734c5261a2"

NET_PARAMS='-net nic,macaddr=52:54:00:52:61:a2 -net tap,ifname=squeeze-sh4'

LINUX_PARAMS="-kernel $HERE/zImage-sh4-2.6.32-5 -initrd \
	$HERE/initrd-sh4-2.6.32-5 -append 'root=/dev/sda1 ro noiotrap'"

DISK_PARAMS="-drive file=$HERE/squeeze-sh4.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 5943, monitor on 2943 ==='

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