aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong-iL Joh <yong-il.joh@windriver.com>2015-09-18 14:40:38 +0900
committerYong-iL Joh <yong-il.joh@windriver.com>2015-09-18 14:52:13 +0900
commitd24a9ca12f8492c2acecba9dfa6d5b1222eea686 (patch)
tree91df9f664eba887b446284f389ce670d7834f5a8
parentc5aa36a5d78a2021fce6b60c55ac12beb353b0c3 (diff)
downloadmeta-ivi-d24a9ca12f8492c2acecba9dfa6d5b1222eea686.tar.gz
meta-ivi-d24a9ca12f8492c2acecba9dfa6d5b1222eea686.tar.bz2
meta-ivi-d24a9ca12f8492c2acecba9dfa6d5b1222eea686.zip
runqemu: update to yocto fido's.
- it's for fix up the issue of "wayland does not receive handle left mouse click event" Signed-off-by: Yong-iL Joh <yong-il.joh@windriver.com>
-rw-r--r--README.md13
-rwxr-xr-xscripts/runqemu447
-rwxr-xr-xscripts/runqemu-internal761
3 files changed, 699 insertions, 522 deletions
diff --git a/README.md b/README.md
index fd59d39..8c96939 100644
--- a/README.md
+++ b/README.md
@@ -84,20 +84,11 @@ export TEMPLATECONF=/full/path/to/meta-ivi/meta-ivi/conf
> $ PATH_TO_META_IVI/meta-ivi/scripts/runqemu kronos-image vexpressa9
>
> for qemu x86:
- > $ PATH_TO_POKY/poky/scripts/runqemu kronos-image qemux86
+ > $ PATH_TO_META_IVI/meta-ivi/scripts/runqemu kronos-image qemux86
>
> for qemu x86-64:
- > $ PATH_TO_POKY/poky/scripts/runqemu kronos-image qemux86-64
+ > $ PATH_TO_META_IVI/meta-ivi/scripts/runqemu kronos-image qemux86-64
5. To login use these credentials:
> User - root
> Password - root
-
-Known Issues
-------------
-
-There are known issues at the release of K-0.2
-
-* On QEMU(IA-32) and QEMU(x86-64),
- weston cannot handling left mouse click event.
- This bug does not impact to QEMU (ARMv7)
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 $?
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index aaa0df5..c0c37d1 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -20,7 +20,6 @@
# Call setting:
# QEMU_MEMORY (optional) - set the amount of memory in the emualted system.
# SERIAL_LOGFILE (optional) - log the serial port output to a file
-# CROSSPATH - the path to any cross toolchain to use with distcc
#
# Image options:
# MACHINE - the machine to run
@@ -43,29 +42,35 @@ if [ ! -z "$mem_set" ] ; then
else
case "$MACHINE" in
"qemux86")
- mem_size=128
+ mem_size=256
;;
"qemux86-64")
- mem_size=128
+ mem_size=256
;;
"qemuarm")
mem_size=128
;;
- "qemuarmv7")
- mem_size=128
+ "qemuarm64")
+ mem_size=512
;;
- "qemumips")
- mem_size=128
+ "qemumicroblaze")
+ mem_size=64
+ ;;
+ "qemumips"|"qemumips64")
+ mem_size=256
;;
"qemuppc")
- mem_size=128
+ mem_size=256
+ ;;
+ "qemush4")
+ mem_size=1024
+ ;;
+ "qemuzynq")
+ mem_size=1024
;;
- "beagleboard")
- mem_size=256
- ;;
"vexpressa9")
- mem_size=1024
- ;;
+ mem_size=1024
+ ;;
*)
mem_size=64
;;
@@ -76,13 +81,14 @@ fi
# QEMU_MEMORY has 'M' appended to mem_size
QEMU_MEMORY="$mem_size"M
-# Bug 433: qemuarm cannot use > 128 MB RAM
-if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv7" ]; then
- if [[ -z "$mem_size" || $mem_size -gt 128 ]]; then
- echo "WARNING: qemuarm does not support > 128M of RAM."
- echo "Changing QEMU_MEMORY to default of 128M."
- QEMU_MEMORY="128M"
- SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e "s/$mem_set/-m 128/" `
+# Bug 433: qemuarm cannot use > 256 MB RAM
+if [ "$MACHINE" = "qemuarm" ]; then
+ if [ -z "$mem_size" -o $mem_size -gt 256 ]; then
+ echo "WARNING: qemuarm does not support > 256M of RAM."
+ echo "Changing QEMU_MEMORY to default of 256M."
+ QEMU_MEMORY="256M"
+ mem_size="256"
+ SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e "s/$mem_set/-m 256/" `
fi
fi
@@ -110,249 +116,230 @@ fi
NFSRUNNING="false"
-acquire_lock() {
- lockfile=$1
- if [ -z "$lockfile" ]; then
- echo "Error: missing lockfile arg passed to acquire_lock()"
- return 1
- fi
-
- if [ -e "$lockfile.lock" ]; then
- # Check that the lockfile is not stale
- ps=`ps -ewwo pid | grep $(cat $lockfile.lock)`
- if [ -z "$ps" ]; then
- echo "WARNING: Stale lock file detected, deleting $lockfile.lock."
- rm -f $lockfile.lock
- echo $$ > $lockfile.lock
- else
- return 1
- fi
+#capture original stty values
+ORIG_STTY=$(stty -g)
+
+if [ "$SLIRP_ENABLED" = "yes" ]; then
+ KERNEL_NETWORK_CMD="ip=dhcp"
+ QEMU_TAP_CMD=""
+ QEMU_UI_OPTIONS="-usb" #"-show-cursor -usb -usbdevice wacom-tablet"
+ if [ "$KVM_ACTIVE" = "yes" ]; then
+ QEMU_NETWORK_CMD=""
+ DROOT="/dev/vda"
+ ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio"
else
- echo $$ > $lockfile.lock
+ QEMU_NETWORK_CMD=""
+ DROOT="/dev/hda"
+ ROOTFS_OPTIONS="-hda $ROOTFS"
fi
- return 0
-}
-
-release_lock() {
- lockfile=$1
- if [ -z "$lockfile" ]; then
- echo "Error: missing lockfile arg passed to release_lock()"
- return 1
- fi
+else
+ acquire_lock() {
+ lockfile=$1
+ if [ -z "$lockfile" ]; then
+ echo "Error: missing lockfile arg passed to acquire_lock()"
+ return 1
+ fi
+
+ touch $lockfile.lock 2>/dev/null
+ if [ $? -ne 0 ]; then
+ echo "Acquiring lockfile for $lockfile.lock failed"
+ return 1
+ fi
+ exec 8>$lockfile.lock
+ flock -n -x 8
+ if [ $? -ne 0 ]; then
+ exec 8>&-
+ return 1
+ fi
+
+ return 0
+ }
+
+ release_lock() {
+ lockfile=$1
+ if [ -z "$lockfile" ]; then
+ echo "Error: missing lockfile arg passed to release_lock()"
+ return 1
+ fi
- rm -f $lockfile.lock
-}
+ rm -f $lockfile.lock
+ exec 8>&-
+ }
-LOCKDIR="/tmp/qemu-tap-locks"
-if [ ! -d "$LOCKDIR" ]; then
- mkdir $LOCKDIR
- chmod 777 $LOCKDIR
-fi
+ LOCKDIR="/tmp/qemu-tap-locks"
+ if [ ! -d "$LOCKDIR" ]; then
+ mkdir $LOCKDIR
+ chmod 777 $LOCKDIR
+ fi
-IFCONFIG=`which ifconfig 2> /dev/null`
-if [ -z "$IFCONFIG" ]; then
- IFCONFIG=/sbin/ifconfig
-fi
-if [ ! -x "$IFCONFIG" ]; then
- echo "$IFCONFIG cannot be executed"
- exit 1
-fi
+ IFCONFIG=`which ip 2> /dev/null`
+ if [ -z "$IFCONFIG" ]; then
+ IFCONFIG=/sbin/ip
+ fi
+ if [ ! -x "$IFCONFIG" ]; then
+ echo "$IFCONFIG cannot be executed"
+ exit 1
+ fi
-POSSIBLE=`$IFCONFIG -a | grep '^tap' | awk '{print $1}'`
-TAP=""
-LOCKFILE=""
-for tap in $POSSIBLE; do
- LOCKFILE="$LOCKDIR/$tap"
- echo "Acquiring lockfile for $tap..."
- acquire_lock $LOCKFILE
- if [ $? -eq 0 ]; then
- TAP=$tap
- break
- fi
-done
-
-if [ "$TAP" = "" ]; then
- if [ -e "$NOSUDO_FLAG" ]; then
- echo "Error: There are no available tap devices to use for networking,"
- echo "and I see $NOSUDO_FLAG exists, so I am not going to try creating"
- echo "a new one with sudo."
- exit 1
- fi
-
- GROUPID=`id -g`
- USERID=`id -u`
- echo "Setting up tap interface under sudo"
- # Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded
- # but inactive. This looks scary but is harmless
- tap=`sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT 2> /dev/null`
- if [ $? -ne 0 ]; then
- # Re-run standalone to see verbose errors
- sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT
- return
- fi
- LOCKFILE="$LOCKDIR/$tap"
- echo "Acquiring lockfile for $tap..."
- acquire_lock $LOCKFILE
- if [ $? -eq 0 ]; then
- TAP=$tap
- fi
-else
- echo "Using preconfigured tap device '$TAP'"
-fi
+ POSSIBLE=`$IFCONFIG link | grep 'tap' | awk '{print $2}' | sed s/://`
+ TAP=""
+ LOCKFILE=""
+ USE_PRECONF_TAP="no"
+ for tap in $POSSIBLE; do
+ LOCKFILE="$LOCKDIR/$tap"
+ if [ -e "$LOCKFILE.skip" ]; then
+ echo "Found $LOCKFILE.skip, skipping $tap"
+ continue
+ fi
+ echo "Acquiring lockfile for $tap..."
+ acquire_lock $LOCKFILE
+ if [ $? -eq 0 ]; then
+ TAP=$tap
+ USE_PRECONF_TAP="yes"
+ break
+ fi
+ done
+
+ if [ "$TAP" = "" ]; then
+ if [ -e "$NOSUDO_FLAG" ]; then
+ echo "Error: There are no available tap devices to use for networking,"
+ echo "and I see $NOSUDO_FLAG exists, so I am not going to try creating"
+ echo "a new one with sudo."
+ exit 1
+ fi
+
+ GROUPID=`id -g`
+ USERID=`id -u`
+ echo "Setting up tap interface under sudo"
+ # Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded
+ # but inactive. This looks scary but is harmless
+ tap=`sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT 2> /dev/null`
+ if [ $? -ne 0 ]; then
+ # Re-run standalone to see verbose errors
+ sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT
+ return 1
+ fi
+ LOCKFILE="$LOCKDIR/$tap"
+ echo "Acquiring lockfile for $tap..."
+ acquire_lock $LOCKFILE
+ if [ $? -eq 0 ]; then
+ TAP=$tap
+ fi
+ else
+ echo "Using preconfigured tap device '$TAP'"
+ echo "If this is not intended, touch $LOCKFILE.skip to make runqemu skip $TAP."
+ fi
-cleanup() {
- if [ ! -e "$NOSUDO_FLAG" ]; then
- # Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded
- # but inactive. This looks scary but is harmless
- sudo $QEMUIFDOWN $TAP $OECORE_NATIVE_SYSROOT 2> /dev/null
- fi
- echo "Releasing lockfile of preconfigured tap device '$TAP'"
- release_lock $LOCKFILE
+ cleanup() {
+ if [ ! -e "$NOSUDO_FLAG" -a "$USE_PRECONF_TAP" = "no" ]; then
+ # Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded
+ # but inactive. This looks scary but is harmless
+ sudo $QEMUIFDOWN $TAP $OECORE_NATIVE_SYSROOT 2> /dev/null
+ fi
+ echo "Releasing lockfile of preconfigured tap device '$TAP'"
+ release_lock $LOCKFILE
+
+ if [ "$NFSRUNNING" = "true" ]; then
+ echo "Shutting down the userspace NFS server..."
+ echo "runqemu-export-rootfs stop $ROOTFS"
+ runqemu-export-rootfs stop $ROOTFS
+ fi
+ # If QEMU crashes or somehow tty properties are not restored
+ # after qemu exits, we need to run stty sane
+ #stty sane
+
+ #instead of using stty sane we set the original stty values
+ stty ${ORIG_STTY}
+
+ }
+
+
+ n0=$(echo $TAP | sed 's/tap//')
+ n1=$(($n0 * 2 + 1))
+ n2=$(($n1 + 1))
+
+ KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0"
+ QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no"
+ if [ "$KVM_ACTIVE" = "yes" ]; then
+ QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD,vhost=on"
+ DROOT="/dev/vda"
+ ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio"
+ else
+ QEMU_NETWORK_CMD="-net nic,vlan=0 $QEMU_TAP_CMD"
+ DROOT="/dev/hda"
+ ROOTFS_OPTIONS="-hda $ROOTFS"
+ fi
+ if [ "$MACHINE" = "qemuarm64" ]; then
+ QEMU_NETWORK_CMD="-netdev tap,id=net0,ifname=$TAP,script=no,downscript=no -device virtio-net-device,netdev=net0 "
+ DROOT="/dev/vda"
+ ROOTFS_OPTIONS="-drive id=disk0,file=$ROOTFS -device virtio-blk-device,drive=disk0"
+ fi
- if [ "$NFSRUNNING" = "true" ]; then
- echo "Shutting down the userspace NFS server..."
- echo "runqemu-export-rootfs stop $ROOTFS"
- runqemu-export-rootfs stop $ROOTFS
- fi
- # If QEMU crashes or somehow tty properties are not restored
- # after qemu exits, we need to run stty sane
- stty sane
-}
+ KERNCMDLINE="mem=$QEMU_MEMORY"
+ QEMU_UI_OPTIONS="-usb" #"-show-cursor -usb -usbdevice wacom-tablet"
-n1=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
-n2=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
+ NFS_INSTANCE=`echo $TAP | sed 's/tap//'`
+ export NFS_INSTANCE
-KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0"
-QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no"
-QEMU_NETWORK_CMD="-net nic,vlan=0 $QEMU_TAP_CMD"
-KERNCMDLINE="mem=$QEMU_MEMORY"
-if [ $MACHINE != "qemuarmv7" ]; then
- QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet"
-else
- QEMU_UI_OPTIONS="-show-cursor -usb"
-fi
-
-NFS_INSTANCE=`echo $TAP | sed 's/tap//'`
-export NFS_INSTANCE
-
-SERIALOPTS=""
-if [ "x$SERIAL_LOGFILE" != "x" ]; then
- SERIALOPTS="-serial file:$SERIAL_LOGFILE"
+ SERIALOPTS=""
+ if [ "x$SERIAL_LOGFILE" != "x" ]; then
+ SERIALOPTS="-serial file:$SERIAL_LOGFILE"
+ fi
fi
case "$MACHINE" in
"qemuarm") ;;
+ "qemuarm64") ;;
+ "qemumicroblaze") ;;
"qemumips") ;;
+ "qemumipsel") ;;
+ "qemumips64") ;;
+ "qemush4") ;;
"qemuppc") ;;
"qemuarmv6") ;;
- "beagleboard") ;;
+ "qemuarmv7") ;;
"vexpressa9") ;;
"qemux86") ;;
"qemux86-64") ;;
+ "qemuzynq") ;;
"akita") ;;
"spitz") ;;
*)
echo "Error: Unsupported machine type $MACHINE"
- return
+ return 1
;;
esac
-if [ ! -f "$KERNEL" ]; then
+if [ ! -f "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then
echo "Error: Kernel image file $KERNEL doesn't exist"
cleanup
- return
+ return 1
fi
-PATH=$CROSSPATH:$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
-
-sd_needed() {
- if [ ! -f $IMGNAME ]; then
- SD_NEEDED="y"
- return
- else
- STAMP=`stat -c %Y $IMGNAME`
-
- if [ -f $MLO ]; then
- if [ `stat -c %Y $MLO` -gt $STAMP ]; then
- SD_NEEDED="y"
- return
- fi
- fi
-
- if [ -f $UBOOT ]; then
- if [ `stat -c %Y $UBOOT` -gt $STAMP ]; then
- SD_NEEDED="y"
- return
- fi
- fi
-
- if [ -f $KERNEL ]; then
- if [ `stat -c %Y $KERNEL` -gt $STAMP ]; then
- SD_NEEDED="y"
- return
- fi
- fi
-
- if [ -f $ROOTFS ]; then
- if [ `stat -c %Y $ROOTFS` -gt $STAMP ]; then
- SD_NEEDED="y"
- return
- fi
- fi
-
- SD_NEEDED="n"
- return
-
- fi
-}
-
-# Check if we need to regenerate the sd image
-sd_needed
-
-if [ "$MACHINE" = "beagleboard" -a "$SD_NEEDED" = "y" ]; then
- echo "Creating SD image ..."
- QEMU_IMG=qemu-img
- QEMUIMG=`which $QEMU_IMG 2> /dev/null`
- if [ ! -x "$QEMUIMG" ]; then
- echo "Error: No QEMUIMG binary '$QEMU_IMG' could be found."
- cleanup
- return
- fi
- CREATE_SD_SCRIPT=`which create_img.sh`
- UENVTXT=`which uEnv.txt 2> /dev/null`
- BOOTTXT=`which boot.txt 2> /dev/null`
- BOOTSCR=`which boot.scr 2> /dev/null`
- echo "MLO: $MLO "
- echo "UBOOT $UBOOT"
- echo "IMGNAME $IMGNAME"
- echo "QEMUIMG $QEMUIMG"
- echo "UENVTXT $UENVTXT"
- echo "BOOTTXT $BOOTTXT"
- echo "BOOTSCR $BOOTSCR"
- $CREATE_SD_SCRIPT $IMGNAME $MLO $UBOOT $KERNEL $ROOTFS $QEMUIMG $UENVTXT $BOOTTXT $BOOTSCR
- if [ $? != 0 ]; then
- cleanup
- return
- fi
-else
- echo "No need to create image."
-fi
-
-if [ "$FSTYPE" != "nfs" -a ! -f "$ROOTFS" ]; then
+if [ "$FSTYPE" != "nfs" -a "$FSTYPE" != "vmdk" -a ! -f "$ROOTFS" ]; then
echo "Error: Image file $ROOTFS doesn't exist"
cleanup
- return
+ return 1
fi
-if [ "$FSTYPE" = "nfs" ]; then
+if [ "$NFS_SERVER" = "" ]; then
NFS_SERVER="192.168.7.1"
+ if [ "$SLIRP_ENABLED" = "yes" ]; then
+ NFS_SERVER="10.0.2.2"
+ fi
+fi
+
+if [ "$FSTYPE" = "nfs" ]; then
NFS_DIR=`echo $ROOTFS | sed 's/^[^:]*:\(.*\)/\1/'`
+ if [ "$NFS_INSTANCE" = "" ] ; then
+ NFS_INSTANCE=0
+ fi
MOUNTD_RPCPORT=$[ 21111 + $NFS_INSTANCE ]
NFSD_RPCPORT=$[ 11111 + $NFS_INSTANCE ]
- NFSD_PORT=$[ 3049 + $NFS_INSTANCE ]
- MOUNTD_PORT=$[ 3048 + $NFS_INSTANCE ]
- UNFS_OPTS="nfsvers=2,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,port=$NFSD_PORT,mountport=$MOUNTD_PORT"
+ NFSD_PORT=$[ 3049 + 2 * $NFS_INSTANCE ]
+ MOUNTD_PORT=$[ 3048 + 2 * $NFS_INSTANCE ]
+ UNFS_OPTS="nfsvers=3,port=$NFSD_PORT,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,mountport=$MOUNTD_PORT"
PSEUDO_LOCALSTATEDIR=~/.runqemu-sdk/pseudo
export PSEUDO_LOCALSTATEDIR
@@ -361,93 +348,103 @@ if [ "$FSTYPE" = "nfs" ]; then
echo "runqemu-export-rootfs restart $ROOTFS"
runqemu-export-rootfs restart $ROOTFS
if [ $? != 0 ]; then
- cleanup
- return
+ return 1
fi
NFSRUNNING="true"
fi
-if [ "$NFS_SERVER" = "" ]; then
- NFS_SERVER="192.168.7.1"
- NFS_DIR=$ROOTFS
-fi
-
-if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarmv7" ]; then
+if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarmv7" \
+ -o "$MACHINE" = "vexpressa9" ]; then
QEMU=qemu-system-arm
- case "$MACHINE" in
- "qemuarmv7")
- MACHINE_SUBTYPE=vexpress-a9
- ;;
- *)
- MACHINE_SUBTYPE=versatilepb
- esac
+ if [ "$MACHINE" = "vexpressa9" ]; then
+ MACHINE_SUBTYPE=vexpress-a9
+ else
+ MACHINE_SUBTYPE=versatilepb
+ fi
+ export QEMU_AUDIO_DRV="none"
QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
# QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -force-pointer"
- if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
KERNCMDLINE="root=/dev/sda rw console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off"
- QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS"
- fi
- if [ "$FSTYPE" = "nfs" ]; then
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS"
+ elif [ "$FSTYPE" = "tar.bz2" ]; then
+ KERNCMDLINE="root=/dev/mmcblk0 rw console=ttyAMA0,38400n8 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY raid=noautodetect vmalloc=256MB rootwait devtmpfs.mount=0"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} -sd $IMGNAME $QEMU_UI_OPTIONS -cpu cortex-a9"
+#/storage/src/CCCP/genivi-baseline_pre9.0/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-arm -kernel /storage/src/CCCP/genivi-baseline_pre9.0/build/tmp/deploy/images/vexpressa9/zImage-vexpressa9.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=no,downscript=no -M vexpress-a9 -cpu cortex-a9 -sd /storage/src/CCCP/genivi-baseline_pre9.0/build/tmp/deploy/images/vexpressa9/kronos-image-vexpressa9-20150916072634.rootfs.tar.bz2 -no-reboot -m 1024 --append "root=/dev/mmcblk0 rw mem=1024M raid=noautodetect console=tty0 console=ttyAMA0,38400n8 rootwait vmalloc=256MB devtmpfs.mount=0 "
+ elif [ "$FSTYPE" = "nfs" ]; then
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
echo "Error: NFS mount point $ROOTFS doesn't exist"
cleanup
- return
+ return 1
fi
- KERNCMDLINE="root=/dev/nfs 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"
+ KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw console=ttyAMA0,115200 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} --no-reboot $QEMU_UI_OPTIONS"
fi
if [ "$MACHINE" = "qemuarmv6" ]; then
QEMUOPTIONS="$QEMUOPTIONS -cpu arm1136"
- fi
- if [ "$MACHINE" = "qemuarmv7" ]; then
+ elif [ "$MACHINE" = "qemuarmv7" ]; then
QEMUOPTIONS="$QEMUOPTIONS -cpu cortex-a8"
fi
fi
-if [ "$MACHINE" = "beagleboard" ]; then
- QEMU=qemu-system-arm
- MACHINE_SUBTYPE=beagle
- QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
- if [ "$FSTYPE" = "tar.bz2" ]; then
- KERNCMDLINE=""
- QEMUOPTIONS="-M $MACHINE_SUBTYPE -drive if=sd,cache=writeback,file=$IMGNAME -clock unix -device usb-kbd -device usb-mouse -usb -device usb-net,netdev=mynet -netdev user,id=mynet"
- # Add
- # -serial stdio
- # To redirect serial to stdio
- fi
-fi
+if [ "$MACHINE" = "qemuarm64" ]; then
+ QEMU=qemu-system-aarch64
-if [ "$MACHINE" = "vexpressa9" ]; then
- QEMU=qemu-system-arm
- MACHINE_SUBTYPE=vexpress-a9
- QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
export QEMU_AUDIO_DRV="none"
- #SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio "
- if [ "$FSTYPE" = "tar.bz2" ]; then
- KERNCMDLINE="root=/dev/mmcblk0 rw mem=1024M raid=noautodetect console=tty0 console=ttyAMA0,38400n8 rootwait vmalloc=256MB devtmpfs.mount=0"
- QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -cpu cortex-a9 -sd $IMGNAME"
- # Add
- # -serial stdio
- # To redirect serial to stdio
+ if [ "x$SERIALSTDIO" = "x" ] ; then
+ QEMU_UI_OPTIONS="-nographic"
+ else
+ QEMU_UI_OPTIONS=""
+ fi
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
+ KERNCMDLINE="root=/dev/vda rw console=ttyAMA0,38400 mem=$QEMU_MEMORY highres=off $KERNEL_NETWORK_CMD"
+ # qemu-system-aarch64 only support '-machine virt -cpu cortex-a57' for now
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -machine virt -cpu cortex-a57 $ROOTFS_OPTIONS $QEMU_UI_OPTIONS"
+ fi
+ if [ "$FSTYPE" = "nfs" ]; then
+ if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
+ echo "Error: NFS mount point $ROOTFS doesn't exist"
+ cleanup
+ return 1
+ fi
+ 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
- QEMU=qemu
- QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware -enable-gl"
- if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
- KERNCMDLINE="vga=0 root=/dev/hda rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
- QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $ROOTFS $QEMU_UI_OPTIONS"
+ QEMU=qemu-system-i386
+ if [ "$KVM_ACTIVE" = "yes" ]; then
+ CPU_SUBTYPE=kvm32
+ else
+ CPU_SUBTYPE=qemu32
+ fi
+ if [ ! -z "$vga_option" ]; then
+ QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
+ else
+ QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware"
fi
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
+ KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $ROOTFS_OPTIONS $QEMU_UI_OPTIONS"
+ fi
+ if [ "${FSTYPE:0:4}" = "cpio" ]; then
+ KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=/dev/ram0 rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -initrd $ROOTFS $QEMU_UI_OPTIONS"
+ fi
+
if [ "$FSTYPE" = "nfs" ]; then
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
echo "Error: NFS mount point $ROOTFS doesn't exist."
cleanup
- return
+ return 1
fi
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" ]; then
+ QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS"
+ fi
# 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"
@@ -455,10 +452,19 @@ fi
if [ "$MACHINE" = "qemux86-64" ]; then
QEMU=qemu-system-x86_64
- QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware -enable-gl"
- if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
- KERNCMDLINE="vga=0 root=/dev/hda rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
- QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $ROOTFS $QEMU_UI_OPTIONS"
+ if [ "$KVM_ACTIVE" = "yes" ]; then
+ CPU_SUBTYPE=kvm64
+ else
+ CPU_SUBTYPE=core2duo
+ fi
+ if [ ! -z "$vga_option" ]; then
+ QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
+ else
+ QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware"
+ fi
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
+ KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $ROOTFS_OPTIONS $QEMU_UI_OPTIONS"
fi
if [ "$FSTYPE" = "nfs" ]; then
if [ "x$ROOTFS" = "x" ]; then
@@ -467,10 +473,13 @@ if [ "$MACHINE" = "qemux86-64" ]; then
if [ ! -d "$ROOTFS" ]; then
echo "Error: NFS mount point $ROOTFS doesn't exist."
cleanup
- return
+ return 1
fi
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"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS"
+ fi
+ if [ "$FSTYPE" = "vmdk" ]; 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
# qemux86 and qemux86-64. We can use timer interrupt mode for now.
@@ -479,7 +488,7 @@ fi
if [ "$MACHINE" = "spitz" ]; then
QEMU=qemu-system-arm
- if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
echo $ROOTFS
ROOTFS=`readlink -f $ROOTFS`
echo $ROOTFS
@@ -491,11 +500,15 @@ if [ "$MACHINE" = "spitz" ]; then
fi
fi
-if [ "$MACHINE" = "qemumips" ]; then
- QEMU=qemu-system-mips
+if [ "$MACHINE" = "qemumips" -o "$MACHINE" = "qemumipsel" -o "$MACHINE" = "qemumips64" ]; then
+ case "$MACHINE" in
+ qemumips) QEMU=qemu-system-mips ;;
+ qemumipsel) QEMU=qemu-system-mipsel ;;
+ qemumips64) QEMU=qemu-system-mips64 ;;
+ esac
MACHINE_SUBTYPE=malta
QEMU_UI_OPTIONS="-vga cirrus $QEMU_UI_OPTIONS"
- if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
#KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
KERNCMDLINE="root=/dev/hda rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS"
@@ -504,7 +517,7 @@ if [ "$MACHINE" = "qemumips" ]; then
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
echo "Error: NFS mount point $ROOTFS doesn't exist"
cleanup
- return
+ return 1
fi
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"
@@ -513,25 +526,55 @@ fi
if [ "$MACHINE" = "qemuppc" ]; then
QEMU=qemu-system-ppc
- MACHINE_SUBTYPE=prep
- CPU_SUBTYPE=603e
- BIOS=powerpc_rom.bin
- QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -nographic"
- if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
- KERNCMDLINE="root=/dev/hda rw console=ttyS0 3 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
- QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -bios $BIOS -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS"
+ MACHINE_SUBTYPE=mac99
+ CPU_SUBTYPE=G4
+ QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
+ if [ "$SLIRP_ENABLED" = "yes" ]; then
+ QEMU_NETWORK_CMD=""
+ else
+ QEMU_NETWORK_CMD="-net nic,model=pcnet $QEMU_TAP_CMD"
+ fi
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
+ KERNCMDLINE="root=/dev/hda rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS"
fi
if [ "$FSTYPE" = "nfs" ]; then
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
echo "Error: NFS mount point $ROOTFS doesn't exist"
cleanup
- return
+ return 1
fi
- KERNCMDLINE="root=/dev/nfs console=ttyS0 3 nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
- QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -bios $BIOS -no-reboot $QEMU_UI_OPTIONS"
+ 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
+ QEMU=qemu-system-sh4
+ MACHINE_SUBTYPE=r2d
+ QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
+ #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
+ KERNCMDLINE="root=/dev/hda rw console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
+ SERIALSTDIO="1"
+ fi
+ if [ "$FSTYPE" = "nfs" ]; then
+ if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
+ echo "Error: NFS mount point $ROOTFS doesn't exist"
+ cleanup
+ return 1
+ fi
+ KERNCMDLINE="root=/dev/nfs console=ttySC1 noiotrap earlyprintk=sh-sci.1 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 -monitor null -serial vc -serial stdio"
+ SERIALSTDIO="1"
+ fi
+fi
+
+if [ "${FSTYPE:0:3}" = "ext" ]; then
+ KERNCMDLINE="$KERNCMDLINE rootfstype=$FSTYPE"
+fi
+
if [ "$MACHINE" = "akita" ]; then
QEMU=qemu-system-arm
if [ "$FSTYPE" = "jffs2" ]; then
@@ -544,42 +587,73 @@ if [ "$MACHINE" = "akita" ]; then
fi
fi
+if [ "$MACHINE" = "qemumicroblaze" ]; then
+ QEMU=qemu-system-microblazeel
+ QEMU_SYSTEM_OPTIONS="-M petalogix-ml605 -serial mon:stdio -dtb $KERNEL-$MACHINE.dtb"
+ if [ "${FSTYPE:0:3}" = "ext" -o "${FSTYPE:0:4}" = "cpio" ]; then
+ KERNCMDLINE="earlyprintk root=/dev/ram rw"
+ QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS"
+ fi
+fi
+
+if [ "$MACHINE" = "qemuzynq" ]; then
+ QEMU=qemu-system-arm
+ QEMU_SYSTEM_OPTIONS="-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"
+ QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS"
+ fi
+fi
+
+if [ "x$RAMFS" = "xtrue" ]; then
+ QEMUOPTIONS="-initrd $ROOTFS -nographic"
+ KERNCMDLINE="root=/dev/ram0 console=ttyS0 debugshell"
+fi
+
+if [ "x$ISOFS" = "xtrue" ]; then
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -cdrom $ROOTFS $QEMU_UI_OPTIONS"
+fi
+
if [ "x$QEMUOPTIONS" = "x" ]; then
echo "Error: Unable to support this combination of options"
cleanup
- return
+ return 1
fi
-#PATH=$CROSSPATH:$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
+PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
QEMUBIN=`which $QEMU 2> /dev/null`
if [ ! -x "$QEMUBIN" ]; then
echo "Error: No QEMU binary '$QEMU' could be found."
cleanup
- return
+ return 1
fi
-function _quit() {
- if [ -n "$PIDFILE" ]; then
- #echo kill `cat $PIDFILE`
- kill `cat $PIDFILE`
+NEED_GL=`ldd $QEMUBIN/$QEMU 2>&1 | grep libGLU`
+# We can't run without a libGL.so
+if [ "$NEED_GL" != "" ]; then
+ libgl='no'
+
+ [ -e /usr/lib/libGL.so -a -e /usr/lib/libGLU.so ] && libgl='yes'
+ [ -e /usr/lib64/libGL.so -a -e /usr/lib64/libGLU.so ] && libgl='yes'
+ [ -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.
+ Fedora package names are: mesa-libGL-devel mesa-libGLU-devel."
+ return 1;
fi
+fi
+
+do_quit() {
cleanup
- return
+ return 1
}
-DISTCCD=`which distccd 2> /dev/null`
-PIDFILE=""
-
-trap _quit INT TERM QUIT
-
-if [ -x "$DISTCCD" ]; then
- echo "Starting distccd..."
- PIDFILE=`mktemp`
- $DISTCCD --allow 192.168.7.2 --daemon --pid-file $PIDFILE &
-else
- echo "WARNING: distccd not present, no distcc support loaded."
-fi
+trap do_quit INT TERM QUIT
# qemu got segfault if linked with nVidia's libgl
GL_LD_PRELOAD=$LD_PRELOAD
@@ -590,32 +664,55 @@ cat << EOM
WARNING: nVidia proprietary OpenGL libraries detected.
nVidia's OpenGL libraries are known to have compatibility issues with qemu,
resulting in a segfault. Please uninstall these drivers or ensure the mesa libGL
-libraries precede nvidia's via LD_PRELOAD(Already do it on Ubuntu).
+libraries precede nvidia's via LD_PRELOAD(Already do it on Ubuntu 10).
EOM
# Automatically use Ubuntu system's mesa libGL, other distro can add its own path
- if grep -i ubuntu /etc/lsb-release &> /dev/null
+if grep -i ubuntu /etc/lsb-release &> /dev/null
+then
+ # precede nvidia's driver on Ubuntu 10
+ UBUNTU_MAIN_VERSION=`cat /etc/lsb-release |grep DISTRIB_RELEASE |cut -d= -f 2| cut -d. -f 1`
+ if [ "$UBUNTU_MAIN_VERSION" = "10" ];
then
- echo "Skip nVidia's libGL on Ubuntu!"
- GL_LD_PRELOAD="/usr/lib/libGL.so $LD_PRELOAD"
+ GL_PATH=""
+ if test -e /usr/lib/libGL.so
+ then
+ GL_PATH="/usr/lib/libGL.so"
+ elif test -e /usr/lib/x86_64-linux-gnu/libGL.so
+ then
+ GL_PATH="/usr/lib/x86_64-linux-gnu/libGL.so"
+ fi
+
+ echo "Skip nVidia's libGL on Ubuntu 10!"
+ GL_LD_PRELOAD="$GL_PATH $LD_PRELOAD"
fi
fi
+fi
+
+if [ "x$SERIALSTDIO" = "x1" ]; then
+ echo "Interrupt character is '^]'"
+ stty intr ^]
+fi
echo "Running $QEMU..."
# -no-reboot is a mandatory option - see bug #100
-if [ "$MACHINE" = "beagleboard" ]; then
- echo $QEMUBIN $QEMUOPTIONS $SERIALOPTS $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT
- LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN $QEMUOPTIONS $SERIALOPTS $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT
-elif [ "$MACHINE" = "vexpressa9" ]; then
- echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $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"
+if [ "$FSTYPE" = "vmdk" ]; 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
+elif [ "$FSTYPE" = "iso" ]; 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
else
- echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"'
+ 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"
fi
+ret=$?
+if [ "$SLIRP_ENABLED" != "yes" ]; then
+ cleanup
+fi
-
-cleanup
-
+#set the original stty values before exit
+stty ${ORIG_STTY}
trap - INT TERM QUIT
-return
+
+return $ret