]> xenbits.xensource.com Git - people/liuw/rumprun.git/commitdiff
improve run_qemu to support -i and some of -b
authorAntti Kantee <pooka@iki.fi>
Fri, 10 Apr 2015 14:36:53 +0000 (14:36 +0000)
committerAntti Kantee <pooka@iki.fi>
Fri, 10 Apr 2015 14:37:11 +0000 (14:37 +0000)
app-tools/rumprun

index f20c2e1febbfef61c35ae7ba373c3e33013b9dbc..91c27de9ca867e56eee909d5a406e2289fa1ddd3 100755 (executable)
@@ -301,10 +301,34 @@ EOM
 run_qemu()
 {
 
+       opt_interactive=
+       opt_drivespec=
        while getopts "${myoptstr}" opt; do
-               err qemu target does not support options yet
+               case "$opt" in
+               b)
+                       image=$( ( IFS=, ; set -- $OPTARG ; \
+                           [ $# -gt 1 ] && die -b mountpoints not supported ; \
+                           echo $1) )
+                       opt_drivespec="-drive if=virtio,file=${image}"
+                       ;;
+               i)
+                       opt_interactive=1
+                       ;;
+               *)
+                       err qemu stack like zathras: not so good
+                       ;;
+               esac
        done
-       qemu-system-i386 -net none -kernel $1
+       shift $((${OPTIND}-1))
+
+       qemucmd="qemu-system-i386 -net none -no-kvm ${opt_drivespec} -kernel $1"
+       if [ -n "$opt_interactive" ]; then
+               ${qemucmd}
+       else
+               qemucmd="${qemucmd} -display none"
+               ${qemucmd} 1>/dev/null 2>&1 &
+               echo $!
+       fi
 }
 
 if [ $# -lt 2 ]; then