summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-12-05 12:36:46 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-12-05 12:36:46 +0000
commitb8cf5951e3191bbc8ad3118aa7d175eb1f603d66 (patch)
treea6b96c33cf9ca81b3db52cff1124bde4a3f11299
parent8b3eacda6249db97e8cbe0d1930eae14acc44270 (diff)
downloadgenivi-initial-setup-b8cf5951e3191bbc8ad3118aa7d175eb1f603d66.tar.gz
Add ARMv7 scripts, reorganise directories
-rw-r--r--armv7-versatile/README10
-rw-r--r--armv7-versatile/create-source-disk.sh18
-rwxr-xr-xarmv7-versatile/download-image.sh37
-rw-r--r--armv7-versatile/run-baserock-image.sh24
-rwxr-xr-xarmv7-versatile/runqemu424
-rw-r--r--armv7-versatile/runqemu-ifdown54
-rw-r--r--armv7-versatile/runqemu-ifup117
-rw-r--r--armv7-versatile/runqemu-internal572
-rwxr-xr-xx86_64-generic/create-vm (renamed from create-vm)0
-rwxr-xr-xx86_64-generic/devel-system-setup (renamed from devel-system-setup)0
-rwxr-xr-xx86_64-generic/request-trove-account (renamed from request-trove-account)0
-rwxr-xr-xx86_64-generic/run-image (renamed from run-image)0
12 files changed, 1256 insertions, 0 deletions
diff --git a/armv7-versatile/README b/armv7-versatile/README
new file mode 100644
index 0000000..7365ccf
--- /dev/null
+++ b/armv7-versatile/README
@@ -0,0 +1,10 @@
+This is a few scripts taken from Open Embedded and altered
+to work for the ARM Versatile Express target without having
+Open Embedded installed.
+
+A self-extracting script can be created with
+
+ makeself . run-arm-image.run "Baserock QEMU wrapper for ARMv7 Versatile Express" ./run-baserock-image.sh
+
+Running the command requires tunctl to be installed on the user's system,
+since it does not use Open Embedded's sysroot.
diff --git a/armv7-versatile/create-source-disk.sh b/armv7-versatile/create-source-disk.sh
new file mode 100644
index 0000000..aaeee82
--- /dev/null
+++ b/armv7-versatile/create-source-disk.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+set -e
+
+DIR="$1"
+
+if [[ -z "$DIR" ]]; then
+ echo "Usage: $0 <INSTALL DIR>"
+ exit 1
+fi
+
+cd "$DIR"
+
+SOURCE_DISK="devel-system-armv7-versatile.src.img"
+
+if [[ ! -f "$SOURCE_DISK" ]]; then
+ qemu-img create -f qcow2 "$SOURCE_DISK" 30G
+fi
diff --git a/armv7-versatile/download-image.sh b/armv7-versatile/download-image.sh
new file mode 100755
index 0000000..f283783
--- /dev/null
+++ b/armv7-versatile/download-image.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+set -e
+
+DIR="$1"
+
+if [[ -z "$DIR" ]]; then
+ echo "Usage: $0 <INSTALL DIR>"
+ exit 1
+fi
+
+COMPRESSED_IMAGE="devel-system-armv7-versatile.img.gz"
+DECOMPRESSED_IMAGE=${COMPRESSED_IMAGE/.gz/}
+KERNEL_IMAGE="devel-system-armv7-versatile.zimage"
+
+if [[ ! -d "$DIR" ]]; then
+ mkdir -p "$DIR"
+fi
+
+cd "$DIR"
+
+if [[ ! -f "$COMPRESSED_IMAGE" ]]; then
+ echo "Downloading development image..."
+ curl "http://download.baserock.org/baserock/$COMPRESSED_IMAGE" > \
+ "$COMPRESSED_IMAGE"
+fi
+
+if [[ -f "$KERNEL_IMAGE" ]]; then
+ echo "Downloading kernel image..."
+ curl "http://download.baserock.org/baserock/$KERNEL_IMAGE" > \
+ "$KERNEL_IMAGE"
+fi
+
+if [[ ! -f "$DECOMPRESSED_IMAGE" ]]; then
+ echo "Decompressing development image..."
+ gzip -cd "$COMPRESSED_IMAGE" > "$DECOMPRESSED_IMAGE"
+fi
diff --git a/armv7-versatile/run-baserock-image.sh b/armv7-versatile/run-baserock-image.sh
new file mode 100644
index 0000000..00d4921
--- /dev/null
+++ b/armv7-versatile/run-baserock-image.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+find_tunctl() {
+ for path in `which tunctl` /{usr/,usr/local/}{bin,sbin}/tunctl; do
+ if [ -x "$path" ]; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+if ! find_tunctl; then
+cat >&2 <<EOF
+Could not find tunctl executable in standard paths or PATH
+
+On Fedora it is in the tunctl package.
+On Ubuntu it is in the uml-utilities package.
+EOF
+fi
+
+MACHINE=qemuarmv7 PATH="$PATH:$(pwd)" OE_TMPDIR=/ KERNEL="$1" ROOTFS="$2" \
+ sh ./runqemu serial \
+ bootparams="rootflags=subvol=factory-run root=/dev/mmcblk0p1" \
+ btrfs qemuparams="-m 1024 -M vexpress-a9"
diff --git a/armv7-versatile/runqemu b/armv7-versatile/runqemu
new file mode 100755
index 0000000..fb7ac56
--- /dev/null
+++ b/armv7-versatile/runqemu
@@ -0,0 +1,424 @@
+#!/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 options (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 " 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 " 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 path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial"
+ echo " $MYNAME qemux86 ramfs"
+ echo " $MYNAME qemux86 qemuparams=\"-m 256\""
+ echo " $MYNAME qemux86 bootparams=\"psplash=false\""
+ exit 1
+}
+
+if [ "x$1" = "x" ]; then
+ usage
+fi
+
+error() {
+ echo "Error: "$*
+ usage
+}
+
+MACHINE=${MACHINE:=""}
+KERNEL=${KERNEL:=""}
+ROOTFS=${ROOTFS:=""}
+FSTYPE=""
+LAZY_ROOTFS=""
+SCRIPT_QEMU_OPT=""
+SCRIPT_QEMU_EXTRA_OPT=""
+SCRIPT_KERNEL_OPT=""
+
+# 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
+ ;;
+ *)
+ 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"
+while true; do
+ arg=${1}
+ case "$arg" in
+ "qemux86" | "qemux86-64" | "qemuarm" | "qemumips" | "qemumipsel" | "qemumips64" | "qemush4" | "qemuppc")
+ [ -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
+ ;;
+ "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"
+ ;;
+ "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\)'`
+ [ ! -z "$serial_option" -o ! -z "$kvm_option" ] && \
+ error "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\|smx' /proc/cpuinfo && echo 1`
+ ;;
+ "") 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
+done
+
+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" ]; then
+ error "you must specify at least a MACHINE or KERNEL argument"
+fi
+if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then
+ error "NFS booting without an explicit ROOTFS path is not yet supported"
+fi
+
+if [ -z "$MACHINE" ]; then
+ MACHINE=`basename $KERNEL | sed 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/'`
+ if [ -z "$MACHINE" ]; then
+ error "Unable to set MACHINE from kernel filename [$KERNEL]"
+ fi
+ echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]"
+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 -cpu host"
+ 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
+ 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
+
+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_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin
+QEMUX86_64_DEFAULT_FSTYPE=ext3
+
+QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin
+QEMUARM_DEFAULT_FSTYPE=ext3
+
+QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin
+QEMUMIPS_DEFAULT_FSTYPE=ext3
+
+QEMUMIPSEL_DEFAULT_KERNEL=vmlinux-qemumipsel.bin
+QEMUMIPSEL_DEFAULT_FSTYPE=ext3
+
+QEMUMIPS64_DEFAULT_KERNEL=vmlinux-qemumips64.bin
+QEMUMIPS64_DEFAULT_FSTYPE=ext3
+
+QEMUSH4_DEFAULT_KERNEL=vmlinux-qemumips.bin
+QEMUSH4_DEFAULT_FSTYPE=ext3
+
+QEMUPPC_DEFAULT_KERNEL=vmlinux-qemuppc.bin
+QEMUPPC_DEFAULT_FSTYPE=ext3
+
+AKITA_DEFAULT_KERNEL=zImage-akita.bin
+AKITA_DEFAULT_FSTYPE=jffs2
+
+SPITZ_DEFAULT_KERNEL=zImage-spitz.bin
+SPITZ_DEFAULT_FSTYPE=ext3
+
+setup_tmpdir() {
+ if [ -z "$OE_TMPDIR" ]; then
+ # Try to get OE_TMPDIR 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 OE_TMPDIR from bitbake
+ OE_TMPDIR=`MACHINE=$MACHINE bitbake -e | grep ^TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
+ if [ -z "$OE_TMPDIR" ]; then
+ # Check for errors from bitbake that the user needs to know about
+ BITBAKE_OUTPUT=`bitbake -e | wc -l`
+ if [ "$BITBAKE_OUTPUT" -eq "0" ]; then
+ echo "Error: this script needs to be run from your build directory,"
+ echo "or you need to explicitly set OE_TMPDIR in your environment"
+ else
+ echo "There was an error running bitbake to determine TMPDIR"
+ echo "Here is the output from 'bitbake -e':"
+ bitbake -e
+ fi
+ exit 1
+ fi
+ 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_tmpdir
+ 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.
+ filenames=`ls -t $where/*-image*$machine.$extension 2>/dev/null | xargs`
+ for name in $filenames; do
+ case $name in
+ *core-image-sato* | \
+ *core-image-lsb* | \
+ *core-image-basic* | \
+ *core-image-minimal* )
+ ROOTFS=$name
+ return
+ ;;
+ esac
+ done
+
+ 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" ]; 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" ]; then
+ setup_tmpdir
+ eval kernel_file=\$${machine2}_DEFAULT_KERNEL
+ KERNEL=$OE_TMPDIR/deploy/images/$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_tmpdir
+ echo "Assuming $ROOTFS really means $OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE"
+ ROOTFS=$OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE
+fi
+
+if [ -z "$ROOTFS" ]; then
+ setup_tmpdir
+ T=$OE_TMPDIR/deploy/images
+ 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
+
+echo ""
+echo "Continuing with the following parameters:"
+echo "KERNEL: [$KERNEL]"
+echo "ROOTFS: [$ROOTFS]"
+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
+
+. $INTERNAL_SCRIPT
diff --git a/armv7-versatile/runqemu-ifdown b/armv7-versatile/runqemu-ifdown
new file mode 100644
index 0000000..3fd776a
--- /dev/null
+++ b/armv7-versatile/runqemu-ifdown
@@ -0,0 +1,54 @@
+#!/bin/bash
+#
+# QEMU network configuration script to bring down tap devices. This
+# utility needs to be run as root, and will use the tunctl binary
+# from the native sysroot.
+#
+# If you find yourself calling this script a lot, you can add the
+# the following to your /etc/sudoers file to be able to run this
+# command without entering your password each time:
+#
+# <my-username> ALL=NOPASSWD: /path/to/runqemu-ifup
+# <my-username> ALL=NOPASSWD: /path/to/runqemu-ifdown
+#
+# 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() {
+ echo "sudo $(basename $0) <tap-dev> <native-sysroot-basedir>"
+}
+
+if [ $EUID -ne 0 ]; then
+ echo "Error: This script (runqemu-ifdown) must be run with root privileges"
+ exit 1
+fi
+
+if [ $# -ne 2 ]; then
+ usage
+ exit 1
+fi
+
+TAP=$1
+NATIVE_SYSROOT_DIR=$2
+
+# since this is not an open embedded install, expect the user to have tunctl
+TUNCTL=tunctl
+#TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl
+#if [ ! -e "$TUNCTL" ]; then
+# echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin'"
+# exit 1
+#fi
+
+$TUNCTL -d $TAP
diff --git a/armv7-versatile/runqemu-ifup b/armv7-versatile/runqemu-ifup
new file mode 100644
index 0000000..e361509
--- /dev/null
+++ b/armv7-versatile/runqemu-ifup
@@ -0,0 +1,117 @@
+#!/bin/bash
+#
+# QEMU network interface configuration script. This utility needs to
+# be run as root, and will use the tunctl binary from a native sysroot.
+# Note: many Linux distros these days still use an older version of
+# tunctl which does not support the group permissions option, hence
+# the need to use build system's version.
+#
+# If you find yourself calling this script a lot, you can add the
+# the following to your /etc/sudoers file to be able to run this
+# command without entering your password each time:
+#
+# <my-username> ALL=NOPASSWD: /path/to/runqemu-ifup
+# <my-username> ALL=NOPASSWD: /path/to/runqemu-ifdown
+#
+# If you'd like to create a bank of tap devices at once, you should use
+# the runqemu-gen-tapdevs script instead. If tap devices are set up using
+# that script, the runqemu script will never end up calling this
+# script.
+#
+# 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() {
+ echo "sudo $(basename $0) <uid> <gid> <native-sysroot-basedir>"
+}
+
+if [ $EUID -ne 0 ]; then
+ echo "Error: This script (runqemu-ifup) must be run with root privileges"
+ exit 1
+fi
+
+if [ $# -ne 3 ]; then
+ usage
+ exit 1
+fi
+
+USERID="-u $1"
+GROUP="-g $2"
+NATIVE_SYSROOT_DIR=$3
+
+# since this is not an open embedded install, expect the user to have tunctl
+TUNCTL=tunctl
+#TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl
+#if [ ! -x "$TUNCTL" ]; then
+# echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin'"
+# exit 1
+#fi
+
+TAP=`$TUNCTL -b $GROUP 2>&1`
+STATUS=$?
+if [ $STATUS -ne 0 ]; then
+# If tunctl -g fails, try using tunctl -u, for older host kernels
+# which do not support the TUNSETGROUP ioctl
+ TAP=`$TUNCTL -b $USERID 2>&1`
+ STATUS=$?
+ if [ $STATUS -ne 0 ]; then
+ echo "tunctl failed:"
+ exit 1
+ fi
+fi
+
+IFCONFIG=`which ifconfig 2> /dev/null`
+if [ "x$IFCONFIG" = "x" ]; then
+ # better than nothing...
+ IFCONFIG=/sbin/ifconfig
+fi
+if [ ! -x "$IFCONFIG" ]; then
+ echo "$IFCONFIG cannot be executed"
+ exit 1
+fi
+
+ROUTE=`which route`
+if [ "x$ROUTE" = "x" ]; then
+ # better than nothing...
+ ROUTE=/sbin/route
+fi
+if [ ! -x "$ROUTE" ]; then
+ echo "$ROUTE cannot be executed"
+ exit 1
+fi
+
+IPTABLES=`which iptables 2> /dev/null`
+if [ "x$IPTABLES" = "x" ]; then
+ IPTABLES=/sbin/iptables
+fi
+if [ ! -x "$IPTABLES" ]; then
+ echo "$IPTABLES cannot be executed"
+ exit 1
+fi
+
+n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
+$IFCONFIG $TAP 192.168.7.$n netmask 255.255.255.255
+
+dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
+$ROUTE add -host 192.168.7.$dest $TAP
+
+# setup NAT for tap0 interface to have internet access in QEMU
+$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$n/32
+$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.$dest/32
+echo 1 > /proc/sys/net/ipv4/ip_forward
+echo 1 > /proc/sys/net/ipv4/conf/$TAP/proxy_arp
+$IPTABLES -P FORWARD ACCEPT
+
+echo $TAP
diff --git a/armv7-versatile/runqemu-internal b/armv7-versatile/runqemu-internal
new file mode 100644
index 0000000..2738a5a
--- /dev/null
+++ b/armv7-versatile/runqemu-internal
@@ -0,0 +1,572 @@
+#!/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
+# CROSSPATH - the path to any cross toolchain to use with distcc
+#
+# 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=128
+ ;;
+ "qemux86-64")
+ mem_size=128
+ ;;
+ "qemuarm")
+ mem_size=128
+ ;;
+ "qemumips"|"qemumips64")
+ mem_size=128
+ ;;
+ "qemuppc")
+ mem_size=128
+ ;;
+ "qemush4")
+ 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"
+
+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 -eo 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
+ else
+ echo $$ > $lockfile.lock
+ 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
+}
+
+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
+
+POSSIBLE=`$IFCONFIG -a | grep '^tap' | awk '{print $1}' | sed s/://`
+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
+
+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
+
+ 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
+}
+
+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
+KERNCMDLINE="mem=$QEMU_MEMORY"
+# This doesn't work for vexpress
+# QEMU_UI_OPTIONS="-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
+
+case "$MACHINE" in
+ "qemuarm") ;;
+ "qemumips") ;;
+ "qemumipsel") ;;
+ "qemumips64") ;;
+ "qemush4") ;;
+ "qemuppc") ;;
+ "qemuarmv6") ;;
+ "qemuarmv7") ;;
+ "qemux86") ;;
+ "qemux86-64") ;;
+ "akita") ;;
+ "spitz") ;;
+ *)
+ echo "Error: Unsupported machine type $MACHINE"
+ return
+ ;;
+esac
+
+if [ ! -f "$KERNEL" ]; then
+ echo "Error: Kernel image file $KERNEL doesn't exist"
+ cleanup
+ return
+fi
+
+if [ "$FSTYPE" != "nfs" -a ! -f "$ROOTFS" ]; then
+ echo "Error: Image file $ROOTFS doesn't exist"
+ cleanup
+ return
+fi
+
+if [ "$FSTYPE" = "nfs" ]; then
+ NFS_SERVER="192.168.7.1"
+ NFS_DIR=`echo $ROOTFS | sed 's/^[^:]*:\(.*\)/\1/'`
+ 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=2,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,port=$NFSD_PORT,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
+ cleanup
+ return
+ 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
+ QEMU=qemu-system-arm
+ MACHINE_SUBTYPE=versatilepb
+ QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
+ # QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -force-pointer"
+ if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+ KERNCMDLINE="root=/dev/sda rw console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off"
+ # -hda does not have the driver, use -sd
+ #QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb -sd $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
+ fi
+ KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb --no-reboot $QEMU_UI_OPTIONS"
+ fi
+ if [ "$MACHINE" = "qemuarmv6" ]; then
+ QEMUOPTIONS="$QEMUOPTIONS -cpu arm1136"
+ fi
+ if [ "$MACHINE" = "qemuarmv7" ]; then
+ QEMUOPTIONS="$QEMUOPTIONS -cpu cortex-a8"
+ fi
+fi
+
+if [ "$MACHINE" = "qemux86" ]; then
+ QEMU=qemu-system-i386
+ QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware"
+ if [ "$FSTYPE" = "ext2" -o "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+ KERNCMDLINE="vga=0 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD $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
+ 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
+ # 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
+ QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware"
+ if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
+ KERNCMDLINE="vga=0 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
+ QEMUOPTIONS="$QEMU_NETWORK_CMD $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
+ 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
+ # 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" = "ext3" -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" = "ext3" -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
+ 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"
+ QEMU_NETWORK_CMD="-net nic,model=pcnet $QEMU_TAP_CMD"
+ if [ "$FSTYPE" = "ext3" -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
+ 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" = "ext3" -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"
+ 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
+ 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"
+ fi
+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 [ "x$RAMFS" = "xtrue" ]; then
+ QEMUOPTIONS="-initrd $ROOTFS -nographic"
+ KERNCMDLINE="root=/dev/ram0"
+fi
+
+if [ "x$QEMUOPTIONS" = "x" ]; then
+ echo "Error: Unable to support this combination of options"
+ cleanup
+ return
+fi
+
+if [ "x$CROSSPATH" = "x" ]; then
+ PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
+else
+ PATH=$CROSSPATH:$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
+fi
+
+QEMUBIN=`which $QEMU 2> /dev/null`
+if [ ! -x "$QEMUBIN" ]; then
+ echo "Error: No QEMU binary '$QEMU' could be found."
+ cleanup
+ return
+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."
+ exit 1;
+ fi
+fi
+
+do_quit() {
+ if [ -n "$PIDFILE" ]; then
+ #echo kill `cat $PIDFILE`
+ kill `cat $PIDFILE`
+ fi
+ cleanup
+ return
+}
+
+DISTCCD=`which distccd 2> /dev/null`
+PIDFILE=""
+
+trap do_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
+
+# 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
+
+echo "Running $QEMU..."
+# -no-reboot is a mandatory option - see bug #100
+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"
+
+
+cleanup
+
+trap - INT TERM QUIT
diff --git a/create-vm b/x86_64-generic/create-vm
index 84137e4..84137e4 100755
--- a/create-vm
+++ b/x86_64-generic/create-vm
diff --git a/devel-system-setup b/x86_64-generic/devel-system-setup
index a6f872e..a6f872e 100755
--- a/devel-system-setup
+++ b/x86_64-generic/devel-system-setup
diff --git a/request-trove-account b/x86_64-generic/request-trove-account
index 16fbafb..16fbafb 100755
--- a/request-trove-account
+++ b/x86_64-generic/request-trove-account
diff --git a/run-image b/x86_64-generic/run-image
index bf3dfa9..bf3dfa9 100755
--- a/run-image
+++ b/x86_64-generic/run-image