#! /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 versatilepb -m 256 -name lenny-arm -daemonize \
	-display vnc=:29 -chardev \
	socket,id=monsock,host=127.0.0.1,port=2929,ipv4,server,telnet,nowait \
	-mon chardev=monsock,mode=readline -uuid \
	54da9ce2-72f1-4659-a648-e023de0d6f6b"

NET_PARAMS='-net nic,macaddr=52:54:00:0d:6f:6b -net tap,ifname=lenny-arm'

LINUX_PARAMS="-kernel $HERE/zImage-arm-2.6.26-2 -initrd \
	$HERE/initrd-arm-2.6.26-2 -append 'root=/dev/sda1 ro'"

DISK_PARAMS="-drive file=$HERE/lenny-arm.raw,if=scsi,aio=native \
	-drive file=$HERE/arm_home.raw,if=scsi,index=1,aio=native"

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

echo '== Display on 5929, monitor on 2929 ==='

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