summaryrefslogtreecommitdiff
path: root/scripts/runqemu
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2016-03-01 23:40:40 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-23 14:24:25 +0000
commit82d0014a0e1526ffa1ff7c8ea3903aeae31bada4 (patch)
treed21e4862105587123ed319051ca3acecf5391ec0 /scripts/runqemu
parent88c081b10902ec52928be78ad320c474bb918e01 (diff)
downloadopenembedded-core-82d0014a0e1526ffa1ff7c8ea3903aeae31bada4.tar.gz
openembedded-core-82d0014a0e1526ffa1ff7c8ea3903aeae31bada4.tar.bz2
openembedded-core-82d0014a0e1526ffa1ff7c8ea3903aeae31bada4.zip
runqemu: simplify the checking for vm images
* So that we can add more image support easliy. * I think that wic should be vm images. Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-xscripts/runqemu34
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"
KVM_ACTIVE="no"
VHOST_ENABLED="no"
VHOST_ACTIVE="no"
+IS_VM="false"
# Determine whether the file is a kernel or QEMU image, and set the
# appropriate variables
@@ -89,7 +90,7 @@ process_filename() {
[ -z "$KERNEL" ] && KERNEL=$filename || \
error "conflicting KERNEL args [$KERNEL] and [$filename]"
;;
- /ext[234]/|/jffs2/|/btrfs/|/wic/)
+ /ext[234]/|/jffs2/|/btrfs/)
# A file ending in a supportted fs type is a rootfs image
if [ -z "$FSTYPE" -o "$FSTYPE" = "$EXT" ]; then
FSTYPE=$EXT
@@ -98,10 +99,11 @@ process_filename() {
error "conflicting FSTYPE types [$FSTYPE] and [$EXT]"
fi
;;
- /hddimg/|/hdddirect/|/vmdk/)
+ /hddimg/|/hdddirect/|/vmdk/|/wic/)
FSTYPE=$EXT
VM=$filename
ROOTFS=$filename
+ IS_VM="true"
;;
*)
error "unknown file arg [$filename]"
@@ -109,6 +111,13 @@ process_filename() {
esac
}
+check_fstype_conflicts() {
+ if [ -z "$FSTYPE" -o "$FSTYPE" = "$1" ]; then
+ FSTYPE=$1
+ else
+ error "conflicting FSTYPE types [$FSTYPE] and [$1]"
+ fi
+}
# Parse command line args without requiring specific ordering. It's a
# bit more complex, but offers a great user experience.
while true; do
@@ -119,9 +128,12 @@ while true; do
[ -z "$MACHINE" -o "$MACHINE" = "$arg" ] && MACHINE=$arg || \
error "conflicting MACHINE types [$MACHINE] and [$arg]"
;;
- "ext2" | "ext3" | "ext4" | "jffs2" | "nfs" | "btrfs" | "hddimg" | "hdddirect" | "wic" | "vmdk")
- [ -z "$FSTYPE" -o "$FSTYPE" = "$arg" ] && FSTYPE=$arg || \
- error "conflicting FSTYPE types [$FSTYPE] and [$arg]"
+ "ext"[234] | "jffs2" | "nfs" | "btrfs")
+ check_fstype_conflicts $arg
+ ;;
+ "hddimg" | "hdddirect" | "wic" | "vmdk")
+ check_fstype_conflicts $arg
+ IS_VM="true"
;;
"ramfs")
FSTYPE=cpio.gz
@@ -245,7 +257,7 @@ if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then
fi
if [ -z "$MACHINE" ]; then
- if [ "x$FSTYPE" = "xvmdk" ] || [ "x$FSTYPE" = "xhddimg" ] || [ "x$FSTYPE" = "xhdddirect" ] || [ "x$FSTYPE" = "xwic" ]; then
+ if [ "$IS_VM" = "true" ]; then
[ "x$FSTYPE" = "xwic" ] && filename=$ROOTFS || filename=$VM
MACHINE=`basename $filename | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm64\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'`
if [ -z "$MACHINE" ]; then
@@ -457,7 +469,7 @@ if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then
fi
fi
-if [ -z "$KERNEL" -a "x$FSTYPE" != "xvmdk" -a "x$FSTYPE" != "xhddimg" -a "x$FSTYPE" != "xhdddirect" -a "x$FSTYPE" != "xwic" ]; then
+if [ -z "$KERNEL" -a "$IS_VM" = "false" ]; then \
setup_path_vars 1
eval kernel_file=\$${machine2}_DEFAULT_KERNEL
KERNEL=$DEPLOY_DIR_IMAGE/$kernel_file
@@ -483,7 +495,7 @@ fi
if [ "$LAZY_ROOTFS" = "true" ]; then
setup_path_vars 1
echo "Assuming $ROOTFS really means $DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE"
- if [ "$FSTYPE" = "hddimg" -o "x$FSTYPE" = "xhdddirect" ]; then
+ if [ "$IS_VM" = "true" ]; then
VM=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE
else
ROOTFS=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE
@@ -498,7 +510,7 @@ if [ -z "$ROOTFS" ]; then
if [ -z "$ROOTFS" ]; then
error "Unable to determine default rootfs for MACHINE [$MACHINE]"
- elif [ "x$FSTYPE" = "xvmdk" -o "x$FSTYPE" = "xhddimg" -o "x$FSTYPE" = "xhdddirect" ]; then
+ elif [ "$IS_VM" = "true" ]; then
VM=$ROOTFS
fi
fi
@@ -508,11 +520,11 @@ ROOTFS=`readlink -f $ROOTFS`
echo ""
echo "Continuing with the following parameters:"
-if [ "x$FSTYPE" != "xvmdk" -a "x$FSTYPE" != "xhddimg" -a "x$FSTYPE" != "xhdddirect" ]; then
+if [ "$IS_VM" = "false" ]; then
echo "KERNEL: [$KERNEL]"
echo "ROOTFS: [$ROOTFS]"
else
- echo "VMDK: [$VM]"
+ echo "VM: [$VM]"
fi
echo "FSTYPE: [$FSTYPE]"