Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | #!/bin/bash -x |
| 2 | |
| 3 | # Handle running OE images under qemu |
| 4 | # |
| 5 | # Copyright (C) 2006-2011 Linux Foundation |
| 6 | # |
| 7 | # This program is free software; you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License version 2 as |
| 9 | # published by the Free Software Foundation. |
| 10 | # |
| 11 | # This program is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU General Public License for more details. |
| 15 | # |
| 16 | # You should have received a copy of the GNU General Public License along |
| 17 | # with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | |
| 20 | # Call setting: |
| 21 | # QEMU_MEMORY (optional) - set the amount of memory in the emualted system. |
| 22 | # SERIAL_LOGFILE (optional) - log the serial port output to a file |
| 23 | # |
| 24 | # Image options: |
| 25 | # MACHINE - the machine to run |
| 26 | # FSTYPE - the image type to run |
| 27 | # KERNEL - the kernel image file to use |
| 28 | # ROOTFS - the disk image file to use |
| 29 | # |
| 30 | |
| 31 | |
| 32 | mem_size=-1 |
| 33 | |
| 34 | #Get rid of <> and get the contents of extra qemu running params |
| 35 | SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e 's/<//' -e 's/>//'` |
| 36 | #if user set qemu memory, eg: -m 256 in qemu extra params, we need to do some |
| 37 | # validation check |
| 38 | mem_set=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-m[[:space:]] *[0-9]*\)'` |
| 39 | if [ ! -z "$mem_set" ] ; then |
| 40 | #Get memory setting size from user input |
| 41 | mem_size=`echo $mem_set | sed 's/-m[[:space:]] *//'` |
| 42 | else |
| 43 | case "$MACHINE" in |
| 44 | "qemux86") |
| 45 | mem_size=256 |
| 46 | ;; |
| 47 | "qemux86-64") |
| 48 | mem_size=256 |
| 49 | ;; |
| 50 | "qemuarm") |
| 51 | mem_size=128 |
| 52 | ;; |
| 53 | "qemuarm64") |
| 54 | mem_size=512 |
| 55 | ;; |
| 56 | "qemumicroblaze") |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 57 | mem_size=256 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 58 | ;; |
| 59 | "qemumips"|"qemumips64") |
| 60 | mem_size=256 |
| 61 | ;; |
| 62 | "qemuppc") |
| 63 | mem_size=256 |
| 64 | ;; |
| 65 | "qemush4") |
| 66 | mem_size=1024 |
| 67 | ;; |
| 68 | "qemuzynq") |
| 69 | mem_size=1024 |
| 70 | ;; |
| 71 | *) |
| 72 | mem_size=64 |
| 73 | ;; |
| 74 | esac |
| 75 | |
| 76 | fi |
| 77 | |
| 78 | # QEMU_MEMORY has 'M' appended to mem_size |
| 79 | QEMU_MEMORY="$mem_size"M |
| 80 | |
| 81 | # Bug 433: qemuarm cannot use > 256 MB RAM |
| 82 | if [ "$MACHINE" = "qemuarm" ]; then |
| 83 | if [ -z "$mem_size" -o $mem_size -gt 256 ]; then |
| 84 | echo "WARNING: qemuarm does not support > 256M of RAM." |
| 85 | echo "Changing QEMU_MEMORY to default of 256M." |
| 86 | QEMU_MEMORY="256M" |
| 87 | mem_size="256" |
| 88 | SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e "s/$mem_set/-m 256/" ` |
| 89 | fi |
| 90 | fi |
| 91 | |
| 92 | # We need to specify -m <mem_size> to overcome a bug in qemu 0.14.0 |
| 93 | # https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/584480 |
| 94 | |
| 95 | if [ -z "$mem_set" ] ; then |
| 96 | SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT -m $mem_size" |
| 97 | fi |
| 98 | # This file is created when runqemu-gen-tapdevs creates a bank of tap |
| 99 | # devices, indicating that the user should not bring up new ones using |
| 100 | # sudo. |
| 101 | NOSUDO_FLAG="/etc/runqemu-nosudo" |
| 102 | |
| 103 | QEMUIFUP=`which runqemu-ifup 2> /dev/null` |
| 104 | QEMUIFDOWN=`which runqemu-ifdown 2> /dev/null` |
| 105 | if [ -z "$QEMUIFUP" -o ! -x "$QEMUIFUP" ]; then |
| 106 | echo "runqemu-ifup cannot be found or executed" |
| 107 | exit 1 |
| 108 | fi |
| 109 | if [ -z "$QEMUIFDOWN" -o ! -x "$QEMUIFDOWN" ]; then |
| 110 | echo "runqemu-ifdown cannot be found or executed" |
| 111 | exit 1 |
| 112 | fi |
| 113 | |
| 114 | NFSRUNNING="false" |
| 115 | |
| 116 | #capture original stty values |
| 117 | ORIG_STTY=$(stty -g) |
| 118 | |
| 119 | if [ "$SLIRP_ENABLED" = "yes" ]; then |
| 120 | KERNEL_NETWORK_CMD="ip=dhcp" |
| 121 | QEMU_TAP_CMD="" |
| 122 | QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet" |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 123 | QEMU_NETWORK_CMD="" |
| 124 | DROOT="/dev/vda" |
| 125 | ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio,format=raw" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 126 | else |
| 127 | acquire_lock() { |
| 128 | lockfile=$1 |
| 129 | if [ -z "$lockfile" ]; then |
| 130 | echo "Error: missing lockfile arg passed to acquire_lock()" |
| 131 | return 1 |
| 132 | fi |
| 133 | |
| 134 | touch $lockfile.lock 2>/dev/null |
| 135 | if [ $? -ne 0 ]; then |
| 136 | echo "Acquiring lockfile for $lockfile.lock failed" |
| 137 | return 1 |
| 138 | fi |
| 139 | exec 8>$lockfile.lock |
| 140 | flock -n -x 8 |
| 141 | if [ $? -ne 0 ]; then |
| 142 | exec 8>&- |
| 143 | return 1 |
| 144 | fi |
| 145 | |
| 146 | return 0 |
| 147 | } |
| 148 | |
| 149 | release_lock() { |
| 150 | lockfile=$1 |
| 151 | if [ -z "$lockfile" ]; then |
| 152 | echo "Error: missing lockfile arg passed to release_lock()" |
| 153 | return 1 |
| 154 | fi |
| 155 | |
| 156 | rm -f $lockfile.lock |
| 157 | exec 8>&- |
| 158 | } |
| 159 | |
| 160 | LOCKDIR="/tmp/qemu-tap-locks" |
| 161 | if [ ! -d "$LOCKDIR" ]; then |
| 162 | mkdir $LOCKDIR |
| 163 | chmod 777 $LOCKDIR |
| 164 | fi |
| 165 | |
| 166 | IFCONFIG=`which ip 2> /dev/null` |
| 167 | if [ -z "$IFCONFIG" ]; then |
| 168 | IFCONFIG=/sbin/ip |
| 169 | fi |
| 170 | if [ ! -x "$IFCONFIG" ]; then |
| 171 | echo "$IFCONFIG cannot be executed" |
| 172 | exit 1 |
| 173 | fi |
| 174 | |
| 175 | POSSIBLE=`$IFCONFIG link | grep 'tap' | awk '{print $2}' | sed -e 's/://' -e 's/@.*//'` |
| 176 | TAP="" |
| 177 | LOCKFILE="" |
| 178 | USE_PRECONF_TAP="no" |
| 179 | for tap in $POSSIBLE; do |
| 180 | LOCKFILE="$LOCKDIR/$tap" |
| 181 | if [ -e "$LOCKFILE.skip" ]; then |
| 182 | echo "Found $LOCKFILE.skip, skipping $tap" |
| 183 | continue |
| 184 | fi |
| 185 | echo "Acquiring lockfile for $tap..." |
| 186 | acquire_lock $LOCKFILE |
| 187 | if [ $? -eq 0 ]; then |
| 188 | TAP=$tap |
| 189 | USE_PRECONF_TAP="yes" |
| 190 | break |
| 191 | fi |
| 192 | done |
| 193 | |
| 194 | if [ "$TAP" = "" ]; then |
| 195 | if [ -e "$NOSUDO_FLAG" ]; then |
| 196 | echo "Error: There are no available tap devices to use for networking," |
| 197 | echo "and I see $NOSUDO_FLAG exists, so I am not going to try creating" |
| 198 | echo "a new one with sudo." |
| 199 | exit 1 |
| 200 | fi |
| 201 | |
| 202 | GROUPID=`id -g` |
| 203 | USERID=`id -u` |
| 204 | echo "Setting up tap interface under sudo" |
| 205 | # Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded |
| 206 | # but inactive. This looks scary but is harmless |
| 207 | tap=`sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT 2> /dev/null` |
| 208 | if [ $? -ne 0 ]; then |
| 209 | # Re-run standalone to see verbose errors |
| 210 | sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT |
| 211 | return 1 |
| 212 | fi |
| 213 | LOCKFILE="$LOCKDIR/$tap" |
| 214 | echo "Acquiring lockfile for $tap..." |
| 215 | acquire_lock $LOCKFILE |
| 216 | if [ $? -eq 0 ]; then |
| 217 | TAP=$tap |
| 218 | fi |
| 219 | else |
| 220 | echo "Using preconfigured tap device '$TAP'" |
| 221 | echo "If this is not intended, touch $LOCKFILE.skip to make runqemu skip $TAP." |
| 222 | fi |
| 223 | |
| 224 | cleanup() { |
| 225 | if [ ! -e "$NOSUDO_FLAG" -a "$USE_PRECONF_TAP" = "no" ]; then |
| 226 | # Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded |
| 227 | # but inactive. This looks scary but is harmless |
| 228 | sudo $QEMUIFDOWN $TAP $OECORE_NATIVE_SYSROOT 2> /dev/null |
| 229 | fi |
| 230 | echo "Releasing lockfile of preconfigured tap device '$TAP'" |
| 231 | release_lock $LOCKFILE |
| 232 | |
| 233 | if [ "$NFSRUNNING" = "true" ]; then |
| 234 | echo "Shutting down the userspace NFS server..." |
| 235 | echo "runqemu-export-rootfs stop $ROOTFS" |
| 236 | runqemu-export-rootfs stop $ROOTFS |
| 237 | fi |
| 238 | # If QEMU crashes or somehow tty properties are not restored |
| 239 | # after qemu exits, we need to run stty sane |
| 240 | #stty sane |
| 241 | |
| 242 | #instead of using stty sane we set the original stty values |
| 243 | stty ${ORIG_STTY} |
| 244 | |
| 245 | } |
| 246 | |
| 247 | |
| 248 | n0=$(echo $TAP | sed 's/tap//') |
| 249 | |
| 250 | case $n0 in |
| 251 | ''|*[!0-9]*) |
| 252 | echo "Error Couldn't turn $TAP into an interface number?" |
| 253 | exit 1 |
| 254 | ;; |
| 255 | esac |
| 256 | |
| 257 | n1=$(($n0 * 2 + 1)) |
| 258 | n2=$(($n1 + 1)) |
| 259 | |
| 260 | KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0" |
| 261 | QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no" |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 262 | if [ "$VHOST_ACTIVE" = "yes" ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 263 | QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD,vhost=on" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 264 | else |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 265 | QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 266 | fi |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 267 | DROOT="/dev/vda" |
| 268 | ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio,format=raw" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 269 | |
| 270 | KERNCMDLINE="mem=$QEMU_MEMORY" |
| 271 | QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet" |
| 272 | |
| 273 | NFS_INSTANCE=`echo $TAP | sed 's/tap//'` |
| 274 | export NFS_INSTANCE |
| 275 | |
| 276 | SERIALOPTS="" |
| 277 | if [ "x$SERIAL_LOGFILE" != "x" ]; then |
| 278 | SERIALOPTS="-serial file:$SERIAL_LOGFILE" |
| 279 | fi |
| 280 | fi |
| 281 | |
| 282 | case "$MACHINE" in |
| 283 | "qemuarm") ;; |
| 284 | "qemuarm64") ;; |
| 285 | "qemumicroblaze") ;; |
| 286 | "qemumips") ;; |
| 287 | "qemumipsel") ;; |
| 288 | "qemumips64") ;; |
| 289 | "qemush4") ;; |
| 290 | "qemuppc") ;; |
| 291 | "qemuarmv6") ;; |
| 292 | "qemuarmv7") ;; |
| 293 | "qemux86") ;; |
| 294 | "qemux86-64") ;; |
| 295 | "qemuzynq") ;; |
| 296 | "akita") ;; |
| 297 | "spitz") ;; |
| 298 | *) |
| 299 | echo "Error: Unsupported machine type $MACHINE" |
| 300 | return 1 |
| 301 | ;; |
| 302 | esac |
| 303 | |
| 304 | if [ ! -f "$KERNEL" -a "x$FSTYPE" != "xvmdk" -a "x$FSTYPE" != "xhddimg" -a "x$FSTYPE" != "xhdddirect" ]; then |
| 305 | echo "Error: Kernel image file $KERNEL doesn't exist" |
| 306 | cleanup |
| 307 | return 1 |
| 308 | fi |
| 309 | |
| 310 | if [ "$FSTYPE" != "nfs" -a "$FSTYPE" != "vmdk" -a "$FSTYPE" != "hddimg" -a "$FSTYPE" != "hdddirect" -a ! -f "$ROOTFS" ]; then |
| 311 | echo "Error: Image file $ROOTFS doesn't exist" |
| 312 | cleanup |
| 313 | return 1 |
| 314 | fi |
| 315 | |
| 316 | if [ "$NFS_SERVER" = "" ]; then |
| 317 | NFS_SERVER="192.168.7.1" |
| 318 | if [ "$SLIRP_ENABLED" = "yes" ]; then |
| 319 | NFS_SERVER="10.0.2.2" |
| 320 | fi |
| 321 | fi |
| 322 | |
| 323 | if [ "$FSTYPE" = "nfs" ]; then |
| 324 | NFS_DIR=`echo $ROOTFS | sed 's/^[^:]*:\(.*\)/\1/'` |
| 325 | if [ "$NFS_INSTANCE" = "" ] ; then |
| 326 | NFS_INSTANCE=0 |
| 327 | fi |
| 328 | MOUNTD_RPCPORT=$[ 21111 + $NFS_INSTANCE ] |
| 329 | NFSD_RPCPORT=$[ 11111 + $NFS_INSTANCE ] |
| 330 | NFSD_PORT=$[ 3049 + 2 * $NFS_INSTANCE ] |
| 331 | MOUNTD_PORT=$[ 3048 + 2 * $NFS_INSTANCE ] |
| 332 | UNFS_OPTS="nfsvers=3,port=$NFSD_PORT,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,mountport=$MOUNTD_PORT" |
| 333 | |
| 334 | PSEUDO_LOCALSTATEDIR=~/.runqemu-sdk/pseudo |
| 335 | export PSEUDO_LOCALSTATEDIR |
| 336 | |
| 337 | # Start the userspace NFS server |
| 338 | echo "runqemu-export-rootfs restart $ROOTFS" |
| 339 | runqemu-export-rootfs restart $ROOTFS |
| 340 | if [ $? != 0 ]; then |
| 341 | return 1 |
| 342 | fi |
| 343 | NFSRUNNING="true" |
| 344 | fi |
| 345 | |
| 346 | if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarmv7" ]; then |
| 347 | QEMU=qemu-system-arm |
| 348 | MACHINE_SUBTYPE=versatilepb |
| 349 | export QEMU_AUDIO_DRV="none" |
| 350 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" |
| 351 | # QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -force-pointer" |
| 352 | if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 353 | KERNCMDLINE="root=$DROOT rw console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off" |
| 354 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} $ROOTFS_OPTIONS -no-reboot $QEMU_UI_OPTIONS" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 355 | fi |
| 356 | if [ "$FSTYPE" = "nfs" ]; then |
| 357 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
| 358 | echo "Error: NFS mount point $ROOTFS doesn't exist" |
| 359 | cleanup |
| 360 | return 1 |
| 361 | fi |
| 362 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw console=ttyAMA0,115200 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 363 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} --no-reboot $QEMU_UI_OPTIONS" |
| 364 | fi |
| 365 | if [ "$MACHINE" = "qemuarmv6" ]; then |
| 366 | QEMUOPTIONS="$QEMUOPTIONS -cpu arm1136" |
| 367 | fi |
| 368 | if [ "$MACHINE" = "qemuarmv7" ]; then |
| 369 | QEMUOPTIONS="$QEMUOPTIONS -cpu cortex-a8" |
| 370 | fi |
| 371 | fi |
| 372 | |
| 373 | if [ "$MACHINE" = "qemuarm64" ]; then |
| 374 | QEMU=qemu-system-aarch64 |
| 375 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 376 | QEMU_NETWORK_CMD="-netdev tap,id=net0,ifname=$TAP,script=no,downscript=no -device virtio-net-device,netdev=net0 " |
| 377 | DROOT="/dev/vda" |
| 378 | ROOTFS_OPTIONS="-drive id=disk0,file=$ROOTFS,if=none,format=raw -device virtio-blk-device,drive=disk0" |
| 379 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 380 | export QEMU_AUDIO_DRV="none" |
| 381 | if [ "x$SERIALSTDIO" = "x" ] ; then |
| 382 | QEMU_UI_OPTIONS="-nographic" |
| 383 | else |
| 384 | QEMU_UI_OPTIONS="" |
| 385 | fi |
| 386 | if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 387 | KERNCMDLINE="root=$DROOT rw console=ttyAMA0,38400 mem=$QEMU_MEMORY highres=off $KERNEL_NETWORK_CMD" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 388 | # qemu-system-aarch64 only support '-machine virt -cpu cortex-a57' for now |
| 389 | QEMUOPTIONS="$QEMU_NETWORK_CMD -machine virt -cpu cortex-a57 $ROOTFS_OPTIONS $QEMU_UI_OPTIONS" |
| 390 | fi |
| 391 | if [ "$FSTYPE" = "nfs" ]; then |
| 392 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
| 393 | echo "Error: NFS mount point $ROOTFS doesn't exist" |
| 394 | cleanup |
| 395 | return 1 |
| 396 | fi |
| 397 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw console=ttyAMA0,38400 mem=$QEMU_MEMORY highres=off $KERNEL_NETWORK_CMD" |
| 398 | QEMUOPTIONS="$QEMU_NETWORK_CMD -machine virt -cpu cortex-a57 $QEMU_UI_OPTIONS" |
| 399 | fi |
| 400 | fi |
| 401 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 402 | if [ "$MACHINE" = "qemux86" ]; then |
| 403 | QEMU=qemu-system-i386 |
| 404 | if [ "$KVM_ACTIVE" = "yes" ]; then |
| 405 | CPU_SUBTYPE=kvm32 |
| 406 | else |
| 407 | CPU_SUBTYPE=qemu32 |
| 408 | fi |
| 409 | if [ ! -z "$vga_option" ]; then |
| 410 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" |
| 411 | else |
| 412 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware" |
| 413 | fi |
| 414 | if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then |
| 415 | KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" |
| 416 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $ROOTFS_OPTIONS $QEMU_UI_OPTIONS" |
| 417 | fi |
| 418 | if [ "${FSTYPE:0:4}" = "cpio" ]; then |
| 419 | KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=/dev/ram0 rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" |
| 420 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -initrd $ROOTFS $QEMU_UI_OPTIONS" |
| 421 | fi |
| 422 | |
| 423 | if [ "$FSTYPE" = "nfs" ]; then |
| 424 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
| 425 | echo "Error: NFS mount point $ROOTFS doesn't exist." |
| 426 | cleanup |
| 427 | return 1 |
| 428 | fi |
| 429 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 430 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" |
| 431 | fi |
| 432 | if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then |
| 433 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" |
| 434 | fi |
| 435 | # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in |
| 436 | # qemux86 and qemux86-64. We can use timer interrupt mode for now. |
| 437 | KERNCMDLINE="$KERNCMDLINE oprofile.timer=1" |
| 438 | fi |
| 439 | |
| 440 | if [ "$MACHINE" = "qemux86-64" ]; then |
| 441 | QEMU=qemu-system-x86_64 |
| 442 | if [ "$KVM_ACTIVE" = "yes" ]; then |
| 443 | CPU_SUBTYPE=kvm64 |
| 444 | else |
| 445 | CPU_SUBTYPE=core2duo |
| 446 | fi |
| 447 | if [ ! -z "$vga_option" ]; then |
| 448 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" |
| 449 | else |
| 450 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware" |
| 451 | fi |
| 452 | if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then |
| 453 | KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" |
| 454 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $ROOTFS_OPTIONS $QEMU_UI_OPTIONS" |
| 455 | fi |
| 456 | if [ "$FSTYPE" = "nfs" ]; then |
| 457 | if [ "x$ROOTFS" = "x" ]; then |
| 458 | ROOTFS=/srv/nfs/qemux86-64 |
| 459 | fi |
| 460 | if [ ! -d "$ROOTFS" ]; then |
| 461 | echo "Error: NFS mount point $ROOTFS doesn't exist." |
| 462 | cleanup |
| 463 | return 1 |
| 464 | fi |
| 465 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 466 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS" |
| 467 | fi |
| 468 | if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then |
| 469 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS" |
| 470 | fi |
| 471 | # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in |
| 472 | # qemux86 and qemux86-64. We can use timer interrupt mode for now. |
| 473 | KERNCMDLINE="$KERNCMDLINE oprofile.timer=1" |
| 474 | fi |
| 475 | |
| 476 | if [ "$MACHINE" = "spitz" ]; then |
| 477 | QEMU=qemu-system-arm |
| 478 | if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then |
| 479 | echo $ROOTFS |
| 480 | ROOTFS=`readlink -f $ROOTFS` |
| 481 | echo $ROOTFS |
| 482 | if [ ! -e "$ROOTFS.qemudisk" ]; then |
| 483 | echo "Adding a partition table to the ext3 image for use by QEMU, please wait..." |
| 484 | runqemu-addptable2image $ROOTFS $ROOTFS.qemudisk |
| 485 | fi |
| 486 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M spitz -hda $ROOTFS.qemudisk -portrait" |
| 487 | fi |
| 488 | fi |
| 489 | |
| 490 | if [ "$MACHINE" = "qemumips" -o "$MACHINE" = "qemumipsel" -o "$MACHINE" = "qemumips64" ]; then |
| 491 | case "$MACHINE" in |
| 492 | qemumips) QEMU=qemu-system-mips ;; |
| 493 | qemumipsel) QEMU=qemu-system-mipsel ;; |
| 494 | qemumips64) QEMU=qemu-system-mips64 ;; |
| 495 | esac |
| 496 | MACHINE_SUBTYPE=malta |
| 497 | QEMU_UI_OPTIONS="-vga cirrus $QEMU_UI_OPTIONS" |
| 498 | if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then |
| 499 | #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 500 | KERNCMDLINE="root=$DROOT rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 501 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE $ROOTFS_OPTIONS -no-reboot $QEMU_UI_OPTIONS" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 502 | fi |
| 503 | if [ "$FSTYPE" = "nfs" ]; then |
| 504 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
| 505 | echo "Error: NFS mount point $ROOTFS doesn't exist" |
| 506 | cleanup |
| 507 | return 1 |
| 508 | fi |
| 509 | KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 510 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS" |
| 511 | fi |
| 512 | fi |
| 513 | |
| 514 | if [ "$MACHINE" = "qemuppc" ]; then |
| 515 | QEMU=qemu-system-ppc |
| 516 | MACHINE_SUBTYPE=mac99 |
| 517 | CPU_SUBTYPE=G4 |
| 518 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" |
| 519 | if [ "$SLIRP_ENABLED" = "yes" ]; then |
| 520 | QEMU_NETWORK_CMD="" |
| 521 | else |
| 522 | QEMU_NETWORK_CMD="-net nic,model=pcnet $QEMU_TAP_CMD" |
| 523 | fi |
| 524 | if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 525 | KERNCMDLINE="root=$DROOT rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 526 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE $ROOTFS_OPTIONS -no-reboot $QEMU_UI_OPTIONS" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 527 | fi |
| 528 | if [ "$FSTYPE" = "nfs" ]; then |
| 529 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
| 530 | echo "Error: NFS mount point $ROOTFS doesn't exist" |
| 531 | cleanup |
| 532 | return 1 |
| 533 | fi |
| 534 | KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 535 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS" |
| 536 | fi |
| 537 | fi |
| 538 | |
| 539 | if [ "$MACHINE" = "qemush4" ]; then |
| 540 | QEMU=qemu-system-sh4 |
| 541 | MACHINE_SUBTYPE=r2d |
| 542 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" |
| 543 | if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then |
| 544 | #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 545 | KERNCMDLINE="root=/dev/hda rw console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 546 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio" |
| 547 | SERIALSTDIO="1" |
| 548 | fi |
| 549 | if [ "$FSTYPE" = "nfs" ]; then |
| 550 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |
| 551 | echo "Error: NFS mount point $ROOTFS doesn't exist" |
| 552 | cleanup |
| 553 | return 1 |
| 554 | fi |
| 555 | KERNCMDLINE="root=/dev/nfs console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 556 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio" |
| 557 | SERIALSTDIO="1" |
| 558 | fi |
| 559 | fi |
| 560 | |
| 561 | if [ "${FSTYPE:0:3}" = "ext" ]; then |
| 562 | KERNCMDLINE="$KERNCMDLINE rootfstype=$FSTYPE" |
| 563 | fi |
| 564 | |
| 565 | if [ "$MACHINE" = "akita" ]; then |
| 566 | QEMU=qemu-system-arm |
| 567 | if [ "$FSTYPE" = "jffs2" ]; then |
| 568 | ROOTFS=`readlink -f $ROOTFS` |
| 569 | if [ ! -e "$ROOTFS.qemuflash" ]; then |
| 570 | echo "Converting raw image into flash image format for use by QEMU, please wait..." |
| 571 | raw2flash.akita < $ROOTFS > $ROOTFS.qemuflash |
| 572 | fi |
| 573 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M akita -mtdblock $ROOTFS.qemuflash -portrait" |
| 574 | fi |
| 575 | fi |
| 576 | |
| 577 | if [ "$MACHINE" = "qemumicroblaze" ]; then |
| 578 | QEMU=qemu-system-microblazeel |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 579 | QEMU_SYSTEM_OPTIONS="$QEMU_NETWORK_CMD -M petalogix-ml605 -serial mon:stdio" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 580 | if [ "${FSTYPE:0:3}" = "ext" -o "${FSTYPE:0:4}" = "cpio" ]; then |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 581 | KERNCMDLINE="earlyprintk root=/dev/ram rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 582 | QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS" |
| 583 | fi |
| 584 | fi |
| 585 | |
| 586 | if [ "$MACHINE" = "qemuzynq" ]; then |
| 587 | QEMU=qemu-system-arm |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 588 | QEMU_SYSTEM_OPTIONS="$QEMU_NETWORK_CMD -M xilinx-zynq-a9 -serial null -serial mon:stdio -dtb $KERNEL-$MACHINE.dtb" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 589 | # zynq serial ports are named 'ttyPS0' and 'ttyPS1', fixup the default values |
| 590 | SCRIPT_KERNEL_OPT=$(echo "$SCRIPT_KERNEL_OPT" | sed 's/console=ttyS/console=ttyPS/g') |
| 591 | if [ "${FSTYPE:0:3}" = "ext" -o "${FSTYPE:0:4}" = "cpio" ]; then |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 592 | KERNCMDLINE="earlyprintk root=/dev/ram rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 593 | QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS" |
| 594 | fi |
| 595 | fi |
| 596 | |
| 597 | if [ "x$RAMFS" = "xtrue" ]; then |
| 598 | QEMUOPTIONS="-initrd $ROOTFS -nographic" |
| 599 | KERNCMDLINE="root=/dev/ram0 console=ttyS0 debugshell" |
| 600 | fi |
| 601 | |
| 602 | if [ "x$ISOFS" = "xtrue" ]; then |
| 603 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cdrom $ROOTFS $QEMU_UI_OPTIONS" |
| 604 | fi |
| 605 | |
| 606 | if [ "x$QEMUOPTIONS" = "x" ]; then |
| 607 | echo "Error: Unable to support this combination of options" |
| 608 | cleanup |
| 609 | return 1 |
| 610 | fi |
| 611 | |
| 612 | if [ "$TCPSERIAL_PORTNUM" != "" ]; then |
| 613 | if [ "$MACHINE" = "qemuarm64" ]; then |
| 614 | SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT -device virtio-serial-device -chardev socket,id=virtcon,port=$TCPSERIAL_PORTNUM,host=127.0.0.1 -device virtconsole,chardev=virtcon" |
| 615 | else |
| 616 | SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT -serial tcp:127.0.0.1:$TCPSERIAL_PORTNUM" |
| 617 | fi |
| 618 | fi |
| 619 | |
| 620 | PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$PATH |
| 621 | |
| 622 | QEMUBIN=`which $QEMU 2> /dev/null` |
| 623 | if [ ! -x "$QEMUBIN" ]; then |
| 624 | echo "Error: No QEMU binary '$QEMU' could be found." |
| 625 | cleanup |
| 626 | return 1 |
| 627 | fi |
| 628 | |
| 629 | NEED_GL=`ldd $QEMUBIN/$QEMU 2>&1 | grep libGLU` |
| 630 | # We can't run without a libGL.so |
| 631 | if [ "$NEED_GL" != "" ]; then |
| 632 | libgl='no' |
| 633 | |
| 634 | [ -e /usr/lib/libGL.so -a -e /usr/lib/libGLU.so ] && libgl='yes' |
| 635 | [ -e /usr/lib64/libGL.so -a -e /usr/lib64/libGLU.so ] && libgl='yes' |
| 636 | [ -e /usr/lib/*-linux-gnu/libGL.so -a -e /usr/lib/*-linux-gnu/libGLU.so ] && libgl='yes' |
| 637 | |
| 638 | if [ "$libgl" != 'yes' ]; then |
| 639 | echo "You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator. |
| 640 | Ubuntu package names are: libgl1-mesa-dev and libglu1-mesa-dev. |
| 641 | Fedora package names are: mesa-libGL-devel mesa-libGLU-devel." |
| 642 | return 1; |
| 643 | fi |
| 644 | fi |
| 645 | |
| 646 | do_quit() { |
| 647 | cleanup |
| 648 | return 1 |
| 649 | } |
| 650 | |
| 651 | trap do_quit INT TERM QUIT |
| 652 | |
| 653 | # qemu got segfault if linked with nVidia's libgl |
| 654 | GL_LD_PRELOAD=$LD_PRELOAD |
| 655 | |
| 656 | if ldd $QEMUBIN | grep -i nvidia &> /dev/null |
| 657 | then |
| 658 | cat << EOM |
| 659 | WARNING: nVidia proprietary OpenGL libraries detected. |
| 660 | nVidia's OpenGL libraries are known to have compatibility issues with qemu, |
| 661 | resulting in a segfault. Please uninstall these drivers or ensure the mesa libGL |
| 662 | libraries precede nvidia's via LD_PRELOAD(Already do it on Ubuntu 10). |
| 663 | EOM |
| 664 | |
| 665 | # Automatically use Ubuntu system's mesa libGL, other distro can add its own path |
| 666 | if grep -i ubuntu /etc/lsb-release &> /dev/null |
| 667 | then |
| 668 | # precede nvidia's driver on Ubuntu 10 |
| 669 | UBUNTU_MAIN_VERSION=`cat /etc/lsb-release |grep DISTRIB_RELEASE |cut -d= -f 2| cut -d. -f 1` |
| 670 | if [ "$UBUNTU_MAIN_VERSION" = "10" ]; |
| 671 | then |
| 672 | GL_PATH="" |
| 673 | if test -e /usr/lib/libGL.so |
| 674 | then |
| 675 | GL_PATH="/usr/lib/libGL.so" |
| 676 | elif test -e /usr/lib/x86_64-linux-gnu/libGL.so |
| 677 | then |
| 678 | GL_PATH="/usr/lib/x86_64-linux-gnu/libGL.so" |
| 679 | fi |
| 680 | |
| 681 | echo "Skip nVidia's libGL on Ubuntu 10!" |
| 682 | GL_LD_PRELOAD="$GL_PATH $LD_PRELOAD" |
| 683 | fi |
| 684 | fi |
| 685 | fi |
| 686 | |
| 687 | if [ "x$SERIALSTDIO" = "x1" ]; then |
| 688 | echo "Interrupt character is '^]'" |
| 689 | stty intr ^] |
| 690 | fi |
| 691 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 692 | |
| 693 | # Preserve the multiplexing behavior for the monitor that would be there based |
| 694 | # on whether nographic is used. |
| 695 | if echo "$QEMUOPTIONS $SERIALOPTS $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT" | grep -- "-nographic"; then |
| 696 | FIRST_SERIAL_OPT="-serial mon:stdio" |
| 697 | else |
| 698 | FIRST_SERIAL_OPT="-serial mon:vc" |
| 699 | fi |
| 700 | |
| 701 | # qemuarm64 uses virtio for any additional serial ports so the normal mechanism |
| 702 | # of using -serial will not work |
| 703 | if [ "$MACHINE" = "qemuarm64" ]; then |
| 704 | SECOND_SERIAL_OPT="$SCRIPT_QEMU_EXTRA_OPT -device virtio-serial-device -chardev null,id=virtcon -device virtconsole,chardev=virtcon" |
| 705 | else |
| 706 | SECOND_SERIAL_OPT="-serial null" |
| 707 | fi |
| 708 | |
| 709 | # We always want a ttyS1. Since qemu by default adds a serial port when |
| 710 | # nodefaults is not specified, it seems that all that would be needed is to |
| 711 | # make sure a "-serial" is there. However, it appears that when "-serial" is |
| 712 | # specified, it ignores the default serial port that is normally added. |
| 713 | # So here we make sure to add two -serial if there are none. And only one |
| 714 | # if there is one -serial already. |
| 715 | NUM_SERIAL_OPTS=`echo $QEMUOPTIONS $SERIALOPTS $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT | sed -e 's/ /\n/g' | grep --count -- -serial` |
| 716 | |
| 717 | if [ "$NUM_SERIAL_OPTS" = "0" ]; then |
| 718 | SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT $FIRST_SERIAL_OPT $SECOND_SERIAL_OPT" |
| 719 | elif [ "$NUM_SERIAL_OPTS" = "1" ]; then |
| 720 | SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT $SECOND_SERIAL_OPT" |
| 721 | fi |
| 722 | |
| 723 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 724 | echo "Running $QEMU..." |
| 725 | # -no-reboot is a mandatory option - see bug #100 |
| 726 | if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then |
| 727 | echo $QEMUBIN $VM $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT |
| 728 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN $VM $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT |
| 729 | elif [ "$FSTYPE" = "iso" ]; then |
| 730 | echo $QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT |
| 731 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT |
| 732 | else |
| 733 | echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SLIRP_CMD $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' |
| 734 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" |
| 735 | fi |
| 736 | ret=$? |
| 737 | if [ "$SLIRP_ENABLED" != "yes" ]; then |
| 738 | cleanup |
| 739 | fi |
| 740 | |
| 741 | #set the original stty values before exit |
| 742 | stty ${ORIG_STTY} |
| 743 | trap - INT TERM QUIT |
| 744 | |
| 745 | return $ret |