aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong-iL Joh <yong-il.joh@windriver.com>2017-04-11 22:17:12 +0900
committerYong-iL Joh <yong-il.joh@windriver.com>2017-04-11 22:17:12 +0900
commit9507c37b3e1f8d2e54e83c32b12a84ead3f42d0f (patch)
tree10e24101fe5f6ef085bd4ae3e5163da4fbaa3d66
parentf20216f5d856d7d2aa86f2132fbd9f76bc49fc01 (diff)
downloadmeta-ivi-9507c37b3e1f8d2e54e83c32b12a84ead3f42d0f.tar.gz
meta-ivi-9507c37b3e1f8d2e54e83c32b12a84ead3f42d0f.tar.bz2
meta-ivi-9507c37b3e1f8d2e54e83c32b12a84ead3f42d0f.zip
scripts/ : use runqemu in poky
- remove unused files Signed-off-by: Yong-iL Joh <yong-il.joh@windriver.com>
-rwxr-xr-xscripts/boot.scrbin338 -> 0 bytes
-rwxr-xr-xscripts/boot.txt3
-rwxr-xr-xscripts/create_img.sh147
-rwxr-xr-xscripts/runqemu576
-rwxr-xr-xscripts/runqemu-internal721
-rwxr-xr-xscripts/uEnv.txt3
6 files changed, 66 insertions, 1384 deletions
diff --git a/scripts/boot.scr b/scripts/boot.scr
deleted file mode 100755
index fc109d7..0000000
--- a/scripts/boot.scr
+++ /dev/null
Binary files differ
diff --git a/scripts/boot.txt b/scripts/boot.txt
deleted file mode 100755
index 0105e84..0000000
--- a/scripts/boot.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-setenv bootcmd "fatload mmc 0:1 0x80000000 uImage; bootm 0x80000000"
-setenv bootargs "console=tty0 console=ttyO2,115200n8 mpurate=auto vram=12M omapfb.mode=dvi:1024x768MR-16@60 omapfb.debug=y omapdss.def_disp=dvi root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait"
-boot \ No newline at end of file
diff --git a/scripts/create_img.sh b/scripts/create_img.sh
deleted file mode 100755
index 395015e..0000000
--- a/scripts/create_img.sh
+++ /dev/null
@@ -1,147 +0,0 @@
-#!/bin/bash
-
-# This script generates SD card disk images suitable for use with QEMU.
-#
-# Copyright (C) 2011 Ash Charles
-# Based on:
-# Narcissus - Online image builder for the angstrom distribution
-# Copyright (C) 2008 - 2011 Koen Kooi
-# Copyright (C) 2010 Denys Dmytriyenko
-# and
-# Linaro Images Tools.
-# Author: Guilherme Salgado <guilherme.salgado@linaro.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-LC_ALL=C
-set -e
-
-function usage()
-{
- echo "This utility generates SD card images suitable for use with QEMU."
- echo "Usage:"
- echo " $0 <output name> <mlo> <u-boot> <kernel> <rootfs>"
- echo "Example:"
- echo " $0 sd.img ~/MLO ~/u-boot.bin ~/uImage ~/rootfs.tar.bz2"
-}
-
-function check_args()
-{
- if [ $# -ne 9 ]; then
- usage
- exit 1
- fi
- OUTFILE=$1
- MLO=$2
- UBOOT=$3
- KERNEL=$4
- ROOTFS=$5
- QEMU_IMG=$6
- UENVTXT=$7
- BOOTTXT=$8
- BOOTSCR=$9
-
- if ! [[ -e ${MLO} ]]; then
- echo "MLO not found at ${MLO}! Quitting..."
- exit 1
- fi
- if ! [[ -e ${UBOOT} ]]; then
- echo "U-boot not found at ${UBOOT}! Quitting..."
- exit 1
- fi
- if ! [[ -e ${KERNEL} ]]; then
- echo "Kernel not found at ${KERNEL}! Quitting..."
- exit 1
- fi
- if ! [[ -e ${ROOTFS} ]]; then
- echo "Rootfs not found at ${ROOTFS}! Quitting..."
- exit 1
- fi
- if ! [[ -e ${QEMU_IMG} ]]; then
- echo "Qemu-img not found at ${QEMU_IMG}! Quitting..."
- exit 1
- fi
- if ! [[ -e ${UENVTXT} ]]; then
- echo "UENVTXT not found at ${UENVTXT}! Quitting..."
- exit 1
- fi
- if ! [[ -e ${BOOTTXT} ]]; then
- echo "BOOTTXT not found at ${BOOTTXT}! Quitting..."
- exit 1
- fi
- if ! [[ -e ${BOOTSCR} ]]; then
- echo "BOOTSCR not found at ${BOOTSCR}! Quitting..."
- exit 1
- fi
-}
-
-SIZE=1073741824 # 1G by default
-
-function make_image()
-{
- $QEMU_IMG create -f raw ${OUTFILE} ${SIZE}
-
- CYLINDERS=`echo ${SIZE}/255/63/512 | bc`
- {
- echo ,9,0x0C,*
- echo ,,,-
- } | sfdisk -D -H 255 -S 63 -C ${CYLINDERS} ${OUTFILE} &> /dev/null
-
- # Reverse-engineer the partition setup
- BYTES_PER_SECTOR="$(/sbin/fdisk -l -u ${OUTFILE} | grep Units | awk '{print $9}')"
- VFAT_SECTOR_OFFSET="$(/sbin/fdisk -l -u ${OUTFILE} | grep FAT32 | awk '{print $3}')"
- EXT3_SECTOR_OFFSET="$(/sbin/fdisk -l -u ${OUTFILE} | grep Linux | awk '{print $2}')"
-}
-
-
-
-function populate_image()
-{
- LOOP_DEV="/dev/loop1"
- LOOP_DEV_FS="/dev/loop2"
-
- echo "[ Format vfat partition ]"
- sudo /sbin/losetup -v -o $(expr ${BYTES_PER_SECTOR} "*" ${VFAT_SECTOR_OFFSET}) ${LOOP_DEV} ${OUTFILE}
- sudo mkfs.vfat -F 32 -n "boot" ${LOOP_DEV}
-
- echo "[ Format ext3 partition ]"
- sudo /sbin/losetup -v -o $(expr ${BYTES_PER_SECTOR} "*" ${EXT3_SECTOR_OFFSET}) ${LOOP_DEV_FS} ${OUTFILE}
- sudo /sbin/mkfs.ext3 -L rootfs ${LOOP_DEV_FS}
-
- echo "[ Copying files to vfat ]"
- sudo mount ${LOOP_DEV} /mnt
- sudo cp -v ${MLO} /mnt/MLO
- sudo cp -v ${UBOOT} /mnt/u-boot.bin
- sudo cp -v ${KERNEL} /mnt/uImage
- sudo cp -v ${UENVTXT} /mnt/uEnv.txt
- sudo cp -v ${BOOTTXT} /mnt/boot.txt
- sudo cp -v ${BOOTSCR} /mnt/boot.scr
- sudo sync
- sudo umount ${LOOP_DEV}
-
- echo "[ Copying file system ]"
- sudo mount ${LOOP_DEV_FS} /mnt
- sudo tar xaf ${ROOTFS} -C /mnt
- sudo sync
- sudo umount ${LOOP_DEV_FS}
-
- echo "[ Clean up ]"
- sudo /sbin/losetup -d ${LOOP_DEV}
- sudo /sbin/losetup -d ${LOOP_DEV_FS}
-}
-
-ARGS=$*
-check_args $ARGS
-make_image
-populate_image
diff --git a/scripts/runqemu b/scripts/runqemu
index 9fc295a..abe15f4 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1,517 +1,73 @@
-#!/bin/bash
-#
-# Handle running OE images standalone with QEMU
-#
-# Copyright (C) 2006-2011 Linux Foundation
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-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 " 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 - 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 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
-}
-
-if [ "x$1" = "x" ]; then
- usage
+#!/bin/sh
+_script_dir=`dirname $0`
+_meta_ivi=`dirname ${_script_dir}`
+
+_check_it=`basename ${_meta_ivi}`
+if [ "x${_check_it}" != "xmeta-ivi" ]; then
+ echo "this is not script of meta-ivi"
+ exit 1
fi
-
-error() {
- echo "Error: "$*
- usage
-}
-
-MACHINE=${MACHINE:=""}
-KERNEL=${KERNEL:=""}
-ROOTFS=${ROOTFS:=""}
-VM=${VM:=""}
-FSTYPE=${FSTYPE:=""}
-LAZY_ROOTFS=""
-SCRIPT_QEMU_OPT=""
-SCRIPT_QEMU_EXTRA_OPT=""
-SCRIPT_KERNEL_OPT=""
-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 }'`
- 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.
-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" | "ext4" | "jffs2" | "nfs" | "btrfs")
- [ -z "$FSTYPE" -o "$FSTYPE" = "$arg" ] && FSTYPE=$arg || \
- error "conflicting FSTYPE types [$FSTYPE] and [$arg]"
- ;;
- *-image*)
- [ -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
- 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=}"
-
- # Warn user if they try to specify serial or kvm options
- # to use simplified options instead
- serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'`
- kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'`
- 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" -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 -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" -o "$FSTYPE" = "nfs" ]; then
- FSTYPE=nfs
- else
- error "conflicting FSTYPE types [$arg] and nfs"
- fi
-
- if [ -z "$ROOTFS" ]; then
- ROOTFS=$arg
- else
- error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
- fi
- elif [ -f "$arg" ]; then
- process_filename $arg
- else
- error "unable to classify arg [$arg]"
- fi
- ;;
- esac
- shift
+_top_dir=`dirname ${_meta_ivi}`
+
+_build=${_top_dir}/build
+_machine='qemux86-64'
+_image=`grep bitbake ${_meta_ivi}/README.md | awk '{print $4}'`
+while getopts "hm:i:b:" arg; do
+ case $arg in
+ h)
+ echo "usage $0 [option] [runqemu option]"
+ echo " -h display this message"
+ echo " -m set machine"
+ echo " -i set image name"
+ echo " -b set build directory"
+ exit 0
+ ;;
+ m)
+ _machine=$OPTARG
+ ;;
+ i)
+ _image=${OPTARG}-image
+ ;;
+ b)
+ _build=${_top_dir}/$OPTARG
+ ;;
+ esac
done
+shift $((OPTIND-1))
-if [ ! -c /dev/net/tun ] ; then
- echo "TUN control device /dev/net/tun is unavailable; you may need to enable TUN (e.g. sudo modprobe tun)"
- exit 1
-elif [ ! -w /dev/net/tun ] ; then
- echo "TUN control device /dev/net/tun is not writable, please fix (e.g. sudo chmod 666 /dev/net/tun)"
- 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 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" -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?"
- echo "For further help see:"
- echo "$YOCTO_KVM_WIKI";
- exit 1;
- fi
- 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."
- echo "Please change the ownership of this file as described at:"
- echo "$YOCTO_KVM_WIKI";
- exit 1;
- fi
- 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
-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=ext4
-
-QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin
-QEMUX86_64_DEFAULT_FSTYPE=ext4
-
-QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin
-QEMUARM_DEFAULT_FSTYPE=ext4
-
-VEXPRESSA9_DEFAULT_KERNEL=zImage-vexpressa9.bin
-VEXPRESSA9_DEFAULT_FSTYPE=ext3
-
-QEMUARM64_DEFAULT_KERNEL=Image-qemuarm64.bin
-QEMUARM64_DEFAULT_FSTYPE=ext4
-
-QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin
-QEMUMIPS_DEFAULT_FSTYPE=ext4
-
-QEMUMIPSEL_DEFAULT_KERNEL=vmlinux-qemumipsel.bin
-QEMUMIPSEL_DEFAULT_FSTYPE=ext4
-
-QEMUMIPS64_DEFAULT_KERNEL=vmlinux-qemumips64.bin
-QEMUMIPS64_DEFAULT_FSTYPE=ext4
-
-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
-
-SPITZ_DEFAULT_KERNEL=zImage-spitz.bin
-SPITZ_DEFAULT_FSTYPE=ext3
-
-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";
- echo "bitbake in your PATH or to source oe-init-build-env";
- echo "before running this script" >&2;
- exit 1; }
-
- # 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
-}
-
-setup_sysroot() {
- # Toolchain installs set up $OECORE_NATIVE_SYSROOT in their
- # environment script. If that variable isn't set, we're
- # either in an in-tree build scenario or the environment
- # script wasn't source'd.
- if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
- setup_path_vars
- BUILD_ARCH=`uname -m`
- BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
- BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
-
- OECORE_NATIVE_SYSROOT=$OE_TMPDIR/sysroots/$BUILD_SYS
- fi
-}
-
-# Locate a rootfs image to boot which matches our expected
-# machine and fstype.
-findimage() {
- where=$1
- machine=$2
- extension=$3
-
- # Sort rootfs candidates by modification time - the most
- # recently created one is the one we most likely want to boot.
- 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" -a -z "$FSTYPE" ]; then
- # Extract the filename extension
- EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
- 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"
- echo "We will use the default FSTYPE for $MACHINE"
- # ...which is done further below...
- fi
-fi
-
-if [ -z "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then
- setup_path_vars 1
- eval kernel_file=\$${machine2}_DEFAULT_KERNEL
- KERNEL=$DEPLOY_DIR_IMAGE/$kernel_file
-
- if [ -z "$KERNEL" ]; then
- error "Unable to determine default kernel for MACHINE [$MACHINE]"
- fi
-fi
-# KERNEL is now set for all cases
-
-if [ -z "$FSTYPE" ]; then
- eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE
-
- if [ -z "$FSTYPE" ]; then
- error "Unable to determine default fstype for MACHINE [$MACHINE]"
- fi
-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_path_vars 1
- echo "Assuming $ROOTFS really means $DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE"
- ROOTFS=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE
-fi
-
-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
- error "Unable to determine default rootfs for MACHINE [$MACHINE]"
- fi
-fi
-# 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:"
-if [ "x$FSTYPE" != "xvmdk" ]; then
- echo "KERNEL: [$KERNEL]"
- echo "ROOTFS: [$ROOTFS]"
+w_bit=`which bitbake`
+if [ "x${w_bit}" == "x" ]; then
+ export TEMPLATECONF=${_meta_ivi}/meta-ivi/conf
+ _poky=${_top_dir}/poky
+ source ${_poky}/oe-init-build-env ${_build}
else
- echo "VMDK: [$VM]"
+ cd ${_build}
fi
-echo "FSTYPE: [$FSTYPE]"
-setup_sysroot
-# OECORE_NATIVE_SYSROOT is now set for all cases
-
-INTERNAL_SCRIPT="$0-internal"
-if [ ! -f "$INTERNAL_SCRIPT" -o ! -r "$INTERNAL_SCRIPT" ]; then
-INTERNAL_SCRIPT=`which runqemu-internal`
-fi
-
-# 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
+_DIR=tmp/deploy/images/${_machine}
+_CONF=${_DIR}/${_image}-${_machine}.qemuboot.conf
+_ARG=""
+if [ -e ${_CONF} ]; then
+ _ARG=${_CONF}
+else
+ _K=${_DIR}/*-${_machine}.bin
+ _I=${_DIR}/${_image}-${_machine}.ext*
+ if [ -e ${_K} -a -e ${_I} ]; then
+ _k=`\ls ${_DIR}/*-${_machine}.bin`
+ _i=`\ls ${_DIR}/${_image}-${_machine}.ext*`
+ if [ "${_machine}" == "vexpressa9" ]; then
+ _ARG="vexpress-a9 ${_k} ${_i}"
+ else
+ _ARG="${_machine} ${_k} ${_i}"
+ fi
+ else
+ if [ ! -e ${_K} ]; then
+ echo there is no ${_K}
+ fi
+ if [ ! -e ${_I} ]; then
+ echo there is no ${_I}
+ fi
+ exit 2
+ fi
fi
-
-. $INTERNAL_SCRIPT
-exit $?
+../poky/scripts/runqemu ${_ARG} $*
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
deleted file mode 100755
index d021442..0000000
--- a/scripts/runqemu-internal
+++ /dev/null
@@ -1,721 +0,0 @@
-#!/bin/bash -x
-
-# Handle running OE images under qemu
-#
-# Copyright (C) 2006-2011 Linux Foundation
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-# 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
-#
-# Image options:
-# MACHINE - the machine to run
-# FSTYPE - the image type to run
-# KERNEL - the kernel image file to use
-# ROOTFS - the disk image file to use
-#
-
-
-mem_size=-1
-
-#Get rid of <> and get the contents of extra qemu running params
-SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e 's/<//' -e 's/>//'`
-#if user set qemu memory, eg: -m 256 in qemu extra params, we need to do some
-# validation check
-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=64
- ;;
- "qemumips"|"qemumips64")
- mem_size=256
- ;;
- "qemuppc")
- mem_size=256
- ;;
- "qemush4")
- mem_size=1024
- ;;
- "qemuzynq")
- mem_size=1024
- ;;
- "vexpressa9")
- mem_size=1024
- ;;
- *)
- mem_size=64
- ;;
- esac
-
-fi
-
-# QEMU_MEMORY has 'M' appended to mem_size
-QEMU_MEMORY="$mem_size"M
-
-# 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
-
-# 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
-# devices, indicating that the user should not bring up new ones using
-# sudo.
-NOSUDO_FLAG="/etc/runqemu-nosudo"
-
-QEMUIFUP=`which runqemu-ifup 2> /dev/null`
-QEMUIFDOWN=`which runqemu-ifdown 2> /dev/null`
-if [ -z "$QEMUIFUP" -o ! -x "$QEMUIFUP" ]; then
- echo "runqemu-ifup cannot be found or executed"
- exit 1
-fi
-if [ -z "$QEMUIFDOWN" -o ! -x "$QEMUIFDOWN" ]; then
- echo "runqemu-ifdown cannot be found or executed"
- exit 1
-fi
-
-NFSRUNNING="false"
-
-#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
- QEMU_NETWORK_CMD=""
- DROOT="/dev/hda"
- ROOTFS_OPTIONS="-hda $ROOTFS"
- 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
- exec 8>&-
- }
-
- LOCKDIR="/tmp/qemu-tap-locks"
- if [ ! -d "$LOCKDIR" ]; then
- mkdir $LOCKDIR
- chmod 777 $LOCKDIR
- 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 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" -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
-
- KERNCMDLINE="mem=$QEMU_MEMORY"
- QEMU_UI_OPTIONS="-usb" #"-show-cursor -usb -usbdevice wacom-tablet"
-
- NFS_INSTANCE=`echo $TAP | sed 's/tap//'`
- export NFS_INSTANCE
-
- 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") ;;
- "qemuarmv7") ;;
- "vexpressa9") ;;
- "qemux86") ;;
- "qemux86-64") ;;
- "qemuzynq") ;;
- "akita") ;;
- "spitz") ;;
- *)
- echo "Error: Unsupported machine type $MACHINE"
- return 1
- ;;
-esac
-
-if [ ! -f "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then
- echo "Error: Kernel image file $KERNEL doesn't exist"
- cleanup
- return 1
-fi
-
-if [ "$FSTYPE" != "nfs" -a "$FSTYPE" != "vmdk" -a ! -f "$ROOTFS" ]; then
- echo "Error: Image file $ROOTFS doesn't exist"
- cleanup
- return 1
-fi
-
-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 + 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
-
- # Start the userspace NFS server
- echo "runqemu-export-rootfs restart $ROOTFS"
- runqemu-export-rootfs restart $ROOTFS
- if [ $? != 0 ]; then
- return 1
- fi
- NFSRUNNING="true"
-fi
-
-if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarmv7" \
- -o "$MACHINE" = "vexpressa9" ]; then
- QEMU=qemu-system-arm
- 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:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
- if [ "$MACHINE" = "vexpressa9" ]; then
- KERN_root="root=/dev/mmcblk0 vmalloc=384MB"
- QEMU_root="-sd $ROOTFS"
- else
- KERN_root="root=/dev/sda"
- QEMU_root="-hda $ROOTFS"
- fi
- KERNCMDLINE="${KERN_root} rw console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off"
- QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} ${QEMU_root} -no-reboot $QEMU_UI_OPTIONS"
- 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 1
- fi
- 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"
- elif [ "$MACHINE" = "qemuarmv7" ]; then
- QEMUOPTIONS="$QEMUOPTIONS -cpu cortex-a8"
- fi
-fi
-
-if [ "$MACHINE" = "qemuarm64" ]; then
- QEMU=qemu-system-aarch64
-
- export QEMU_AUDIO_DRV="none"
- 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-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 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"
-fi
-
-if [ "$MACHINE" = "qemux86-64" ]; then
- QEMU=qemu-system-x86_64
- 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
- ROOTFS=/srv/nfs/qemux86-64
- fi
- if [ ! -d "$ROOTFS" ]; 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 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
- 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.
- KERNCMDLINE="$KERNCMDLINE oprofile.timer=1"
-fi
-
-if [ "$MACHINE" = "spitz" ]; then
- QEMU=qemu-system-arm
- if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
- echo $ROOTFS
- ROOTFS=`readlink -f $ROOTFS`
- echo $ROOTFS
- if [ ! -e "$ROOTFS.qemudisk" ]; then
- echo "Adding a partition table to the ext3 image for use by QEMU, please wait..."
- runqemu-addptable2image $ROOTFS $ROOTFS.qemudisk
- fi
- QEMUOPTIONS="$QEMU_NETWORK_CMD -M spitz -hda $ROOTFS.qemudisk -portrait"
- fi
-fi
-
-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: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"
- 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=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
- QEMU=qemu-system-ppc
- 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 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 -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
- ROOTFS=`readlink -f $ROOTFS`
- if [ ! -e "$ROOTFS.qemuflash" ]; then
- echo "Converting raw image into flash image format for use by QEMU, please wait..."
- raw2flash.akita < $ROOTFS > $ROOTFS.qemuflash
- fi
- QEMUOPTIONS="$QEMU_NETWORK_CMD -M akita -mtdblock $ROOTFS.qemuflash -portrait"
- 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 1
-fi
-
-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 1
-fi
-
-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 1
-}
-
-trap do_quit INT TERM QUIT
-
-# qemu got segfault if linked with nVidia's libgl
-GL_LD_PRELOAD=$LD_PRELOAD
-
-if ldd $QEMUBIN | grep -i nvidia &> /dev/null
-then
-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 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
-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
- 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 [ "$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 $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
-
-#set the original stty values before exit
-stty ${ORIG_STTY}
-trap - INT TERM QUIT
-
-return $ret
diff --git a/scripts/uEnv.txt b/scripts/uEnv.txt
deleted file mode 100755
index ce65475..0000000
--- a/scripts/uEnv.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-bootenv=boot.scr
-loaduimage=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}
-mmcboot=echo Running boot.scr script from mmc ...; source ${loadaddr}