#! /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=alsa

# QEMU_AUDIO_DRV=oss or sdl or wav or none. See qemu -audio-help.
export QEMU_AUDIO_DRV=none

CORE_PARAMS="-M sun4u -m 256 -name squeeze-sparc64 -nographic -vga none \
	-uuid c7317832-8e9a-4821-b348-1e6b97601259"
#	-daemonize -chardev \
#       socket,id=monsock,host=127.0.0.1,port=2944,ipv4,server,telnet,nowait \
#        -mon chardev=monsock,mode=readline"
#        -display vnc=:44 -chardev \

NET_PARAMS='-net nic,macaddr=52:54:00:60:12:59 -net tap,ifname=squeeze-sparc64'

LINUX_PARAMS='-prom-env "auto-boot?=false" -prom-env "output-device=ttya" -prom-env "input-device=ttya"'
#LINUX_PARAMS='-prom-env "boot-device=cdrom" -prom-env "boot-args=Linux fbcon=vc:1-6"'
#LINUX_PARAMS="-kernel vmlinuz-2.6.32-5-sparc64 -initrd initrd-squeeze-di-sparc -append \
#	'root=/dev/rd/0 rw DEBCONF_PRIORITY=low ramdisk_size=8192 rootfstype=ext2' \
#	-prom-env 'boot-device=disk:a' -prom-env 'boot-args=Linux fbcon=vc:1-6'"

DISK_PARAMS="-drive file=$HERE/squeeze-sparc64.raw,if=ide \
	-drive file=$HERE/mini_squeeze.iso,if=ide,media=cdrom"

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

echo '== Display on 5944, monitor on 2944 ==='

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