diff options
-rwxr-xr-x | scripts/runqemu | 34 | ||||
-rwxr-xr-x | scripts/runqemu-internal | 10 |
2 files changed, 28 insertions, 16 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 771aa3878d..ed32bc2e27 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -75,6 +75,7 @@ KVM_ENABLED="no" | |||
75 | KVM_ACTIVE="no" | 75 | KVM_ACTIVE="no" |
76 | VHOST_ENABLED="no" | 76 | VHOST_ENABLED="no" |
77 | VHOST_ACTIVE="no" | 77 | VHOST_ACTIVE="no" |
78 | IS_VM="false" | ||
78 | 79 | ||
79 | # Determine whether the file is a kernel or QEMU image, and set the | 80 | # Determine whether the file is a kernel or QEMU image, and set the |
80 | # appropriate variables | 81 | # appropriate variables |
@@ -89,7 +90,7 @@ process_filename() { | |||
89 | [ -z "$KERNEL" ] && KERNEL=$filename || \ | 90 | [ -z "$KERNEL" ] && KERNEL=$filename || \ |
90 | error "conflicting KERNEL args [$KERNEL] and [$filename]" | 91 | error "conflicting KERNEL args [$KERNEL] and [$filename]" |
91 | ;; | 92 | ;; |
92 | /ext[234]/|/jffs2/|/btrfs/|/wic/) | 93 | /ext[234]/|/jffs2/|/btrfs/) |
93 | # A file ending in a supportted fs type is a rootfs image | 94 | # A file ending in a supportted fs type is a rootfs image |
94 | if [ -z "$FSTYPE" -o "$FSTYPE" = "$EXT" ]; then | 95 | if [ -z "$FSTYPE" -o "$FSTYPE" = "$EXT" ]; then |
95 | FSTYPE=$EXT | 96 | FSTYPE=$EXT |
@@ -98,10 +99,11 @@ process_filename() { | |||
98 | error "conflicting FSTYPE types [$FSTYPE] and [$EXT]" | 99 | error "conflicting FSTYPE types [$FSTYPE] and [$EXT]" |
99 | fi | 100 | fi |
100 | ;; | 101 | ;; |
101 | /hddimg/|/hdddirect/|/vmdk/) | 102 | /hddimg/|/hdddirect/|/vmdk/|/wic/) |
102 | FSTYPE=$EXT | 103 | FSTYPE=$EXT |
103 | VM=$filename | 104 | VM=$filename |
104 | ROOTFS=$filename | 105 | ROOTFS=$filename |
106 | IS_VM="true" | ||
105 | ;; | 107 | ;; |
106 | *) | 108 | *) |
107 | error "unknown file arg [$filename]" | 109 | error "unknown file arg [$filename]" |
@@ -109,6 +111,13 @@ process_filename() { | |||
109 | esac | 111 | esac |
110 | } | 112 | } |
111 | 113 | ||
114 | check_fstype_conflicts() { | ||
115 | if [ -z "$FSTYPE" -o "$FSTYPE" = "$1" ]; then | ||
116 | FSTYPE=$1 | ||
117 | else | ||
118 | error "conflicting FSTYPE types [$FSTYPE] and [$1]" | ||
119 | fi | ||
120 | } | ||
112 | # Parse command line args without requiring specific ordering. It's a | 121 | # Parse command line args without requiring specific ordering. It's a |
113 | # bit more complex, but offers a great user experience. | 122 | # bit more complex, but offers a great user experience. |
114 | while true; do | 123 | while true; do |
@@ -119,9 +128,12 @@ while true; do | |||
119 | [ -z "$MACHINE" -o "$MACHINE" = "$arg" ] && MACHINE=$arg || \ | 128 | [ -z "$MACHINE" -o "$MACHINE" = "$arg" ] && MACHINE=$arg || \ |
120 | error "conflicting MACHINE types [$MACHINE] and [$arg]" | 129 | error "conflicting MACHINE types [$MACHINE] and [$arg]" |
121 | ;; | 130 | ;; |
122 | "ext2" | "ext3" | "ext4" | "jffs2" | "nfs" | "btrfs" | "hddimg" | "hdddirect" | "wic" | "vmdk") | 131 | "ext"[234] | "jffs2" | "nfs" | "btrfs") |
123 | [ -z "$FSTYPE" -o "$FSTYPE" = "$arg" ] && FSTYPE=$arg || \ | 132 | check_fstype_conflicts $arg |
124 | error "conflicting FSTYPE types [$FSTYPE] and [$arg]" | 133 | ;; |
134 | "hddimg" | "hdddirect" | "wic" | "vmdk") | ||
135 | check_fstype_conflicts $arg | ||
136 | IS_VM="true" | ||
125 | ;; | 137 | ;; |
126 | "ramfs") | 138 | "ramfs") |
127 | FSTYPE=cpio.gz | 139 | FSTYPE=cpio.gz |
@@ -245,7 +257,7 @@ if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then | |||
245 | fi | 257 | fi |
246 | 258 | ||
247 | if [ -z "$MACHINE" ]; then | 259 | if [ -z "$MACHINE" ]; then |
248 | if [ "x$FSTYPE" = "xvmdk" ] || [ "x$FSTYPE" = "xhddimg" ] || [ "x$FSTYPE" = "xhdddirect" ] || [ "x$FSTYPE" = "xwic" ]; then | 260 | if [ "$IS_VM" = "true" ]; then |
249 | [ "x$FSTYPE" = "xwic" ] && filename=$ROOTFS || filename=$VM | 261 | [ "x$FSTYPE" = "xwic" ] && filename=$ROOTFS || filename=$VM |
250 | MACHINE=`basename $filename | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm64\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'` | 262 | MACHINE=`basename $filename | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm64\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'` |
251 | if [ -z "$MACHINE" ]; then | 263 | if [ -z "$MACHINE" ]; then |
@@ -457,7 +469,7 @@ if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then | |||
457 | fi | 469 | fi |
458 | fi | 470 | fi |
459 | 471 | ||
460 | if [ -z "$KERNEL" -a "x$FSTYPE" != "xvmdk" -a "x$FSTYPE" != "xhddimg" -a "x$FSTYPE" != "xhdddirect" -a "x$FSTYPE" != "xwic" ]; then | 472 | if [ -z "$KERNEL" -a "$IS_VM" = "false" ]; then \ |
461 | setup_path_vars 1 | 473 | setup_path_vars 1 |
462 | eval kernel_file=\$${machine2}_DEFAULT_KERNEL | 474 | eval kernel_file=\$${machine2}_DEFAULT_KERNEL |
463 | KERNEL=$DEPLOY_DIR_IMAGE/$kernel_file | 475 | KERNEL=$DEPLOY_DIR_IMAGE/$kernel_file |
@@ -483,7 +495,7 @@ fi | |||
483 | if [ "$LAZY_ROOTFS" = "true" ]; then | 495 | if [ "$LAZY_ROOTFS" = "true" ]; then |
484 | setup_path_vars 1 | 496 | setup_path_vars 1 |
485 | echo "Assuming $ROOTFS really means $DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE" | 497 | echo "Assuming $ROOTFS really means $DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE" |
486 | if [ "$FSTYPE" = "hddimg" -o "x$FSTYPE" = "xhdddirect" ]; then | 498 | if [ "$IS_VM" = "true" ]; then |
487 | VM=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE | 499 | VM=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE |
488 | else | 500 | else |
489 | ROOTFS=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE | 501 | ROOTFS=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE |
@@ -498,7 +510,7 @@ if [ -z "$ROOTFS" ]; then | |||
498 | 510 | ||
499 | if [ -z "$ROOTFS" ]; then | 511 | if [ -z "$ROOTFS" ]; then |
500 | error "Unable to determine default rootfs for MACHINE [$MACHINE]" | 512 | error "Unable to determine default rootfs for MACHINE [$MACHINE]" |
501 | elif [ "x$FSTYPE" = "xvmdk" -o "x$FSTYPE" = "xhddimg" -o "x$FSTYPE" = "xhdddirect" ]; then | 513 | elif [ "$IS_VM" = "true" ]; then |
502 | VM=$ROOTFS | 514 | VM=$ROOTFS |
503 | fi | 515 | fi |
504 | fi | 516 | fi |
@@ -508,11 +520,11 @@ ROOTFS=`readlink -f $ROOTFS` | |||
508 | 520 | ||
509 | echo "" | 521 | echo "" |
510 | echo "Continuing with the following parameters:" | 522 | echo "Continuing with the following parameters:" |
511 | if [ "x$FSTYPE" != "xvmdk" -a "x$FSTYPE" != "xhddimg" -a "x$FSTYPE" != "xhdddirect" ]; then | 523 | if [ "$IS_VM" = "false" ]; then |
512 | echo "KERNEL: [$KERNEL]" | 524 | echo "KERNEL: [$KERNEL]" |
513 | echo "ROOTFS: [$ROOTFS]" | 525 | echo "ROOTFS: [$ROOTFS]" |
514 | else | 526 | else |
515 | echo "VMDK: [$VM]" | 527 | echo "VM: [$VM]" |
516 | fi | 528 | fi |
517 | echo "FSTYPE: [$FSTYPE]" | 529 | echo "FSTYPE: [$FSTYPE]" |
518 | 530 | ||
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal index 0c00d8f9cb..89a1e1ba27 100755 --- a/scripts/runqemu-internal +++ b/scripts/runqemu-internal | |||
@@ -300,13 +300,13 @@ case "$MACHINE" in | |||
300 | ;; | 300 | ;; |
301 | esac | 301 | esac |
302 | 302 | ||
303 | if [ ! -f "$KERNEL" -a "x$FSTYPE" != "xvmdk" -a "x$FSTYPE" != "xhddimg" -a "x$FSTYPE" != "xhdddirect" -a "x$FSTYPE" != "xwic" ]; then | 303 | if [ ! -f "$KERNEL" -a "$IS_VM" = "false" ]; then |
304 | echo "Error: Kernel image file $KERNEL doesn't exist" | 304 | echo "Error: Kernel image file $KERNEL doesn't exist" |
305 | cleanup | 305 | cleanup |
306 | return 1 | 306 | return 1 |
307 | fi | 307 | fi |
308 | 308 | ||
309 | if [ "$FSTYPE" != "nfs" -a "$FSTYPE" != "vmdk" -a "$FSTYPE" != "hddimg" -a "$FSTYPE" != "hdddirect" -a ! -f "$ROOTFS" ]; then | 309 | if [ "$FSTYPE" != "nfs" -a "$IS_VM" = "false" -a ! -f "$ROOTFS" ]; then |
310 | echo "Error: Image file $ROOTFS doesn't exist" | 310 | echo "Error: Image file $ROOTFS doesn't exist" |
311 | cleanup | 311 | cleanup |
312 | return 1 | 312 | return 1 |
@@ -428,7 +428,7 @@ if [ "$MACHINE" = "qemux86" ]; then | |||
428 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 428 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
429 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" | 429 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" |
430 | fi | 430 | fi |
431 | if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then | 431 | if [ "$IS_VM" = "true" ]; then |
432 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" | 432 | QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" |
433 | fi | 433 | fi |
434 | # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in | 434 | # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in |
@@ -464,7 +464,7 @@ if [ "$MACHINE" = "qemux86-64" ]; then | |||
464 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 464 | KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
465 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS" | 465 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS" |
466 | fi | 466 | fi |
467 | if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then | 467 | if [ "$IS_VM" = "true" ]; then |
468 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS" | 468 | QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS" |
469 | fi | 469 | fi |
470 | # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in | 470 | # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in |
@@ -721,7 +721,7 @@ fi | |||
721 | 721 | ||
722 | echo "Running $QEMU..." | 722 | echo "Running $QEMU..." |
723 | # -no-reboot is a mandatory option - see bug #100 | 723 | # -no-reboot is a mandatory option - see bug #100 |
724 | if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then | 724 | if [ "$IS_VM" = "true" ]; then |
725 | # Check root=/dev/sdX or root=/dev/vdX | 725 | # Check root=/dev/sdX or root=/dev/vdX |
726 | [ ! -e "$VM" ] && error "VM image is not found!" | 726 | [ ! -e "$VM" ] && error "VM image is not found!" |
727 | if grep -q 'root=/dev/sd' $VM; then | 727 | if grep -q 'root=/dev/sd' $VM; then |