3 # on debian-like systems
4 # set up bridge aptitude install bridge-utils
6 # change /etc/network/interfaces to something like below and restart
10 #iface lo inet loopback
13 #iface br0 inet static
22 #iface eth0 inet ipv4ll
26 supported_archs="{arm mips x86}"
29 Usage: `basename $0` <arch>
30 where <arch> is one $supported_archs
31 Example: `basename $0` arm
40 macaddr="00:16:3e:00:00:01"
43 consoleopt="console=ttyAMA0 console=ttyS0"
45 qemu="qemu-system-arm"
47 kernel="/scratch/oe/deploy/$libc/images/qemu$arch/zImage-qemuarm.bin"
48 hdimage="/scratch/oe/deploy/$libc/images/qemu$arch/native-sdk-image-qemuarm.ext2"
49 #hdimage="/scratch/oe/deploy/$libc/images/qemu$arch/console-image-qemuarm.ext2"
53 macaddr="00:16:3e:00:00:02"
56 consoleopt="console=ttyS0"
58 qemu="qemu-system-mips"
60 kernel="/scratch/oe/deploy/$libc/images/qemu$arch/vmlinux-qemumips.bin"
61 hdimage="/scratch/oe/deploy/$libc/images/qemu$arch/native-sdk-image-qemumips.ext2"
62 hdimage="/scratch/oe/deploy/$libc/images/qemu$arch/console-image-qemumips.ext2"
67 macaddr="00:16:3e:00:00:03"
70 consoleopt="console=ttyS0"
72 qemu="qemu-system-ppcemb"
74 kernel="/scratch/oe/deploy/$libc/images/qemu$arch/uImage-qemuppc.bin"
75 hdimage="/scratch/oe/deploy/$libc/images/qemu$arch/helloworld-image-qemuppc.ext2"
80 macaddr="00:16:3e:00:00:04"
83 #consoleopt="console=tty0 console=ttySC1"
85 qemu="qemu-system-sh4 -serial vc -serial stdio"
86 #qemu="qemu-system-sh4"
88 kernel="/scratch/oe/deploy/$libc/images/qemu$arch/zImage-qemush4.bin"
89 #kernel="/home/kraj/qemu/sh/sh-test-0.2/zImage"
90 hdimage="/scratch/oe/deploy/$libc/images/qemu$arch/console-image-qemush4.ext2"
91 #hdimage="/home/kraj/qemu/sh/sh-test-0.2/sh-linux-mini.img"
95 macaddr="00:16:3e:00:00:05"
98 consoleopt="console=ttyS0"
102 kernel="/scratch/oe/deploy/$libc/images/qemu$arch/bzImage-qemux86.bin"
103 hdimage="/scratch/oe/deploy/$libc/images/qemu$arch/native-sdk-image-qemux86.ext2"
104 hdimage="/scratch/oe/deploy/$libc/images/qemu$arch/minimalist-image-qemux86.ext2"
105 hdimage="/scratch/oe/deploy/$libc/images/qemu$arch/console-image-qemux86.ext2"
108 echo "Specify one architectures out of $supported_archs to emulate."
113 nfsserver="10.0.1.37" # address of NFS server
114 gateway="10.0.0.1" # default gateway
115 netmask="255.255.0.0" # subnet mask
116 hostname="qemu$arch" # hostname for guest server
117 nfsdir="/opt/oe/$hostname" # nfs directory where root file system is
118 device="eth0" # interface that guest server will use
119 mem=256 # memory for guest server in Mb
120 gdbit="-gdb tcp::$gdbport" # debug the kernel using gdb set it to -s
121 # add -S to stop after launch and wait for
124 nfsopts="rsize=8192,wsize=8192,hard,intr,tcp,nolock" # nfs options
127 rootfs="root=/dev/nfs rw nfsroot=$nfsserver:$nfsdir,$nfsopts"
129 # Boot from a Disk Image
131 rootfs="root=/dev/$rootdisk rw"
134 #ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
135 ipopt="ip=$address::$gateway:$netmask:$hostname:$device:off"
137 # get IP from DHCP server on network
141 qemuifup="/home/kraj/work/oe/openembedded/contrib/qemu/qemu-ifup"
142 qemuifdown="/home/kraj/work/oe/openembedded/contrib/qemu/qemu-ifdown"
145 iface=`sudo tunctl -b -u $uid`
147 netopt="-net nic,vlan=0,macaddr=$macaddr -net tap,vlan=0,ifname=$iface,script=$qemuifup,downscript=$qemuifdown"
149 if [ "x$1" == "xsingle" ]
153 echo "Starting QEMU ..."
155 #-L /scratch/oe/deploy/$libc/images/qemu$arch \
156 $qemu -M $machine --snapshot $gdbit -m $mem -kernel $kernel -hda $hdimage \
157 -usb -usbdevice wacom-tablet -nographic --no-reboot -localtime \
158 -append "$consoleopt $rootfs $ipopt $init debug user_debug=-1" \
161 #destroy the tap interface
162 sudo tunctl -b -d $iface
164 # qemu-system-sh4 -M r2d -kernel ~/zImage -nographic -monitor null -serial null -serial stdio