summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-xscripts/runqemu447
1 files changed, 268 insertions, 179 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 27a9fc9..fe4a720 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1,5 +1,4 @@
#!/bin/bash
-
#
# Handle running OE images standalone with QEMU
#
@@ -22,24 +21,31 @@ usage() {
MYNAME=`basename $0`
echo ""
echo "Usage: you can run this script with any valid combination"
- echo "of the following options (in any order):"
+ echo "of the following environment variables (in any order):"
echo " QEMUARCH - the qemu machine architecture to use"
echo " KERNEL - the kernel image file to use"
echo " ROOTFS - the rootfs image file or nfsroot directory to use"
- echo " MACHINE=xyz - the machine name (optional, autodetected from KERNEL filename if unspecified)"
+ 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 vmdk image"
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 " 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 ext3"
+ echo " $MYNAME qemux86-64 core-image-sato ext4"
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"
exit 1
}
@@ -47,98 +53,109 @@ if [ "x$1" = "x" ]; then
usage
fi
+error() {
+ echo "Error: "$*
+ usage
+}
+
MACHINE=${MACHINE:=""}
-KERNEL=""
-FSTYPE=""
-ROOTFS=""
+KERNEL=${KERNEL:=""}
+ROOTFS=${ROOTFS:=""}
+VM=${VM:=""}
+FSTYPE=${FSTYPE:=""}
LAZY_ROOTFS=""
SCRIPT_QEMU_OPT=""
SCRIPT_QEMU_EXTRA_OPT=""
SCRIPT_KERNEL_OPT=""
-
-# Don't use TMPDIR from the external environment, it may be a distro
-# variable pointing to /tmp (e.g. within X on OpenSUSE)
-# Instead, use OE_TMPDIR for passing this in externally.
-TMPDIR="$OE_TMPDIR"
+SERIALSTDIO=""
+KVM_ENABLED="no"
+KVM_ACTIVE="no"
# Determine whether the file is a kernel or QEMU image, and set the
# appropriate variables
process_filename() {
filename=$1
+
# Extract the filename extension
EXT=`echo $filename | awk -F . '{ print \$NF }'`
- # A file ending in .bin is a kernel
- if [ "x$EXT" = "xbin" ]; then
- if [ -z "$KERNEL" ]; then
- KERNEL=$filename
- else
- echo "Error: conflicting KERNEL args [$KERNEL] and [$filename]"
- usage
- fi
- elif [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" ||
- "x$EXT" == "xjffs2" || "x$EXT" == "xbtrfs" ]]; then
- # A file ending in a supportted fs type is a rootfs image
- if [[ -z "$FSTYPE" || "$FSTYPE" == "$EXT" ]]; then
- FSTYPE=$EXT
- ROOTFS=$filename
- else
- echo "Error: conflicting FSTYPE types [$FSTYPE] and [$EXT]"
- usage
- fi
- else
- echo "Error: unknown file arg [$filename]"
- usage
- fi
+ case /$EXT/ in
+ /bin/)
+ # A file ending in .bin is a kernel
+ [ -z "$KERNEL" ] && KERNEL=$filename || \
+ error "conflicting KERNEL args [$KERNEL] and [$filename]"
+ ;;
+ /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
+ ROOTFS=$filename
+ else
+ error "conflicting FSTYPE types [$FSTYPE] and [$EXT]"
+ fi
+ ;;
+ /vmdk/)
+ FSTYPE=$EXT
+ VM=$filename
+ ;;
+ *)
+ error "unknown file arg [$filename]"
+ ;;
+ esac
}
# Parse command line args without requiring specific ordering. It's a
# bit more complex, but offers a great user experience.
-KVM_ENABLED="no"
-i=1
-while [ $i -le $# ]; do
- arg=${!i}
- case $arg in
- "qemux86" | "qemux86-64" | "qemuarm" | "qemumips" | "qemuppc" | "beagleboard" | "vexpressa9")
- if [ -z "$MACHINE" ]; then
- MACHINE=$arg
- else
- echo "Error: conflicting MACHINE types [$MACHINE] and [$arg]"
- usage
- fi
+while true; do
+ arg=${1}
+ case "$arg" in
+ "qemux86" | "qemux86-64" | "qemuarm" | "qemuarm64" | "qemumips" | "qemumipsel" | \
+ "qemumips64" | "qemush4" | "qemuppc" | "qemumicroblaze" | "qemuzynq" | \
+ "vexpressa9" )
+ [ -z "$MACHINE" ] && MACHINE=$arg || \
+ error "conflicting MACHINE types [$MACHINE] and [$arg]"
;;
- "ext2" | "ext3" | "jffs2" | "nfs" | "btrfs")
- if [[ -z "$FSTYPE" || "$FSTYPE" == "$arg" ]]; then
- FSTYPE=$arg
- else
- echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]"
- usage
- fi
+ "ext2" | "ext3" | "ext4" | "jffs2" | "nfs" | "btrfs")
+ [ -z "$FSTYPE" -o "$FSTYPE" = "$arg" ] && FSTYPE=$arg || \
+ error "conflicting FSTYPE types [$FSTYPE] and [$arg]"
;;
*-image*)
- if [ -z "$ROOTFS" ]; then
- if [ -f "$arg" ]; then
- process_filename $arg
- elif [ -d "$arg" ]; then
- # Handle the case where the nfsroot dir has -image-
- # in the pathname
- echo "Assuming $arg is an nfs rootfs"
- FSTYPE=nfs
- ROOTFS=$arg
- else
- ROOTFS=$arg
- LAZY_ROOTFS="true"
- fi
+ [ -z "$ROOTFS" ] || \
+ error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
+ if [ -f "$arg" ]; then
+ process_filename $arg
+ elif [ -d "$arg" ]; then
+ # Handle the case where the nfsroot dir has -image-
+ # in the pathname
+ echo "Assuming $arg is an nfs rootfs"
+ FSTYPE=nfs
+ ROOTFS=$arg
else
- echo "Error: conflicting ROOTFS args [$ROOTFS] and [$arg]"
- usage
+ ROOTFS=$arg
+ LAZY_ROOTFS="true"
fi
;;
+ "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"
;;
"serial")
SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio"
SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
+ SERIALSTDIO="1"
+ ;;
+ "biosdir="*)
+ CUSTOMBIOSDIR="${arg##biosdir=}"
+ ;;
+ "biosfilename="*)
+ SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -bios ${arg##biosfilename=}"
;;
"qemuparams="*)
SCRIPT_QEMU_EXTRA_OPT="${arg##qemuparams=}"
@@ -147,51 +164,55 @@ while [ $i -le $# ]; do
# to use simplified options instead
serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'`
kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'`
- if [[ ! -z "$serial_option" || ! -z "$kvm_option" ]]; then
- echo "Error: Please use simplified serial or kvm options instead"
- usage
- fi
+ vga_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-vga\)'`
+ [ ! -z "$serial_option" -o ! -z "$kvm_option" ] && \
+ echo "Please use simplified serial or kvm options instead"
;;
"bootparams="*)
SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT ${arg##bootparams=}"
;;
"audio")
- if [[ "x$MACHINE" == "xqemux86" || "x$MACHINE" == "xqemux86-64" ]]; then
- echo "Enable audio on qemu. Pls. install snd_intel8x0 or snd_ens1370 driver in linux guest.";
+ if [ "x$MACHINE" = "xqemux86" -o "x$MACHINE" = "xqemux86-64" ]; then
+ echo "Enabling audio in qemu."
+ echo "Please install snd_intel8x0 or snd_ens1370 driver in linux guest."
QEMU_AUDIO_DRV="alsa"
SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -soundhw ac97,es1370"
fi
;;
"kvm")
KVM_ENABLED="yes"
- KVM_CAPABLE=`grep 'vmx\|smx' /proc/cpuinfo`
+ KVM_CAPABLE=`grep -q 'vmx\|svm' /proc/cpuinfo && echo 1`
+ ;;
+ "slirp")
+ SLIRP_ENABLED="yes"
;;
+ "publicvnc")
+ SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -vnc 0.0.0.0:0"
+ ;;
+ "") break ;;
*)
# A directory name is an nfs rootfs
if [ -d "$arg" ]; then
echo "Assuming $arg is an nfs rootfs"
- if [[ -z "$FSTYPE" || "$FSTYPE" == "nfs" ]]; then
+ if [ -z "$FSTYPE" -o "$FSTYPE" = "nfs" ]; then
FSTYPE=nfs
else
- echo "Error: conflicting FSTYPE types [$arg] and nfs"
- usage
+ error "conflicting FSTYPE types [$arg] and nfs"
fi
if [ -z "$ROOTFS" ]; then
ROOTFS=$arg
else
- echo "Error: conflicting ROOTFS args [$ROOTFS] and [$arg]"
- usage
+ error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
fi
elif [ -f "$arg" ]; then
process_filename $arg
else
- echo "Error: unable to classify arg [$arg]"
- usage
+ error "unable to classify arg [$arg]"
fi
;;
esac
- i=$((i + 1))
+ shift
done
if [ ! -c /dev/net/tun ] ; then
@@ -202,74 +223,114 @@ elif [ ! -w /dev/net/tun ] ; then
exit 1
fi
+# Report errors for missing combinations of options
+if [ -z "$MACHINE" -a -z "$KERNEL" -a -z "$VM" ]; then
+ error "you must specify at least a MACHINE, VM, or KERNEL argument"
+fi
+if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then
+ error "NFS booting without an explicit ROOTFS path is not yet supported"
+fi
+
+if [ -z "$MACHINE" ]; then
+ if [ "x$FSTYPE" = "xvmdk" ]; then
+ MACHINE=`basename $VM | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm64\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'`
+ if [ -z "$MACHINE" ]; then
+ error "Unable to set MACHINE from vmdk filename [$VM]"
+ fi
+ echo "Set MACHINE to [$MACHINE] based on vmdk [$VM]"
+ else
+ MACHINE=`basename $KERNEL | sed -n 's/.*\(qemux86-64\|qemux86\|qemuarm64\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/p'`
+ if [ -z "$MACHINE" ]; then
+ error "Unable to set MACHINE from kernel filename [$KERNEL]"
+ fi
+ echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]"
+ fi
+fi
+
YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu"
+YOCTO_PARAVIRT_KVM_WIKI="https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM"
# Detect KVM configuration
-if [[ "x$KVM_ENABLED" == "xyes" ]]; then
- if [[ -z "$KVM_CAPABLE" ]]; then
- echo "You are tring to enable KVM on cpu without VT support. Remove kvm from the command-line, or refer";
+if [ "x$KVM_ENABLED" = "xyes" ]; then
+ if [ -z "$KVM_CAPABLE" ]; then
+ echo "You are trying to enable KVM on a cpu without VT support."
+ echo "Remove kvm from the command-line, or refer"
echo "$YOCTO_KVM_WIKI";
exit 1;
fi
- if [[ "x$MACHINE" != "xqemux86" && "x$MACHINE" != "xqemux86-64" ]]; then
+ if [ "x$MACHINE" != "xqemux86" -a "x$MACHINE" != "xqemux86-64" ]; then
echo "KVM only support x86 & x86-64. Remove kvm from the command-line";
exit 1;
fi
if [ ! -e /dev/kvm ]; then
- echo "Missing KVM device. Have you inserted kvm modules? Pls. refer";
+ echo "Missing KVM device. Have you inserted kvm modules?"
+ echo "For further help see:"
echo "$YOCTO_KVM_WIKI";
exit 1;
fi
- if 9<>/dev/kvm ; then
+ if [ ! -e /dev/vhost-net ]; then
+ echo "Missing virtio net device. Have you inserted vhost-net module?"
+ echo "For further help see:"
+ echo "$YOCTO_PARAVIRT_KVM_WIKI";
+ exit 1;
+ fi
+ if [ -w /dev/kvm -a -r /dev/kvm ]; then
SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm"
+ KVM_ACTIVE="yes"
else
- echo "You have no rights on /dev/kvm. Pls. change the owndership as described at";
+ echo "You have no rights on /dev/kvm."
+ echo "Please change the ownership of this file as described at:"
echo "$YOCTO_KVM_WIKI";
exit 1;
fi
-fi
-
-# Report errors for missing combinations of options
-if [[ -z "$MACHINE" && -z "$KERNEL" ]]; then
- echo "Error: you must specify at least a MACHINE or KERNEL argument"
- usage
-fi
-if [[ "$FSTYPE" == "nfs" && -z "$ROOTFS" ]]; then
- echo "Error: NFS booting without an explicit ROOTFS path is not yet supported"
- usage
-fi
-
-if [ -z "$MACHINE" ]; then
- MACHINE=`basename $KERNEL | sed 's/.*-\(qemux86-64\|qemux86\|qemuarm\|qemumips\|qemuppc\).*/\1/'`
- if [ -z "$MACHINE" ]; then
- echo "Error: Unable to set MACHINE from kernel filename [$KERNEL]"
- usage
+ if [ ! -w /dev/vhost-net -o ! -r /dev/vhost-net ]; then
+ if [ "$SLIRP_ENABLED" != "yes" ] ; then
+ echo "You have no rights on /dev/vhost-net."
+ echo "Please change the ownership of this file as described at:"
+ echo "$YOCTO_PARAVIRT_KVM_WIKI";
+ exit 1;
+ fi
fi
- echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]"
fi
+
machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'`
# MACHINE is now set for all cases
# Defaults used when these vars need to be inferred
QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin
-QEMUX86_DEFAULT_FSTYPE=ext3
+QEMUX86_DEFAULT_FSTYPE=ext4
QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin
-QEMUX86_64_DEFAULT_FSTYPE=ext3
+QEMUX86_64_DEFAULT_FSTYPE=ext4
QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin
-QEMUARM_DEFAULT_FSTYPE=ext3
-
-BEAGLEBOARD_DEFAULT_KERNEL=uImage-beagleboard.bin
-BEAGLEBOARD_DEFAULT_FSTYPE=tar.bz2
+QEMUARM_DEFAULT_FSTYPE=ext4
VEXPRESSA9_DEFAULT_KERNEL=zImage-vexpressa9.bin
VEXPRESSA9_DEFAULT_FSTYPE=tar.bz2
+QEMUARM64_DEFAULT_KERNEL=Image-qemuarm64.bin
+QEMUARM64_DEFAULT_FSTYPE=ext4
+
QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin
-QEMUMIPS_DEFAULT_FSTYPE=ext3
+QEMUMIPS_DEFAULT_FSTYPE=ext4
+
+QEMUMIPSEL_DEFAULT_KERNEL=vmlinux-qemumipsel.bin
+QEMUMIPSEL_DEFAULT_FSTYPE=ext4
+
+QEMUMIPS64_DEFAULT_KERNEL=vmlinux-qemumips64.bin
+QEMUMIPS64_DEFAULT_FSTYPE=ext4
-QEMUPPC_DEFAULT_KERNEL=zImage-qemuppc.bin
-QEMUPPC_DEFAULT_FSTYPE=ext3
+QEMUSH4_DEFAULT_KERNEL=vmlinux-qemumips.bin
+QEMUSH4_DEFAULT_FSTYPE=ext4
+
+QEMUPPC_DEFAULT_KERNEL=vmlinux-qemuppc.bin
+QEMUPPC_DEFAULT_FSTYPE=ext4
+
+QEMUMICROBLAZE_DEFAULT_KERNEL=linux.bin.ub
+QEMUMICROBLAZE_DEFAULT_FSTYPE=cpio
+
+QEMUZYNQ_DEFAULT_KERNEL=uImage
+QEMUZYNQ_DEFAULT_FSTYPE=cpio
AKITA_DEFAULT_KERNEL=zImage-akita.bin
AKITA_DEFAULT_FSTYPE=jffs2
@@ -277,9 +338,17 @@ AKITA_DEFAULT_FSTYPE=jffs2
SPITZ_DEFAULT_KERNEL=zImage-spitz.bin
SPITZ_DEFAULT_FSTYPE=ext3
-setup_tmpdir() {
- if [ -z "$TMPDIR" ]; then
- # Try to get TMPDIR from bitbake
+setup_path_vars() {
+ if [ -z "$OE_TMPDIR" ] ; then
+ PATHS_REQUIRED=true
+ elif [ "$1" = "1" -a -z "$DEPLOY_DIR_IMAGE" ] ; then
+ PATHS_REQUIRED=true
+ else
+ PATHS_REQUIRED=false
+ fi
+
+ if [ "$PATHS_REQUIRED" = "true" ]; then
+ # Try to get the variable values from bitbake
type -P bitbake &>/dev/null || {
echo "In order for this script to dynamically infer paths";
echo "to kernels or filesystem images, you either need";
@@ -287,13 +356,35 @@ setup_tmpdir() {
echo "before running this script" >&2;
exit 1; }
- # We have bitbake in PATH, get TMPDIR from bitbake
- TMPDIR=`bitbake -e | grep ^TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
- if [ -z "$TMPDIR" ]; then
- echo "Error: this script needs to be run from your build directory,"
- echo "or you need to explicitly set TMPDIR in your environment"
+ # We have bitbake in PATH, get the variable values from bitbake
+ BITBAKE_ENV_TMPFILE=`mktemp --tmpdir runqemu.XXXXXXXXXX`
+ if [ "$?" != "0" ] ; then
+ echo "Error: mktemp failed for bitbake environment output"
+ exit 1
+ fi
+
+ MACHINE=$MACHINE bitbake -e > $BITBAKE_ENV_TMPFILE
+ if [ -z "$OE_TMPDIR" ] ; then
+ OE_TMPDIR=`sed -n 's/^TMPDIR=\"\(.*\)\"/\1/p' $BITBAKE_ENV_TMPFILE`
+ fi
+ if [ -z "$DEPLOY_DIR_IMAGE" ] ; then
+ DEPLOY_DIR_IMAGE=`sed -n 's/^DEPLOY_DIR_IMAGE=\"\(.*\)\"/\1/p' $BITBAKE_ENV_TMPFILE`
+ fi
+ if [ -z "$OE_TMPDIR" ]; then
+ # Check for errors from bitbake that the user needs to know about
+ BITBAKE_OUTPUT=`cat $BITBAKE_ENV_TMPFILE | wc -l`
+ if [ "$BITBAKE_OUTPUT" -eq "0" ]; then
+ echo "Error: this script needs to be run from your build directory, or you need"
+ echo "to explicitly set OE_TMPDIR and DEPLOY_DIR_IMAGE in your environment"
+ else
+ echo "There was an error running bitbake to determine TMPDIR"
+ echo "Here is the output from 'bitbake -e':"
+ cat $BITBAKE_ENV_TMPFILE
+ fi
+ rm $BITBAKE_ENV_TMPFILE
exit 1
fi
+ rm $BITBAKE_ENV_TMPFILE
fi
}
@@ -303,12 +394,12 @@ setup_sysroot() {
# either in an in-tree build scenario or the environment
# script wasn't source'd.
if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
- setup_tmpdir
+ setup_path_vars
BUILD_ARCH=`uname -m`
BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
- OECORE_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS
+ OECORE_NATIVE_SYSROOT=$OE_TMPDIR/sysroots/$BUILD_SYS
fi
}
@@ -321,27 +412,22 @@ findimage() {
# Sort rootfs candidates by modification time - the most
# recently created one is the one we most likely want to boot.
- filenames=`ls -t $where/*-image*$machine.$extension 2>/dev/null | xargs`
- for name in $filenames; do
- if [[ "$name" =~ core-image-sato-sdk ||
- "$name" =~ core-image-sato ||
- "$name" =~ core-image-lsb ||
- "$name" =~ core-image-basic ||
- "$name" =~ core-image-minimal ]]; then
- ROOTFS=$name
- return
- fi
- done
+ filename=`ls -t1 $where/*-image*$machine.$extension 2>/dev/null | head -n1`
+ if [ "x$filename" != "x" ]; then
+ ROOTFS=$filename
+ return
+ fi
echo "Couldn't find a $machine rootfs image in $where."
exit 1
}
-if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then
+if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then
# Extract the filename extension
EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
- if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" ||
- "x$EXT" == "xjffs2" || "x$EXT" == "xbtrfs" ]]; then
+ if [ "x$EXT" = "xext2" -o "x$EXT" = "xext3" -o \
+ "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" -o \
+ "x$EXT" = "xext4" ]; then
FSTYPE=$EXT
else
echo "Note: Unable to determine filesystem extension for $ROOTFS"
@@ -350,14 +436,13 @@ if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then
fi
fi
-if [ -z "$KERNEL" ]; then
- setup_tmpdir
+if [ -z "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then
+ setup_path_vars 1
eval kernel_file=\$${machine2}_DEFAULT_KERNEL
- KERNEL=$TMPDIR/deploy/images/$MACHINE/$kernel_file
+ KERNEL=$DEPLOY_DIR_IMAGE/$kernel_file
if [ -z "$KERNEL" ]; then
- echo "Error: Unable to determine default kernel for MACHINE [$MACHINE]"
- usage
+ error "Unable to determine default kernel for MACHINE [$MACHINE]"
fi
fi
# KERNEL is now set for all cases
@@ -366,64 +451,68 @@ if [ -z "$FSTYPE" ]; then
eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE
if [ -z "$FSTYPE" ]; then
- echo "Error: Unable to determine default fstype for MACHINE [$MACHINE]"
- usage
+ error "Unable to determine default fstype for MACHINE [$MACHINE]"
fi
fi
-if [ "$FSTYPE" = "nfs" -a "$MACHINE" = "qemuppc" ]; then
- echo "Error: usermode NFS boot is not available for qemuppc."
- exit 1
-fi
-
# FSTYPE is now set for all cases
# Handle cases where a ROOTFS type is given instead of a filename, e.g.
# core-image-sato
if [ "$LAZY_ROOTFS" = "true" ]; then
- setup_tmpdir
- echo "Assuming $ROOTFS really means $TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE"
- IMGNAME=$TMPDIR/deploy/images/$MACHINE/$ROOTFS-$MACHINE.ext3
- ROOTFS=$TMPDIR/deploy/images/$MACHINE/$ROOTFS-$MACHINE.$FSTYPE
- MLO=$TMPDIR/deploy/images/MLO-$MACHINE
- UBOOT=$TMPDIR/deploy/images/u-boot-$MACHINE.bin
+ setup_path_vars 1
+ echo "Assuming $ROOTFS really means $DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE"
+ IMGNAME=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.ext3
+ ROOTFS=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE
fi
-if [ -z "$ROOTFS" ]; then
- setup_tmpdir
- T=$TMPDIR/deploy/images
+if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" ]; then
+ setup_path_vars 1
+ T=$DEPLOY_DIR_IMAGE
eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS
findimage $T $MACHINE $FSTYPE
if [ -z "$ROOTFS" ]; then
- echo "Error: Unable to determine default rootfs for MACHINE [$MACHINE]"
- usage
+ error "Unable to determine default rootfs for MACHINE [$MACHINE]"
fi
fi
-# ROOTFS is now set for all cases
+# ROOTFS is now set for all cases, now expand it to be an absolute path, it should exist at this point
+
+ROOTFS=`readlink -f $ROOTFS`
echo ""
echo "Continuing with the following parameters:"
-echo "KERNEL: [$KERNEL]"
-echo "ROOTFS: [$ROOTFS]"
+if [ "x$FSTYPE" != "xvmdk" ]; then
+ echo "KERNEL: [$KERNEL]"
+ echo "ROOTFS: [$ROOTFS]"
+else
+ echo "VMDK: [$VM]"
+fi
echo "FSTYPE: [$FSTYPE]"
setup_sysroot
# OECORE_NATIVE_SYSROOT is now set for all cases
-# We can't run without a libGL.so
-libgl='no'
-
-test -e /usr/lib/libGL.so -a -e /usr/lib/libGLU.so && libgl='yes'
-test -e /usr/lib64/libGL.so -a -e /usr/lib64/libGLU.so && libgl='yes'
-test -e /usr/lib/*-linux-gnu/libGL.so -a -e /usr/lib/*-linux-gnu/libGLU.so && libgl='yes'
-
-if [ "$libgl" != 'yes' ]; then
- echo "You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator.
- Ubuntu package names are: libgl1-mesa-dev and libglu1-mesa-dev."
- exit 1;
+INTERNAL_SCRIPT="$0-internal"
+if [ ! -f "$INTERNAL_SCRIPT" -o ! -r "$INTERNAL_SCRIPT" ]; then
+INTERNAL_SCRIPT=`which runqemu-internal`
fi
-INTERNAL_SCRIPT=$(dirname $0)/runqemu-internal
+# Specify directory for BIOS, VGA BIOS and keymaps
+if [ ! -z "$CUSTOMBIOSDIR" ]; then
+ if [ -d "$OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR" ]; then
+ echo "Assuming biosdir is $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
+ SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
+ else
+ if [ ! -d "$CUSTOMBIOSDIR" ]; then
+ echo "Custom BIOS directory not found. Tried: $CUSTOMBIOSDIR"
+ echo "and $OECORE_NATIVE_SYSROOT/$CUSTOMBIOSDIR"
+ exit 1;
+ fi
+ echo "Assuming biosdir is $CUSTOMBIOSDIR"
+ SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -L $CUSTOMBIOSDIR"
+ fi
+fi
. $INTERNAL_SCRIPT
+exit $?