diff options
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-x | scripts/runqemu | 34 |
1 files changed, 23 insertions, 11 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 | ||