2 # By Chih-Wei Huang <cwhuang@linux.org.tw>
3 # License: GNU Generic Public License v2
7 echo "Please Enter to continue or Ctrl-C to stop."
12 QEMU=qemu-system-${QEMU_ARCH}
14 which $QEMU > /dev/null 2>&1 || QEMU=qemu-system-i386
15 if ! which $QEMU > /dev/null 2>&1; then
16 echo -e "Please install $QEMU to run the program.\n"
20 cd ${OUT:-ANDROID_ROOT}
22 [ -e system.img ] && SYSTEMIMG=system.img || SYSTEMIMG=system.sfs
25 if [ `id -u` -eq 0 ]; then
26 DATA="-virtfs local,id=data,path=data,security_model=passthrough,mount_tag=data"
29 echo -e "\n$(realpath data) subfolder exists.\nIf you want to save data to it, run $0 as root:\n\n$ sudo $0\n"
32 elif [ -e data.img ]; then
33 if [ -w data.img ]; then
34 DATA="-drive index=2,if=virtio,id=data,file=data.img"
37 echo -e "\n$(realpath data.img) exists but is not writable.\nPlease grant the write permission if you want to save data to it.\n"
46 -append "CMDLINE console=ttyS0 RAMDISK=vdb $DATADEV" \
48 -m 2048 -smp 2 -cpu host \
52 -drive index=0,if=virtio,id=system,file=$SYSTEMIMG,format=raw,readonly \
53 -drive index=1,if=virtio,id=ramdisk,file=ramdisk.img,format=raw,readonly \
54 -netdev user,id=mynet,hostfwd=tcp::5555-:5555 -device virtio-net-pci,netdev=mynet \
58 # Try to run QEMU in several VGA modes
59 run_qemu -vga virtio -display sdl,gl=on $@ || \
60 run_qemu -vga std -display sdl $@ || \