RunQemu - Add AHCI support
[tpg/acess2.git] / RunQemu
1 #!/bin/sh
2 #qemu-system-x86_64 -fda DiskImage.img -boot a -serial stdio -net user,hostname=prelude,dns=10.0.2.1 -net nic,model=ne2k_pci -vga std
3
4 QEMU=qemu-system-x86_64
5 USE_GDB=
6 BOOTOPT="-fda DiskImage.img -boot a"
7
8 QEMU_PARAMS=""
9 QEMU_PARAMS=$QEMU_PARAMS" -hda AcessHDD.img"
10 QEMU_PARAMS=$QEMU_PARAMS" -vga std"
11 QEMU_PARAMS=$QEMU_PARAMS" -smp 2"
12 MODS=""
13
14 _NETTYPE="user,hostfwd=tcp::5555-:23"
15 _NETMODEL=e1000
16
17 _EVAL=eval
18
19 while [ $# -ne 0 ]; do
20         case $1 in
21         -gdb)
22                 QEMU_PARAMS=$QEMU_PARAMS" -s -S"
23                 ;;
24         -mod)
25                 shift
26                 MODS=$MODS","$1
27                 ;;
28         -dbin)
29                 shift
30                 if [ "x$2" = "xdefault" ] || [ "x$2" = "x" ]; then
31                         _kfile="KernelLand/Acess2.$1.bin"
32                 else
33                         _kfile="KernelLand/Acess2.$1-$2.bin"
34                 fi
35                 BOOTOPT="-kernel $_kfile"
36                 BOOTOPT=$BOOTOPT" -initrd KernelLand/Modules/Filesystems/FS_InitRD.kmd.$1$MODS -append \"$3\""
37                 shift
38                 shift
39                 ;;
40         -dbgbin)
41                 QEMU=/home/tpg/apps/bin/qemu-system-x86_64
42                 ;;
43         -bin)
44                 shift
45                 QEMU=$1
46                 ;;
47         -dbgscript)
48                 QEMU="echo $QEMU"
49                 ;;
50         -extramem)
51                 QEMU_PARAMS=$QEMU_PARAMS" -m 768"
52                 ;;
53         -e)
54                 shift
55                 QEMU_PARAMS=$QEMU_PARAMS" "$1
56                 ;;
57         -n)
58                 _EVAL=echo
59                 ;;
60         -fwd)
61                 _NETTYPE=$_NETTYPE",hostfwd=tcp::10023-10.0.2.10:23"
62                 ;;
63         -tuntap)
64                 _NETTYPE="tap"
65                 ;;
66         -nousb)
67                 _NOUSB="yes"
68                 ;;
69         -notee)
70                 _NOTEE="yes"
71                 ;;
72         -nographic)
73                 _NOGRAPHIC="yes"
74                 ;;
75         -netmodel)
76                 shift
77                 _NETMODEL=$1
78                 ;;
79         -pciserial)
80                 QEMU_PARAMS=$QEMU_PARAMS" -device pci-serial,chardev=serial2"
81                 QEMU_PARAMS=$QEMU_PARAMS" -chardev socket,id=serial2,host=localhost,port=10023,server,telnet"
82                 ;;
83         -sata)
84                 QEMU_PARAMS=$QEMU_PARAMS" -device ich9-ahci,id=ahci"
85                 QEMU_PARAMS=$QEMU_PARAMS" -drive if=none,id=sata_disk,file=HDD_sata.img"
86                 QEMU_PARAMS=$QEMU_PARAMS" -device ide-drive,drive=sata_disk,bus=ahci.0"
87                 ;;
88         esac
89         shift
90 done
91
92 QEMU_PARAMS=$QEMU_PARAMS" -net nic,model="$_NETMODEL
93 QEMU_PARAMS=$QEMU_PARAMS" -net "$_NETTYPE
94
95 if [ "x$_NOUSB" != "xyes" ] ; then
96         QEMU_PARAMS=$QEMU_PARAMS" -usb"
97         QEMU_PARAMS=$QEMU_PARAMS" -device usb-ehci"
98         QEMU_PARAMS=$QEMU_PARAMS" -drive id=test_usb_image,file=USB_Test_Image.img,if=none"
99         QEMU_PARAMS=$QEMU_PARAMS" -device usb-storage,drive=test_usb_image"
100         QEMU_PARAMS=$QEMU_PARAMS" -usbdevice mouse"
101 #       QEMU_PARAMS=$QEMU_PARAMS" -usbdevice keyboard"
102 fi
103
104 if [ "x$_NOTEE" = "xyes" ] ; then
105         _TEECMD=
106 else
107         _TEECMD=" | tee QemuLog.txt"
108 fi
109
110 #       /home/tpg/apps/bin/qemu-system-x86_64 $QEMU_PARAMS -serial stdio -serial file:QemuLog.txt
111 #       qemu-system-x86_64 $QEMU_PARAMS -serial stdio | tee QemuLog.txt
112 #echo $QEMU $BOOTOPT $QEMU_PARAMS
113 if [ "x$_NOGRAPHIC" = "xyes" ] ; then
114         $_EVAL $QEMU $BOOTOPT $QEMU_PARAMS -nographic $_TEECMD
115         exit
116 fi
117
118 $_EVAL $QEMU $BOOTOPT $QEMU_PARAMS -serial stdio $_TEECMD

UCC git Repository :: git.ucc.asn.au