fixes for runqemu
cover fixes for runqemu
The following changes since commit 9d5fa6da5ae14b26a83ec1af609d4c45944bfd44:
cross-canadian/libgcc: fix aarch64's multilib SDK (2016-03-13 19:36:57 -0700)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib rbt/runqemu
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/runqemu
Robert Yang (7):
runqemu: fix ROOTFS for vmdk
runqemu: simplify the checking for vm images
runqemu: remove ISO and RAMFS from help text
runqemu: add support for qcow2 and vdi
runqemu: simplify checking for iso and ramfs
runqemu-internal: cleanup unsed code
runqemu-internal: split the code into functions
scripts/runqemu | 111 ++++++++++---------- scripts/runqemu-internal | 257 ++++++++++++++++++++-------------------------- 2 files changed, 170 insertions(+), 198 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/7 runqemu: fix ROOTFS for vmdk
* Make it can boot scsi and virtio block drive such as root=/dev/sdX and /dev/vdX.
* Drop VM from help info, id doesn't work, and the script can check whether it is a vm disk or not.
* Make it can be run by:
$ runqemu tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.vmdk or: $ runqemu qemux86-64 vmdk
[YOCTO #9170]
--- scripts/runqemu | 77 ++++++++++++++++++++++++---------------------- scripts/runqemu-internal | 28 ++++++++++++----- 2 files changed, 60 insertions(+), 45 deletions(-)
scripts/runqemu +40 -37
@@ -19,35 +19,36 @@ usage() { MYNAME=`basename $0` - echo "" - echo "Usage: you can run this script with any valid combination" - echo "of the following environment variables (in any order):" - echo " KERNEL - the kernel image file to use" - echo " ROOTFS - the rootfs image file or nfsroot directory to use" - echo " MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)" - echo " RAMFS - boot a ramfs-based image" - echo " ISO - boot an ISO image" - echo " VM - boot a virtual machine image (= a file representing a full disk with boot loader)" - echo " Simplified QEMU command-line options can be passed with:" - echo " nographic - disables video console" - echo " serial - enables a serial console on /dev/ttyS0" - echo " kvm - enables KVM when running qemux86/qemux86-64 (VT-capable CPU required)" - echo " kvm-vhost - enables KVM with vhost support when running qemux86/qemux86-64 (VT-capable CPU required)" - echo " publicvnc - enable a VNC server open to all hosts" - echo " qemuparams=\"xyz\" - specify custom parameters to QEMU" - echo " bootparams=\"xyz\" - specify custom kernel parameters during boot" - echo "" - echo "Examples:" - echo " $MYNAME qemuarm" - echo " $MYNAME qemux86-64 core-image-sato ext4" - echo " $MYNAME qemux86-64 wic-image-minimal wic" - echo " $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial" - echo " $MYNAME qemux86 ramfs" - echo " $MYNAME qemux86 iso" - echo " $MYNAME qemux86 qemuparams=\"-m 256\"" - echo " $MYNAME qemux86 bootparams=\"psplash=false\"" - echo " $MYNAME path/to/<image>-<machine>.vmdk" - echo " $MYNAME path/to/<image>-<machine>.wic" +cat <<_EOF + +Usage: you can run this script with any valid combination +of the following environment variables (in any order): + KERNEL - the kernel image file to use + ROOTFS - the rootfs image file or nfsroot directory to use + MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified) + RAMFS - boot a ramfs-based image + ISO - boot an ISO image + Simplified QEMU command-line options can be passed with: + nographic - disables video console + serial - enables a serial console on /dev/ttyS0 + kvm - enables KVM when running qemux86/qemux86-64 (VT-capable CPU required) + kvm-vhost - enables KVM with vhost support when running qemux86/qemux86-64 (VT-capable CPU required) + publicvnc - enable a VNC server open to all hosts + qemuparams="xyz" - specify custom parameters to QEMU + bootparams="xyz" - specify custom kernel parameters during boot + +Examples: + $MYNAME qemuarm + $MYNAME qemux86-64 core-image-sato ext4 + $MYNAME qemux86-64 wic-image-minimal wic + $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial + $MYNAME qemux86 ramfs + $MYNAME qemux86 iso + $MYNAME qemux86 qemuparams="-m 256" + $MYNAME qemux86 bootparams="psplash=false" + $MYNAME path/to/<image>-<machine>.vmdk + $MYNAME path/to/<image>-<machine>.wic +_EOF exit 1 }
@@ -63,7 +64,6 @@ error() { MACHINE=${MACHINE:=""} KERNEL=${KERNEL:=""} ROOTFS=${ROOTFS:=""} -VM=${VM:=""} FSTYPE=${FSTYPE:=""} LAZY_ROOTFS="" SCRIPT_QEMU_OPT=""
@@ -101,6 +101,7 @@ process_filename() { /hddimg/|/hdddirect/|/vmdk/) FSTYPE=$EXT VM=$filename + ROOTFS=$filename ;; *) error "unknown file arg [$filename]"
@@ -118,7 +119,7 @@ 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" ) + "ext2" | "ext3" | "ext4" | "jffs2" | "nfs" | "btrfs" | "hddimg" | "hdddirect" | "wic" | "vmdk") [ -z "$FSTYPE" -o "$FSTYPE" = "$arg" ] && FSTYPE=$arg || \ error "conflicting FSTYPE types [$FSTYPE] and [$arg]" ;;
@@ -127,8 +128,8 @@ while true; do RAMFS=true ;; "iso") - FSTYPE=iso - ISOFS=true + FSTYPE=iso + ISOFS=true ;; "nographic") SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic"
@@ -142,7 +143,7 @@ while true; do "tcpserial="*) TCPSERIAL_PORTNUM=${arg##tcpserial=} ;; - "biosdir="*) + "biosdir="*) CUSTOMBIOSDIR="${arg##biosdir=}" ;; "biosfilename="*)
@@ -187,7 +188,7 @@ while true; do ;; *-image*) [ -z "$ROOTFS" ] || \ - error "conflicting ROOTFS args [$ROOTFS] and [$arg]" + error "conflicting ROOTFS args [$ROOTFS] and [$arg]" if [ -f "$arg" ]; then process_filename $arg elif [ -d "$arg" ]; then
@@ -237,7 +238,7 @@ fi # Report errors for missing combinations of options if [ -z "$MACHINE" -a -z "$KERNEL" -a -z "$VM" -a "$FSTYPE" != "wic" ]; then - error "you must specify at least a MACHINE, VM, or KERNEL argument" + error "you must specify at least a MACHINE or KERNEL argument" fi if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then error "NFS booting without an explicit ROOTFS path is not yet supported"
@@ -489,7 +490,7 @@ if [ "$LAZY_ROOTFS" = "true" ]; then fi fi -if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" -a "x$FSTYPE" != "xhddimg" -a "x$FSTYPE" != "xhdddirect" ]; then +if [ -z "$ROOTFS" ]; then setup_path_vars 1 T=$DEPLOY_DIR_IMAGE eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS
@@ -497,6 +498,8 @@ if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" -a "x$FSTYPE" != "xhddimg" -a "x$FSTY 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 + VM=$ROOTFS fi fi # ROOTFS is now set for all cases, now expand it to be an absolute path, it should exist at this point
scripts/runqemu-internal +20 -8
@@ -28,7 +28,6 @@ # ROOTFS - the disk image file to use # - mem_size=-1 #Get rid of <> and get the contents of extra qemu running params
@@ -720,18 +719,31 @@ elif [ "$NUM_SERIAL_OPTS" = "1" ]; then SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT $SECOND_SERIAL_OPT" fi - echo "Running $QEMU..." # -no-reboot is a mandatory option - see bug #100 if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then - echo $QEMUBIN $VM $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT - LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN $VM $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT + # Check root=/dev/sdX or root=/dev/vdX + [ ! -e "$VM" ] && error "VM image is not found!" + if grep -q 'root=/dev/sd' $VM; then + echo "Using scsi drive" + VM_DRIVE="-drive if=none,id=hd,file=$VM -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd" + elif grep -q 'root=/dev/vd' $VM; then + echo "Using virtio block drive" + VM_DRIVE="-drive if=virtio,file=$VM" + else + VM_DRIVE=$VM + fi + QEMU_FIRE="$QEMUBIN $VM_DRIVE $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT" + echo $QEMU_FIRE + LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE elif [ "$FSTYPE" = "iso" -o "$FSTYPE" = "wic" ]; then - echo $QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT - LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT + QEMU_FIRE="$QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT" + echo $QEMU_FIRE + LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE else - echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SLIRP_CMD $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' - LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" + QEMU_FIRE="$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SLIRP_CMD $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT" + echo $QEMU_FIRE -append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' + LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE -append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" fi ret=$? if [ "$SLIRP_ENABLED" != "yes" ]; then
Signature · 1 line
1.7.9.5
PATCH 2/7 runqemu: simplify the checking for vm images
In reply to Robert Yang* So that we can add more image support easliy.
* I think that wic should be vm images.
--- scripts/runqemu | 34 +++++++++++++++++++++++----------- scripts/runqemu-internal | 10 +++++----- 2 files changed, 28 insertions(+), 16 deletions(-)
scripts/runqemu +23 -11
@@ -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]"
scripts/runqemu-internal +5 -5
@@ -300,13 +300,13 @@ case "$MACHINE" in ;; esac -if [ ! -f "$KERNEL" -a "x$FSTYPE" != "xvmdk" -a "x$FSTYPE" != "xhddimg" -a "x$FSTYPE" != "xhdddirect" -a "x$FSTYPE" != "xwic" ]; then +if [ ! -f "$KERNEL" -a "$IS_VM" = "false" ]; then echo "Error: Kernel image file $KERNEL doesn't exist" cleanup return 1 fi -if [ "$FSTYPE" != "nfs" -a "$FSTYPE" != "vmdk" -a "$FSTYPE" != "hddimg" -a "$FSTYPE" != "hdddirect" -a ! -f "$ROOTFS" ]; then +if [ "$FSTYPE" != "nfs" -a "$IS_VM" = "false" -a ! -f "$ROOTFS" ]; then echo "Error: Image file $ROOTFS doesn't exist" cleanup return 1
@@ -428,7 +428,7 @@ if [ "$MACHINE" = "qemux86" ]; then KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" fi - if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then + if [ "$IS_VM" = "true" ]; then QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS" fi # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in
@@ -464,7 +464,7 @@ if [ "$MACHINE" = "qemux86-64" ]; then KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS" fi - if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then + if [ "$IS_VM" = "true" ]; then QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS" fi # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in
@@ -721,7 +721,7 @@ fi echo "Running $QEMU..." # -no-reboot is a mandatory option - see bug #100 -if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then +if [ "$IS_VM" = "true" ]; then # Check root=/dev/sdX or root=/dev/vdX [ ! -e "$VM" ] && error "VM image is not found!" if grep -q 'root=/dev/sd' $VM; then
Signature · 1 line
1.7.9.5
PATCH 3/7 runqemu: remove ISO and RAMFS from help text
In reply to Robert YangThey don't work, and the script can check the type correctly.
--- scripts/runqemu | 2 -- 1 file changed, 2 deletions(-)
scripts/runqemu +0 -2
@@ -26,8 +26,6 @@ of the following environment variables (in any order): KERNEL - the kernel image file to use ROOTFS - the rootfs image file or nfsroot directory to use MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified) - RAMFS - boot a ramfs-based image - ISO - boot an ISO image Simplified QEMU command-line options can be passed with: nographic - disables video console serial - enables a serial console on /dev/ttyS0
Signature · 1 line
1.7.9.5
PATCH 4/7 runqemu: add support for qcow2 and vdi
In reply to Robert Yang[YOCTO #9168]
--- scripts/runqemu | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
scripts/runqemu +3 -4
@@ -40,8 +40,7 @@ Examples: $MYNAME qemux86-64 core-image-sato ext4 $MYNAME qemux86-64 wic-image-minimal wic $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial - $MYNAME qemux86 ramfs - $MYNAME qemux86 iso + $MYNAME qemux86 iso/hddimg/vmdk/qcow2/vdi/ramfs... $MYNAME qemux86 qemuparams="-m 256" $MYNAME qemux86 bootparams="psplash=false" $MYNAME path/to/<image>-<machine>.vmdk
@@ -97,7 +96,7 @@ process_filename() { error "conflicting FSTYPE types [$FSTYPE] and [$EXT]" fi ;; - /hddimg/|/hdddirect/|/vmdk/|/wic/) + /hddimg/|/hdddirect/|/vmdk/|/wic/|/qcow2/|/vdi/) FSTYPE=$EXT VM=$filename ROOTFS=$filename
@@ -129,7 +128,7 @@ while true; do "ext"[234] | "jffs2" | "nfs" | "btrfs") check_fstype_conflicts $arg ;; - "hddimg" | "hdddirect" | "wic" | "vmdk") + "hddimg" | "hdddirect" | "wic" | "vmdk" | "qcow2" | "vdi") check_fstype_conflicts $arg IS_VM="true" ;;
Signature · 1 line
1.7.9.5
PATCH 5/7 runqemu: simplify checking for iso and ramfs
In reply to Robert Yang--- scripts/runqemu | 7 +------ scripts/runqemu-internal | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-)
scripts/runqemu +1 -6
@@ -125,7 +125,7 @@ while true; do [ -z "$MACHINE" -o "$MACHINE" = "$arg" ] && MACHINE=$arg || \ error "conflicting MACHINE types [$MACHINE] and [$arg]" ;; - "ext"[234] | "jffs2" | "nfs" | "btrfs") + "ext"[234] | "jffs2" | "nfs" | "btrfs" | "iso") check_fstype_conflicts $arg ;; "hddimg" | "hdddirect" | "wic" | "vmdk" | "qcow2" | "vdi")
@@ -134,12 +134,7 @@ while true; do ;; "ramfs") FSTYPE=cpio.gz - RAMFS=true ;; - "iso") - FSTYPE=iso - ISOFS=true - ;; "nographic") SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic" SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
scripts/runqemu-internal +2 -2
@@ -593,12 +593,12 @@ if [ "$MACHINE" = "qemuzynq" ]; then fi fi -if [ "x$RAMFS" = "xtrue" ]; then +if [ "$FSTYPE" = "cpio.gz" ]; then QEMUOPTIONS="-initrd $ROOTFS -nographic" KERNCMDLINE="root=/dev/ram0 console=ttyS0 debugshell" fi -if [ "x$ISOFS" = "xtrue" ]; then +if [ "$FSTYPE" = "iso" ]; then QEMUOPTIONS="$QEMU_NETWORK_CMD -cdrom $ROOTFS $QEMU_UI_OPTIONS" fi
Signature · 1 line
1.7.9.5
PATCH 6/7 runqemu-internal: cleanup unsed code
In reply to Robert Yang* remove akita and spitz related code
They are not supported by runqemu anymore:
$ runqemu spitz Error: unable to classify arg [spitz] So remove related code.
* Remove checking of 256M for qemuarm, qemu can check it, for example:
$ runqemu qemuarm qemuparams="-m 1024" [snip] qemu: Too much memory for this machine: 1024 MB, maximum 256 MB [snip]
--- scripts/runqemu | 6 ------ scripts/runqemu-internal | 41 +---------------------------------------- 2 files changed, 1 insertion(+), 46 deletions(-)
scripts/runqemu +0 -6
@@ -350,12 +350,6 @@ QEMUMICROBLAZE_DEFAULT_FSTYPE=cpio QEMUZYNQ_DEFAULT_KERNEL=uImage QEMUZYNQ_DEFAULT_FSTYPE=cpio -AKITA_DEFAULT_KERNEL=zImage-akita.bin -AKITA_DEFAULT_FSTYPE=jffs2 - -SPITZ_DEFAULT_KERNEL=zImage-spitz.bin -SPITZ_DEFAULT_FSTYPE=ext3 - setup_path_vars() { if [ -z "$OE_TMPDIR" ] ; then PATHS_REQUIRED=true
scripts/runqemu-internal +1 -40
70 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 7/7 runqemu-internal: split the code into functions
In reply to Robert YangUse config_<machine> to split the code into separate functions, so that different machines won't affect each other, and they will have a better structure.
--- scripts/runqemu-internal | 180 +++++++++++++++++++++++----------------------- 1 file changed, 89 insertions(+), 91 deletions(-)
scripts/runqemu-internal +89 -91
@@ -38,49 +38,6 @@ mem_set=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-m[[:space:]] *[0-9]*\)'` if [ ! -z "$mem_set" ] ; then #Get memory setting size from user input mem_size=`echo $mem_set | sed 's/-m[[:space:]] *//'` -else - case "$MACHINE" in - "qemux86") - mem_size=256 - ;; - "qemux86-64") - mem_size=256 - ;; - "qemuarm") - mem_size=128 - ;; - "qemuarm64") - mem_size=512 - ;; - "qemumicroblaze") - mem_size=256 - ;; - "qemumips"|"qemumips64") - mem_size=256 - ;; - "qemuppc") - mem_size=256 - ;; - "qemush4") - mem_size=1024 - ;; - "qemuzynq") - mem_size=1024 - ;; - *) - mem_size=64 - ;; - esac - -fi - -# QEMU_MEMORY has 'M' appended to mem_size -QEMU_MEMORY="$mem_size"M - -# We need to specify -m <mem_size> to overcome a bug in qemu 0.14.0 -# https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/584480 -if [ -z "$mem_set" ] ; then - SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT -m $mem_size" fi # This file is created when runqemu-gen-tapdevs creates a bank of tap
@@ -267,26 +224,6 @@ else fi fi -case "$MACHINE" in - "qemuarm") ;; - "qemuarm64") ;; - "qemumicroblaze") ;; - "qemumips") ;; - "qemumipsel") ;; - "qemumips64") ;; - "qemush4") ;; - "qemuppc") ;; - "qemuarmv6") ;; - "qemuarmv7") ;; - "qemux86") ;; - "qemux86-64") ;; - "qemuzynq") ;; - *) - echo "Error: Unsupported machine type $MACHINE" - return 1 - ;; -esac - if [ ! -f "$KERNEL" -a "$IS_VM" = "false" ]; then echo "Error: Kernel image file $KERNEL doesn't exist" cleanup
@@ -329,12 +266,25 @@ if [ "$FSTYPE" = "nfs" ]; then NFSRUNNING="true" fi -if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarmv7" ]; then + +set_mem_size() { + if [ ! -z "$mem_set" ] ; then + #Get memory setting size from user input + mem_size=`echo $mem_set | sed 's/-m[[:space:]] *//'` + else + mem_size=$1 + fi + # QEMU_MEMORY has 'M' appended to mem_size + QEMU_MEMORY="$mem_size"M + +} + +config_qemuarm() { + set_mem_size 128 QEMU=qemu-system-arm MACHINE_SUBTYPE=versatilepb export QEMU_AUDIO_DRV="none" QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" - # QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -force-pointer" if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then KERNCMDLINE="root=$DROOT rw console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off" QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} $ROOTFS_OPTIONS -no-reboot $QEMU_UI_OPTIONS"
@@ -354,9 +304,10 @@ if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarm if [ "$MACHINE" = "qemuarmv7" ]; then QEMUOPTIONS="$QEMUOPTIONS -cpu cortex-a8" fi -fi +} -if [ "$MACHINE" = "qemuarm64" ]; then +config_qemuarm64() { + set_mem_size 512 QEMU=qemu-system-aarch64 QEMU_NETWORK_CMD="-netdev tap,id=net0,ifname=$TAP,script=no,downscript=no -device virtio-net-device,netdev=net0 "
@@ -383,9 +334,10 @@ if [ "$MACHINE" = "qemuarm64" ]; then KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw console=ttyAMA0,38400 mem=$QEMU_MEMORY highres=off $KERNEL_NETWORK_CMD" QEMUOPTIONS="$QEMU_NETWORK_CMD -machine virt -cpu cortex-a57 $QEMU_UI_OPTIONS" fi -fi +} -if [ "$MACHINE" = "qemux86" ]; then +config_qemux86() { + set_mem_size 256 QEMU=qemu-system-i386 if [ "$KVM_ACTIVE" = "yes" ]; then CPU_SUBTYPE=kvm32
@@ -421,9 +373,10 @@ if [ "$MACHINE" = "qemux86" ]; then # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in # qemux86 and qemux86-64. We can use timer interrupt mode for now. KERNCMDLINE="$KERNCMDLINE oprofile.timer=1" -fi +} -if [ "$MACHINE" = "qemux86-64" ]; then +config_qemux86_64() { + set_mem_size 256 QEMU=qemu-system-x86_64 if [ "$KVM_ACTIVE" = "yes" ]; then CPU_SUBTYPE=kvm64
@@ -457,9 +410,10 @@ if [ "$MACHINE" = "qemux86-64" ]; then # Currently oprofile's event based interrupt mode doesn't work(Bug #828) in # qemux86 and qemux86-64. We can use timer interrupt mode for now. KERNCMDLINE="$KERNCMDLINE oprofile.timer=1" -fi +} -if [ "$MACHINE" = "qemumips" -o "$MACHINE" = "qemumipsel" -o "$MACHINE" = "qemumips64" ]; then +config_qemumips() { + set_mem_size 256 case "$MACHINE" in qemumips) QEMU=qemu-system-mips ;; qemumipsel) QEMU=qemu-system-mipsel ;;
@@ -481,9 +435,10 @@ if [ "$MACHINE" = "qemumips" -o "$MACHINE" = "qemumipsel" -o "$MACHINE" = "qemum KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS" fi -fi +} -if [ "$MACHINE" = "qemuppc" ]; then +config_qemuppc() { + set_mem_size 256 QEMU=qemu-system-ppc MACHINE_SUBTYPE=mac99 CPU_SUBTYPE=G4
@@ -506,9 +461,10 @@ if [ "$MACHINE" = "qemuppc" ]; then KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS" fi -fi +} -if [ "$MACHINE" = "qemush4" ]; then +config_qemush4() { + set_mem_size 1024 QEMU=qemu-system-sh4 MACHINE_SUBTYPE=r2d QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
@@ -528,30 +484,72 @@ if [ "$MACHINE" = "qemush4" ]; then QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio" SERIALSTDIO="1" fi -fi - -if [ "${FSTYPE:0:3}" = "ext" ]; then - KERNCMDLINE="$KERNCMDLINE rootfstype=$FSTYPE" -fi +} -if [ "$MACHINE" = "qemumicroblaze" ]; then - QEMU=qemu-system-microblazeel - QEMU_SYSTEM_OPTIONS="$QEMU_NETWORK_CMD -M petalogix-ml605 -serial mon:stdio" +config_qemuzynq() { + set_mem_size 1024 + QEMU=qemu-system-arm + QEMU_SYSTEM_OPTIONS="$QEMU_NETWORK_CMD -M xilinx-zynq-a9 -serial null -serial mon:stdio -dtb $KERNEL-$MACHINE.dtb" + # zynq serial ports are named 'ttyPS0' and 'ttyPS1', fixup the default values + SCRIPT_KERNEL_OPT=$(echo "$SCRIPT_KERNEL_OPT" | sed 's/console=ttyS/console=ttyPS/g') if [ "${FSTYPE:0:3}" = "ext" -o "${FSTYPE:0:4}" = "cpio" ]; then KERNCMDLINE="earlyprintk root=/dev/ram rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS" fi -fi +} -if [ "$MACHINE" = "qemuzynq" ]; then - QEMU=qemu-system-arm - QEMU_SYSTEM_OPTIONS="$QEMU_NETWORK_CMD -M xilinx-zynq-a9 -serial null -serial mon:stdio -dtb $KERNEL-$MACHINE.dtb" - # zynq serial ports are named 'ttyPS0' and 'ttyPS1', fixup the default values - SCRIPT_KERNEL_OPT=$(echo "$SCRIPT_KERNEL_OPT" | sed 's/console=ttyS/console=ttyPS/g') +config_qemumicroblaze() { + set_mem_size 256 + QEMU=qemu-system-microblazeel + QEMU_SYSTEM_OPTIONS="$QEMU_NETWORK_CMD -M petalogix-ml605 -serial mon:stdio" if [ "${FSTYPE:0:3}" = "ext" -o "${FSTYPE:0:4}" = "cpio" ]; then KERNCMDLINE="earlyprintk root=/dev/ram rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS" fi +} + +case "$MACHINE" in + "qemuarm" | "qemuarmv6" | "qemuarmv7") + config_qemuarm + ;; + "qemuarm64") + config_qemuarm64 + ;; + "qemux86") + config_qemux86 + ;; + "qemux86-64") + config_qemux86_64 + ;; + "qemumips" | "qemumipsel" | "qemumips64") + config_qemumips + ;; + "qemuppc") + config_qemuppc + ;; + "qemush4") + config_qemush4 + ;; + "qemuzynq") + config_qemuzynq + ;; + "qemumicroblaze") + config_qemumicroblaze + ;; + *) + echo "Error: Unsupported machine type $MACHINE" + return 1 + ;; +esac + +# We need to specify -m <mem_size> to overcome a bug in qemu 0.14.0 +# https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/584480 +if [ -z "$mem_set" ] ; then + SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT -m $mem_size" +fi + +if [ "${FSTYPE:0:3}" = "ext" ]; then + KERNCMDLINE="$KERNCMDLINE rootfstype=$FSTYPE" fi if [ "$FSTYPE" = "cpio.gz" ]; then
Signature · 1 line
1.7.9.5
Quoted 12 lines · Robert Yang
The following changes since commit
9d5fa6da5ae14b26a83ec1af609d4c45944bfd44:cross-canadian/libgcc: fix aarch64's multilib SDK (2016-03-13
19:36:57 -0700)are available in the git repository at:
git://git.openembedded.org/openembedded-core-contribrbt/runqemu
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log
/?h=rbt/runqemu
Quoted 8 lines
Robert Yang (7):
runqemu: fix ROOTFS for vmdk
runqemu: simplify the checking for vm images
runqemu: remove ISO and RAMFS from help text
runqemu: add support for qcow2 and vdi
runqemu: simplify checking for iso and ramfs
runqemu-internal: cleanup unsed code
runqemu-internal: split the code into functions
I have a feeling one of these causes:
https://autobuilder.yoctoproject.org/main/builders/nightly-oe-selftest/
builds/426/steps/Running%20oe-selftest/logs/stdio
(the test_qemu (oeqa.selftest.wic.Wic) failure)
Cheers,
Richard
Quoted 22 lines · Richard Purdie
Quoted 12 lines · Robert Yang
The following changes since commit
9d5fa6da5ae14b26a83ec1af609d4c45944bfd44:cross-canadian/libgcc: fix aarch64's multilib SDK (2016-03-1319:36:57 -0700)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contribrbt/runqemu
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log
/?h=rbt/runqemuQuoted 8 lines
Robert Yang (7):
runqemu: fix ROOTFS for vmdk
runqemu: simplify the checking for vm images
runqemu: remove ISO and RAMFS from help text
runqemu: add support for qcow2 and vdi
runqemu: simplify checking for iso and ramfs
runqemu-internal: cleanup unsed code
runqemu-internal: split the code into functions
Quoted 6 lines
I have a feeling one of these causes:
https://autobuilder.yoctoproject.org/main/builders/nightly-oe-selftest/
builds/426/steps/Running%20oe-selftest/logs/stdio(the
test_qemu(oeqa.selftest.wic.Wic) failure)
Sorry, I will fix it.
// Robert
Quoted 5 lines
Cheers,
Richard
V2 Re: [PATCH 0/7] fixes for runqemu
Quoted 25 lines · Robert Yang
Quoted 22 lines · Richard Purdie
Quoted 20 lines · Robert Yang
The following changes since commit
9d5fa6da5ae14b26a83ec1af609d4c45944bfd44:cross-canadian/libgcc: fix aarch64's multilib SDK (2016-03-1319:36:57 -0700)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contribrbt/runqemu
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log
/?h=rbt/runqemuRobert Yang (7):
runqemu: fix ROOTFS for vmdk
runqemu: simplify the checking for vm images
runqemu: remove ISO and RAMFS from help text
runqemu: add support for qcow2 and vdi
runqemu: simplify checking for iso and ramfs
runqemu-internal: cleanup unsed code
runqemu-internal: split the code into functions
Quoted 8 lines
Quoted 6 lines
I have a feeling one of these causes:
https://autobuilder.yoctoproject.org/main/builders/nightly-oe-selftest/
builds/426/steps/Running%20oe-selftest/logs/stdio(the
test_qemu(oeqa.selftest.wic.Wic) failure)Sorry, I will fix it.
I updated the patches in the repo, now:
$ oe-selftest -r wic.Wic.test_qemu and $ oe-selftest -r wic.Wic.test_qemux86_directdisk
Work well.
* Changes of V2:
- Update "runqemu: fix ROOTFS for vmdk", check for ide/scsi drive, if not found, then use virtio block drive.
git://git.openembedded.org/openembedded-core-contrib rbt/runqemu
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/rpm
Robert Yang (7):
runqemu: fix ROOTFS for vmdk
runqemu: simplify the checking for vm images
runqemu: remove ISO and RAMFS from help text
runqemu: add support for qcow2 and vdi
runqemu: simplify checking for iso and ramfs
runqemu-internal: cleanup unsed code
runqemu-internal: split the code into functions
// Robert
Quoted 8 lines
// Robert
Quoted 5 lines
Cheers,
Richard