diff options
| -rwxr-xr-x | scripts/runqemu | 39 | ||||
| -rwxr-xr-x | scripts/runqemu-internal | 20 |
2 files changed, 45 insertions, 14 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index fb7ac56398..190e3b41de 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
| @@ -27,6 +27,7 @@ usage() { | |||
| 27 | echo " ROOTFS - the rootfs image file or nfsroot directory to use" | 27 | echo " ROOTFS - the rootfs image file or nfsroot directory to use" |
| 28 | echo " MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)" | 28 | echo " MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)" |
| 29 | echo " RAMFS - boot a ramfs-based image" | 29 | echo " RAMFS - boot a ramfs-based image" |
| 30 | echo " VM - boot a vmdk image" | ||
| 30 | echo " Simplified QEMU command-line options can be passed with:" | 31 | echo " Simplified QEMU command-line options can be passed with:" |
| 31 | echo " nographic - disables video console" | 32 | echo " nographic - disables video console" |
| 32 | echo " serial - enables a serial console on /dev/ttyS0" | 33 | echo " serial - enables a serial console on /dev/ttyS0" |
| @@ -41,6 +42,7 @@ usage() { | |||
| 41 | echo " $MYNAME qemux86 ramfs" | 42 | echo " $MYNAME qemux86 ramfs" |
| 42 | echo " $MYNAME qemux86 qemuparams=\"-m 256\"" | 43 | echo " $MYNAME qemux86 qemuparams=\"-m 256\"" |
| 43 | echo " $MYNAME qemux86 bootparams=\"psplash=false\"" | 44 | echo " $MYNAME qemux86 bootparams=\"psplash=false\"" |
| 45 | echo " $MYNAME path/to/<image>-<machine>.vmdk" | ||
| 44 | exit 1 | 46 | exit 1 |
| 45 | } | 47 | } |
| 46 | 48 | ||
| @@ -56,6 +58,7 @@ error() { | |||
| 56 | MACHINE=${MACHINE:=""} | 58 | MACHINE=${MACHINE:=""} |
| 57 | KERNEL=${KERNEL:=""} | 59 | KERNEL=${KERNEL:=""} |
| 58 | ROOTFS=${ROOTFS:=""} | 60 | ROOTFS=${ROOTFS:=""} |
| 61 | VM=${VM:=""} | ||
| 59 | FSTYPE="" | 62 | FSTYPE="" |
| 60 | LAZY_ROOTFS="" | 63 | LAZY_ROOTFS="" |
| 61 | SCRIPT_QEMU_OPT="" | 64 | SCRIPT_QEMU_OPT="" |
| @@ -84,6 +87,10 @@ process_filename() { | |||
| 84 | error "conflicting FSTYPE types [$FSTYPE] and [$EXT]" | 87 | error "conflicting FSTYPE types [$FSTYPE] and [$EXT]" |
| 85 | fi | 88 | fi |
| 86 | ;; | 89 | ;; |
| 90 | /vmdk/) | ||
| 91 | FSTYPE=$EXT | ||
| 92 | VM=$filename | ||
| 93 | ;; | ||
| 87 | *) | 94 | *) |
| 88 | error "unknown file arg [$filename]" | 95 | error "unknown file arg [$filename]" |
| 89 | ;; | 96 | ;; |
| @@ -192,19 +199,27 @@ elif [ ! -w /dev/net/tun ] ; then | |||
| 192 | fi | 199 | fi |
| 193 | 200 | ||
| 194 | # Report errors for missing combinations of options | 201 | # Report errors for missing combinations of options |
| 195 | if [ -z "$MACHINE" -a -z "$KERNEL" ]; then | 202 | if [ -z "$MACHINE" -a -z "$KERNEL" -a -z "$VM" ]; then |
| 196 | error "you must specify at least a MACHINE or KERNEL argument" | 203 | error "you must specify at least a MACHINE, VM, or KERNEL argument" |
| 197 | fi | 204 | fi |
| 198 | if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then | 205 | if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then |
| 199 | error "NFS booting without an explicit ROOTFS path is not yet supported" | 206 | error "NFS booting without an explicit ROOTFS path is not yet supported" |
| 200 | fi | 207 | fi |
| 201 | 208 | ||
| 202 | if [ -z "$MACHINE" ]; then | 209 | if [ -z "$MACHINE" ]; then |
| 203 | MACHINE=`basename $KERNEL | sed 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/'` | 210 | if [ "x$FSTYPE" = "xvmdk" ]; then |
| 204 | if [ -z "$MACHINE" ]; then | 211 | MACHINE=`basename $VM | sed 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/'` |
| 205 | error "Unable to set MACHINE from kernel filename [$KERNEL]" | 212 | if [ -z "$MACHINE" ]; then |
| 213 | error "Unable to set MACHINE from vmdk filename [$VM]" | ||
| 214 | fi | ||
| 215 | echo "Set MACHINE to [$MACHINE] based on vmdk [$VM]" | ||
| 216 | else | ||
| 217 | MACHINE=`basename $KERNEL | sed 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/'` | ||
| 218 | if [ -z "$MACHINE" ]; then | ||
| 219 | error "Unable to set MACHINE from kernel filename [$KERNEL]" | ||
| 220 | fi | ||
| 221 | echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]" | ||
| 206 | fi | 222 | fi |
| 207 | echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]" | ||
| 208 | fi | 223 | fi |
| 209 | 224 | ||
| 210 | YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu" | 225 | YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu" |
| @@ -366,7 +381,7 @@ if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then | |||
| 366 | fi | 381 | fi |
| 367 | fi | 382 | fi |
| 368 | 383 | ||
| 369 | if [ -z "$KERNEL" ]; then | 384 | if [ -z "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then |
| 370 | setup_tmpdir | 385 | setup_tmpdir |
| 371 | eval kernel_file=\$${machine2}_DEFAULT_KERNEL | 386 | eval kernel_file=\$${machine2}_DEFAULT_KERNEL |
| 372 | KERNEL=$OE_TMPDIR/deploy/images/$kernel_file | 387 | KERNEL=$OE_TMPDIR/deploy/images/$kernel_file |
| @@ -395,7 +410,7 @@ if [ "$LAZY_ROOTFS" = "true" ]; then | |||
| 395 | ROOTFS=$OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE | 410 | ROOTFS=$OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE |
| 396 | fi | 411 | fi |
| 397 | 412 | ||
| 398 | if [ -z "$ROOTFS" ]; then | 413 | if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" ]; then |
| 399 | setup_tmpdir | 414 | setup_tmpdir |
| 400 | T=$OE_TMPDIR/deploy/images | 415 | T=$OE_TMPDIR/deploy/images |
| 401 | eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS | 416 | eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS |
| @@ -409,8 +424,12 @@ fi | |||
| 409 | 424 | ||
| 410 | echo "" | 425 | echo "" |
| 411 | echo "Continuing with the following parameters:" | 426 | echo "Continuing with the following parameters:" |
| 412 | echo "KERNEL: [$KERNEL]" | 427 | if [ "x$FSTYPE" != "xvmdk" ]; then |
| 413 | echo "ROOTFS: [$ROOTFS]" | 428 | echo "KERNEL: [$KERNEL]" |
| 429 | echo "ROOTFS: [$ROOTFS]" | ||
| 430 | else | ||
| 431 | echo "VMDK: [$VM]" | ||
| 432 | fi | ||
| 414 | echo "FSTYPE: [$FSTYPE]" | 433 | echo "FSTYPE: [$FSTYPE]" |
| 415 | 434 | ||
| 416 | setup_sysroot | 435 | setup_sysroot |
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal index d5c00570ad..7fbe0a0976 100755 --- a/scripts/runqemu-internal +++ b/scripts/runqemu-internal | |||
| @@ -260,13 +260,13 @@ case "$MACHINE" in | |||
| 260 | ;; | 260 | ;; |
| 261 | esac | 261 | esac |
| 262 | 262 | ||
| 263 | if [ ! -f "$KERNEL" ]; then | 263 | if [ ! -f "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then |
| 264 | echo "Error: Kernel image file $KERNEL doesn't exist" | 264 | echo "Error: Kernel image file $KERNEL doesn't exist" |
| 265 | cleanup | 265 | cleanup |
| 266 | return | 266 | return |
| 267 | fi | 267 | fi |
| 268 | 268 | ||
| 269 | if [ "$FSTYPE" != "nfs" -a ! -f "$ROOTFS" ]; then | 269 | if [ "$FSTYPE" != "nfs" -a "$FSTYPE" != "vmdk" -a ! -f "$ROOTFS" ]; then |
| 270 | echo "Error: Image file $ROOTFS doesn't exist" | 270 | echo "Error: Image file $ROOTFS doesn't exist" |
| 271 | cleanup | 271 | cleanup |
| 272 | return | 272 | return |
| @@ -342,6 +342,9 @@ if [ "$MACHINE" = "qemux86" ]; then | |||
| 342 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 342 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 343 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" | 343 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" |
| 344 | fi | 344 | fi |
| 345 | if [ "$FSTYPE" = "vmdk" ]; then | ||
| 346 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" | ||
| 347 | fi | ||
| 345 | # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in | 348 | # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in |
| 346 | # qemux86 and qemux86-64. We can use timer interrupt mode for now. | 349 | # qemux86 and qemux86-64. We can use timer interrupt mode for now. |
| 347 | KERNCMDLINE="$KERNCMDLINE oprofile.timer=1" | 350 | KERNCMDLINE="$KERNCMDLINE oprofile.timer=1" |
| @@ -366,6 +369,9 @@ if [ "$MACHINE" = "qemux86-64" ]; then | |||
| 366 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 369 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 367 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" | 370 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" |
| 368 | fi | 371 | fi |
| 372 | if [ "$FSTYPE" = "vmdk" ]; then | ||
| 373 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" | ||
| 374 | fi | ||
| 369 | # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in | 375 | # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in |
| 370 | # qemux86 and qemux86-64. We can use timer interrupt mode for now. | 376 | # qemux86 and qemux86-64. We can use timer interrupt mode for now. |
| 371 | KERNCMDLINE="$KERNCMDLINE oprofile.timer=1" | 377 | KERNCMDLINE="$KERNCMDLINE oprofile.timer=1" |
| @@ -561,8 +567,14 @@ fi | |||
| 561 | 567 | ||
| 562 | echo "Running $QEMU..." | 568 | echo "Running $QEMU..." |
| 563 | # -no-reboot is a mandatory option - see bug #100 | 569 | # -no-reboot is a mandatory option - see bug #100 |
| 564 | echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' | 570 | if [ "$FSTYPE" = "vmdk" ]; then |
| 565 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" | 571 | echo $QEMUBIN $VM $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT |
| 572 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN $VM $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT | ||
| 573 | else | ||
| 574 | echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' | ||
| 575 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" | ||
| 576 | fi | ||
| 577 | |||
| 566 | 578 | ||
| 567 | 579 | ||
| 568 | cleanup | 580 | cleanup |
