#! /bin/sh

#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 vexpress-a9 -m 1024 -L /usr/share/qemu -name jessie-armhf \
	-daemonize -display vnc=:50 -chardev \
	socket,id=monsock,host=127.0.0.1,port=2950,ipv4,server,telnet,nowait \
	-mon chardev=monsock,mode=readline -uuid \
	be6aeafe-b6b8-4179-b0b1-e1b10514b42f"

NET_PARAMS='-net nic,macaddr=52:54:00:14:b4:2f -net tap,ifname=jessie-armhf'

LINUX_PARAMS="-kernel /usr/local/share/qemu/zImage-arm-3.2.0-4 -initrd \
	/usr/local/share/qemu/initrd8-armhf-3.2.0-4 -append \
	'root=/dev/mmcblk0p1 ro'"

DISK_PARAMS="-drive \
	file=/dev/phoenix/jessie-armhf,if=sd,aio=native,cache.direct=on,format=raw"

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

echo '== Display on 5950, monitor on 2950 ==='

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