From 7687d91f73f4a116593315b3b1488ac3f0904905 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 20 Apr 2011 16:44:10 +0100 Subject: Rename poky-qemu to runqemu Signed-off-by: Richard Purdie --- .../qemu/qemu-helper-nativesdk_1.0.bb | 10 +- scripts/oe-buildenv-internal | 2 +- scripts/poky-gen-tapdevs | 8 +- scripts/poky-qemu | 399 ----------------- scripts/poky-qemu-ifdown | 52 --- scripts/poky-qemu-ifup | 95 ----- scripts/poky-qemu-internal | 470 --------------------- scripts/poky-qemu.README | 90 ---- scripts/poky-setup-builddir | 2 +- scripts/qemuimage-testlib | 6 +- scripts/qemuimage-tests/sanity/boot | 2 +- scripts/qemuimage-tests/sanity/compiler | 2 +- scripts/qemuimage-tests/sanity/connman | 2 +- scripts/qemuimage-tests/sanity/dmesg | 2 +- scripts/qemuimage-tests/sanity/rpm_query | 2 +- scripts/qemuimage-tests/sanity/scp | 2 +- scripts/qemuimage-tests/sanity/shutdown | 2 +- scripts/qemuimage-tests/sanity/ssh | 2 +- scripts/qemuimage-tests/sanity/zypper_help | 2 +- scripts/qemuimage-tests/sanity/zypper_search | 2 +- scripts/runqemu | 399 +++++++++++++++++ scripts/runqemu-ifdown | 52 +++ scripts/runqemu-ifup | 95 +++++ scripts/runqemu-internal | 470 +++++++++++++++++++++ scripts/runqemu.README | 90 ++++ 25 files changed, 1130 insertions(+), 1130 deletions(-) delete mode 100755 scripts/poky-qemu delete mode 100755 scripts/poky-qemu-ifdown delete mode 100755 scripts/poky-qemu-ifup delete mode 100755 scripts/poky-qemu-internal delete mode 100644 scripts/poky-qemu.README create mode 100755 scripts/runqemu create mode 100755 scripts/runqemu-ifdown create mode 100755 scripts/runqemu-ifup create mode 100755 scripts/runqemu-internal create mode 100644 scripts/runqemu.README diff --git a/meta/recipes-devtools/qemu/qemu-helper-nativesdk_1.0.bb b/meta/recipes-devtools/qemu/qemu-helper-nativesdk_1.0.bb index 18d278db7..effcabaf4 100644 --- a/meta/recipes-devtools/qemu/qemu-helper-nativesdk_1.0.bb +++ b/meta/recipes-devtools/qemu/qemu-helper-nativesdk_1.0.bb @@ -6,15 +6,15 @@ PR = "r9" FILESPATH = "${FILE_DIRNAME}/qemu-helper" LIC_FILES_CHKSUM = "file://${WORKDIR}/tunctl.c;endline=4;md5=ff3a09996bc5fff6bc5d4e0b4c28f999 \ - file://${POKYBASE}/scripts/poky-qemu;endline=18;md5=ce52af3dd295e20ad1d849611b83690b" + file://${POKYBASE}/scripts/runqemu;endline=18;md5=ce52af3dd295e20ad1d849611b83690b" -SRC_URI = "file://${POKYBASE}/scripts/poky-qemu \ - file://${POKYBASE}/scripts/poky-qemu-internal \ +SRC_URI = "file://${POKYBASE}/scripts/runqemu \ + file://${POKYBASE}/scripts/runqemu-internal \ file://${POKYBASE}/scripts/poky-addptable2image \ file://${POKYBASE}/scripts/poky-gen-tapdevs \ - file://${POKYBASE}/scripts/poky-qemu-ifup \ - file://${POKYBASE}/scripts/poky-qemu-ifdown \ + file://${POKYBASE}/scripts/runqemu-ifup \ + file://${POKYBASE}/scripts/runqemu-ifdown \ file://${POKYBASE}/scripts/poky-find-native-sysroot \ file://${POKYBASE}/scripts/poky-extract-sdk \ file://${POKYBASE}/scripts/poky-export-rootfs \ diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal index 03b078f29..7e77e43df 100755 --- a/scripts/oe-buildenv-internal +++ b/scripts/oe-buildenv-internal @@ -51,7 +51,7 @@ fi PATH="${OEROOT}/scripts:$BITBAKEDIR/bin/:$PATH" unset BITBAKEDIR -# Used by the poky-qemu script +# Used by the runqemu script export BUILDDIR export PATH diff --git a/scripts/poky-gen-tapdevs b/scripts/poky-gen-tapdevs index 2117a7b08..527c01e7b 100755 --- a/scripts/poky-gen-tapdevs +++ b/scripts/poky-gen-tapdevs @@ -1,7 +1,7 @@ #!/bin/bash # # Create a "bank" of tap network devices that can be used by the -# poky-qemu script. This script needs to be run as root, and will +# runqemu script. This script needs to be run as root, and will # use the tunctl binary from a Poky 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 Poky's @@ -51,9 +51,9 @@ if [[ ! -x "$TUNCTL" || -d "$TUNCTL" ]]; then fi SCRIPT_DIR=`dirname $0` -POKY_QEMU_IFUP="$SCRIPT_DIR/poky-qemu-ifup" +POKY_QEMU_IFUP="$SCRIPT_DIR/runqemu-ifup" if [ ! -x "$POKY_QEMU_IFUP" ]; then - echo "Error: Unable to find the poky-qemu-ifup script in $SCRIPT_DIR" + echo "Error: Unable to find the runqemu-ifup script in $SCRIPT_DIR" exit 1 fi @@ -79,7 +79,7 @@ for ((index=0; index < $COUNT; index++)); do fi done -# The poky-qemu script will check for this file, and if it exists, +# The runqemu script will check for this file, and if it exists, # will use the existing bank of tap devices without creating # additional ones via sudo. touch /etc/poky-nosudo diff --git a/scripts/poky-qemu b/scripts/poky-qemu deleted file mode 100755 index c76b3ab7b..000000000 --- a/scripts/poky-qemu +++ /dev/null @@ -1,399 +0,0 @@ -#!/bin/bash -# -# Handle running Poky images standalone with QEMU -# -# Copyright (C) 2006-2010 Intel Corp. -# -# 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=xyz - the machine name (optional, autodetected from KERNEL filename if unspecified)" - echo " Additional 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 " \"\" - enables extra qemu options, excluding serial and kvm" - echo "" - echo "Examples:" - echo " $MYNAME qemuarm" - echo " $MYNAME qemux86-64 poky-image-sato ext3" - echo " $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial" - echo " $MYNAME qemux86 \"<-m 256>\"" - exit 1 -} - -if [ "x$1" = "x" ]; then - usage -fi - -MACHINE=${MACHINE:=""} -KERNEL="" -FSTYPE="" -ROOTFS="" -LAZY_ROOTFS="" -SCRIPT_QEMU_OPT="" -SCRIPT_QEMU_EXTRA_OPT="" -SCRIPT_KERNEL_OPT="" - -TMPDIR="" - -# 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" ]]; 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 -} - -# 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") - if [ -z "$MACHINE" ]; then - MACHINE=$arg - else - echo "Error: conflicting MACHINE types [$MACHINE] and [$arg]" - usage - fi - ;; - "ext2" | "ext3" | "jffs2" | "nfs") - if [[ -z "$FSTYPE" || "$FSTYPE" == "$arg" ]]; then - FSTYPE=$arg - else - echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]" - usage - fi - ;; - *-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 - else - echo "Error: conflicting ROOTFS args [$ROOTFS] and [$arg]" - usage - fi - ;; - "nographic") - SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic" - ;; - "serial") - SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio" - SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0" - ;; - "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."; - 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` - ;; - \<*\>) - SCRIPT_QEMU_EXTRA_OPT=$arg - serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'` - kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'` - echo "$kvm_option" - if [[ ! -z "$serial_option" || ! -z "$kvm_option" ]]; then - echo "Error: Please use serial or kvm params instead!" - usage - fi - ;; - *) - # A directory name is an nfs rootfs - if [ -d "$arg" ]; then - echo "Assuming $arg is an nfs rootfs" - if [[ -z "$FSTYPE" || "$FSTYPE" == "nfs" ]]; then - FSTYPE=nfs - else - echo "Error: conflicting FSTYPE types [$arg] and nfs" - usage - fi - - if [ -z "$ROOTFS" ]; then - ROOTFS=$arg - else - echo "Error: conflicting ROOTFS args [$ROOTFS] and [$arg]" - usage - fi - elif [ -f "$arg" ]; then - process_filename $arg - else - echo "Error: unable to classify arg [$arg]" - usage - fi - ;; - esac - i=$((i + 1)) -done - -POKY_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu" -# 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"; - echo "$POKY_KVM_WIKI"; - exit 1; - fi - if [[ "x$MACHINE" != "xqemux86" && "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 "$POKY_KVM_WIKI"; - exit 1; - fi - if 9<>/dev/kvm ; then - SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm" - else - echo "You have no rights on /dev/kvm. Pls. change the owndership as described at"; - echo "$POKY_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 - 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_ROOTFS="poky-image-sato-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" - -QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin -QEMUX86_64_DEFAULT_FSTYPE=ext3 -QEMUX86_64_DEFAULT_ROOTFS="poky-image-sato-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" - -QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin -QEMUARM_DEFAULT_FSTYPE=ext3 -QEMUARM_DEFAULT_ROOTFS="poky-image-sato-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" - -QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin -QEMUMIPS_DEFAULT_FSTYPE=ext3 -QEMUMIPS_DEFAULT_ROOTFS="poky-image-sato-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" - -QEMUPPC_DEFAULT_KERNEL=zImage-qemuppc.bin -QEMUPPC_DEFAULT_FSTYPE=ext3 -QEMUPPC_DEFAULT_ROOTFS="poky-image-sato-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" - -AKITA_DEFAULT_KERNEL=zImage-akita.bin -AKITA_DEFAULT_FSTYPE=jffs2 -AKITA_DEFAULT_ROOTFS="poky-image-sato" - -SPITZ_DEFAULT_KERNEL=zImage-spitz.bin -SPITZ_DEFAULT_FSTYPE=ext3 -SPITZ_DEFAULT_ROOTFS="poky-image-sato" - -setup_tmpdir() { - if [ -z "$TMPDIR" ]; then - if [ "x$BUILDDIR" = "x" -o ! -d "$BUILDDIR/tmp" ]; then - # BUILDDIR unset, try and get 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 poky-init-build-env"; - 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` - else - TMPDIR=$BUILDDIR/tmp - fi - fi -} - -setup_sysroot() { - # Toolchain installs set up $POKY_NATIVE_SYSROOT in their - # environment script. If that variable isn't set, we're - # either in an in-tree poky scenario or the environment - # script wasn't source'd. - if [ -z "$POKY_NATIVE_SYSROOT" ]; then - setup_tmpdir - BUILD_ARCH=`uname -m` - BUILD_OS=`uname | tr '[A-Z]' '[a-z]'` - BUILD_SYS="$BUILD_ARCH-$BUILD_OS" - - POKY_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS - fi -} - -# Locate a rootfs image based on defaults defined above -findimage() { - where=$1 - machine=$2 - extension=$3 - names=$4 - - for name in $names; do - fullname=$where/$name-$machine.$extension - if [ -e "$fullname" ]; then - ROOTFS=$fullname - return - fi - done - - echo "Couldn't find image in $where. Attempted image names were:" - for name in $names; do - echo $name-$machine.$extension - done - - exit 1 -} - -if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then - # Extract the filename extension - EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'` - if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || - "x$EXT" == "xjffs2" ]]; 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=$TMPDIR/deploy/images/$kernel_file - - if [ -z "$KERNEL" ]; then - echo "Error: Unable to determine default kernel for MACHINE [$MACHINE]" - usage - fi -fi -# KERNEL is now set for all cases - -if [ -z "$FSTYPE" ]; then - eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE - - if [ -z "$FSTYPE" ]; then - echo "Error: Unable to determine default fstype for MACHINE [$MACHINE]" - usage - fi -fi -# FSTYPE is now set for all cases - -# Handle cases where a ROOTFS type is given instead of a filename, e.g. -# poky-image-sato -if [ "$LAZY_ROOTFS" = "true" ]; then - setup_tmpdir - echo "Assuming $ROOTFS really means $TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE" - ROOTFS=$TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE -fi - -if [ -z "$ROOTFS" ]; then - setup_tmpdir - T=$TMPDIR/deploy/images - eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS - findimage $T $MACHINE $FSTYPE "$rootfs_list" - - if [ -z "$ROOTFS" ]; then - echo "Error: Unable to determine default rootfs for MACHINE [$MACHINE]" - usage - 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 -# POKY_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' - -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; -fi - -INTERNAL_SCRIPT=`which poky-qemu-internal` - -. $INTERNAL_SCRIPT diff --git a/scripts/poky-qemu-ifdown b/scripts/poky-qemu-ifdown deleted file mode 100755 index bc90a9c12..000000000 --- a/scripts/poky-qemu-ifdown +++ /dev/null @@ -1,52 +0,0 @@ -#!/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 a Poky 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: -# -# ALL=NOPASSWD: /path/to/poky-qemu-ifup -# ALL=NOPASSWD: /path/to/poky-qemu-ifdown -# -# Copyright (c) 2006-2010 Intel Corp. -# -# 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) " -} - -if [ $EUID -ne 0 ]; then - echo "Error: This script (poky-qemu-ifdown) must be run with root privileges" - exit 1 -fi - -if [ $# -ne 2 ]; then - usage - exit 1 -fi - -TAP=$1 -NATIVE_SYSROOT_DIR=$2 - -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/scripts/poky-qemu-ifup b/scripts/poky-qemu-ifup deleted file mode 100755 index f82848ccc..000000000 --- a/scripts/poky-qemu-ifup +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -# -# QEMU network interface configuration script. This utility needs to -# be run as root, and will use the tunctl binary from a Poky 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 Poky'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: -# -# ALL=NOPASSWD: /path/to/poky-qemu-ifup -# ALL=NOPASSWD: /path/to/poky-qemu-ifdown -# -# If you'd like to create a bank of tap devices at once, you should use -# the poky-gen-tapdevs script instead. If tap devices are set up using -# that script, the poky-qemu script will never end up calling this -# script. -# -# Copyright (c) 2006-2010 Intel Corp. -# -# 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) " -} - -if [ $EUID -ne 0 ]; then - echo "Error: This script (poky-qemu-ifup) must be run with root privileges" - exit 1 -fi - -if [ $# -ne 2 ]; then - usage - exit 1 -fi - -GROUP="-g $1" -NATIVE_SYSROOT_DIR=$2 - -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 - echo "tunctl failed:" - echo $TAP - exit 1 -fi - -IFCONFIG=`which ifconfig` -if [ "x$IFCONFIG" = "x" ]; then - # better than nothing... - IFCONFIG=/sbin/ifconfig -fi - -ROUTE=`which route` -if [ "x$ROUTE" = "x" ]; then - # better than nothing... - ROUTE=/sbin/route -fi - -n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] -$IFCONFIG $TAP 192.168.7.$n - -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=`which iptables` -if [ "x$IPTABLES" = "x" ]; then - IPTABLES=/sbin/iptables -fi - -$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24 -echo 1 > /proc/sys/net/ipv4/ip_forward -$IPTABLES -P FORWARD ACCEPT - -echo $TAP diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal deleted file mode 100755 index c88d71178..000000000 --- a/scripts/poky-qemu-internal +++ /dev/null @@ -1,470 +0,0 @@ -#!/bin/bash -x - -# Handle running Poky images under qemu -# -# Copyright (C) 2006-2008 OpenedHand Ltd. -# -# 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///'` -#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") - mem_size=128 - ;; - "qemuppc") - mem_size=128 - ;; - *) - mem_size=64 - ;; - esac - -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" ]; 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/" ` - fi -fi - -# We need to specify -m 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 poky-gen-tapdevs creates a bank of tap -# devices, indicating that the user should not bring up new ones using -# sudo. -NOSUDO_FLAG="/etc/poky-nosudo" - -QEMUIFUP=`which poky-qemu-ifup` -QEMUIFDOWN=`which poky-qemu-ifdown` - -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 - 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` -if [ -z "$IFCONFIG" ]; then - IFCONFIG=/sbin/ifconfig -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` - echo "Setting up tap interface under sudo" - tap=`sudo $QEMUIFUP $GROUPID $POKY_NATIVE_SYSROOT` - if [ $? -ne 0 ]; then - # Re-run standalone to see verbose errors - sudo $QEMUIFUP $GROUPID $POKY_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 - sudo $QEMUIFDOWN $TAP $POKY_NATIVE_SYSROOT - fi - echo "Releasing lockfile of preconfigured tap device '$TAP'" - release_lock $LOCKFILE - - if [ "$NFSRUNNING" = "true" ]; then - echo "Shutting down the userspace NFS server..." - echo "poky-export-rootfs stop $ROOTFS" - poky-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 -} - -n1=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] -n2=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] - -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" -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") ;; - "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_PORT=$[ 21111 + $NFS_INSTANCE ] - NFSD_PORT=$[ 11111 + $NFS_INSTANCE ] - UNFS_OPTS="nfsvers=2,mountprog=$MOUNTD_PORT,nfsprog=$NFSD_PORT,udp" - - PSEUDO_LOCALSTATEDIR=~/.poky-sdk/pseudo - export PSEUDO_LOCALSTATEDIR - - rpcbind_running=`ps ax | grep rpcbind | grep -v grep | wc -l` - portmap_running=`ps ax | grep portmap | grep -v grep | wc -l` - if [[ $rpcbind_running == 0 && $portmap_running == 0 ]]; then - echo "You need to be running either rpcbind or portmap to continue" - cleanup - return - fi - - # Start the userspace NFS server - echo "poky-export-rootfs restart $ROOTFS" - poky-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" ]; then - KERNCMDLINE="root=/dev/sda rw console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off" - QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb -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 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 - QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware -enable-gl" - if [ "$FSTYPE" = "ext3" ]; then - KERNCMDLINE="vga=0 root=/dev/hda rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" - QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $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 - 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 -enable-gl" - if [ "$FSTYPE" = "ext3" ]; then - KERNCMDLINE="vga=0 root=/dev/hda rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" - QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $ROOTFS $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" ]; 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..." - poky-addptable2image $ROOTFS $ROOTFS.qemudisk - fi - QEMUOPTIONS="$QEMU_NETWORK_CMD -M spitz -hda $ROOTFS.qemudisk -portrait" - fi -fi - -if [ "$MACHINE" = "qemumips" ]; then - QEMU=qemu-system-mips - MACHINE_SUBTYPE=malta - QEMU_UI_OPTIONS="-vga cirrus $QEMU_UI_OPTIONS" - if [ "$FSTYPE" = "ext3" ]; 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=prep - CPU_SUBTYPE=603e - BIOS=powerpc_rom.bin - QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -nographic" - if [ "$FSTYPE" = "ext3" ]; then - KERNCMDLINE="root=/dev/hda rw console=ttyS0 console=tty0 $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" - 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=tty0 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" - 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$QEMUOPTIONS" = "x" ]; then - echo "Error: Unable to support this combination of options" - cleanup - return -fi - -PATH=$CROSSPATH:$POKY_NATIVE_SYSROOT/usr/bin:$PATH - -QEMUBIN=`which $QEMU` -if [ ! -x "$QEMUBIN" ]; then - echo "Error: No QEMU binary '$QEMU' could be found." - cleanup - return -fi - -function _quit() { - if [ -n "$PIDFILE" ]; then - #echo kill `cat $PIDFILE` - kill `cat $PIDFILE` - fi - cleanup - return -} - -DISTCCD=`which distccd` -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 - -# qemu got segfault if linked with nVidia's libgl -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. -EOM -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'"' -$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" - - -cleanup - -trap - INT TERM QUIT -return diff --git a/scripts/poky-qemu.README b/scripts/poky-qemu.README deleted file mode 100644 index ecceae978..000000000 --- a/scripts/poky-qemu.README +++ /dev/null @@ -1,90 +0,0 @@ -Poky images with QEMU -===================== - -Poky can generate qemu bootable kernels and images with can be used -on a desktop system. Both arm and x86 images can currently be booted. -There are two scripts, runqemu and poky-qemu, one for use within poky, -the other externally. - -QEMU outside Poky (poky-qemu) -============================= - -The poky-qemu script is run as: - - MACHINE= poky-qemu - -where: - - is the path to a kernel (e.g. zimage-qemuarm.bin) - is the path to an ext2 image (e.g. filesystem-qemuarm.ext2) - is "qemuarm" or "qemux86" - -The MACHINE= prefix is optional and without it the script will try -to detect the machine name from the name of the file. - -If isn't specified, nfs booting will be assumed. - - -QEMU within Poky (runqemu) -========================== - -The runqemu script is run as: - - runqemu - -where: - - is "qemuarm","qemux86","nokia800","spitz" or "akita" - is "ext2", "nfs", "ext3" or "jffs2". (not all machines support all options) - is the path to a kernel (e.g. zimage-qemuarm.bin) - is the path to the image (e.g. filesystem-qemuarm.ext2) - -It will default to the qemuarm, ext2 and the last kernel and poky-image-sdk -image built by poky. - - -Notes -===== - - - The scripts run qemu using sudo. Change perms on /dev/net/tun to - run as non root - - You can access the host computer at 192.168.7.1 within the image. - - Your qemu system will be accessible as 192.16.7.2. - - The default NFS mount points are /srv/nfs/qemux86 or /srv/nfs/qemuarm - depending on the target type. - - Images built for qemux86/qemuarm contain NFS server which export whole - rootfs (/) in read/write mode. - - You can set QEMU_MEMORY to control amount of available memory (default 64M). - - You can set SERIAL_LOGFILE to have the serial output from the image logged - to a file. - - -NFS Image Notes -=============== - -As root; - -% apt-get install nfs-kernel-server - -% mkdir /srv/nfs/qemuarm - -Edit via /etc/exports : - -# /etc/exports: the access control list for filesystems which may be exported -# to NFS clients. See exports(5). -/srv/nfs/qemuarm 192.168.7.2(rw,no_root_squash) - -% /etc/init.d/nfs-kernel-server restart - -% modprobe tun - -untar build/tmp/deploy/images/.rootfs.tar.bz2 into /srv/nfs/qemuarm - -Finally, launch: - -% runqemu nfs - -(Substitute qemux86 for qemuarm when using qemux86) - - - Copyright (C) 2006-2008 OpenedHand Ltd. diff --git a/scripts/poky-setup-builddir b/scripts/poky-setup-builddir index b8a6dd95a..563d8e940 100755 --- a/scripts/poky-setup-builddir +++ b/scripts/poky-setup-builddir @@ -108,6 +108,6 @@ Common targets are: meta-toolchain meta-toolchain-sdk -You can also run generated qemu images with a command like 'poky-qemu qemux86' +You can also run generated qemu images with a command like 'runqemu qemux86' EOM diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib index 720ee8f40..c3cf7c1ec 100644 --- a/scripts/qemuimage-testlib +++ b/scripts/qemuimage-testlib @@ -395,11 +395,11 @@ Test_Create_Qemu() local ret=1 local up_time=0 - which poky-qemu + which runqemu if [ $? -eq 0 ]; then - RUNQEMU=`which poky-qemu` + RUNQEMU=`which runqemu` else - Test_Error "Can not find poky-qemu in \$PATH, return fail" + Test_Error "Can not find runqemu in \$PATH, return fail" exit 1 fi diff --git a/scripts/qemuimage-tests/sanity/boot b/scripts/qemuimage-tests/sanity/boot index b75b9b928..d3414d33d 100755 --- a/scripts/qemuimage-tests/sanity/boot +++ b/scripts/qemuimage-tests/sanity/boot @@ -1,7 +1,7 @@ #!/bin/bash # # Boot Test Case for Sanity Test -# The case boot up the Qemu target with `poky-qemu qemuxxx`. +# The case boot up the Qemu target with `runqemu qemuxxx`. # Then check if qemu and qemu network is up. # # Author: Jiajun Xu diff --git a/scripts/qemuimage-tests/sanity/compiler b/scripts/qemuimage-tests/sanity/compiler index 29dbfd9bb..d224f3357 100755 --- a/scripts/qemuimage-tests/sanity/compiler +++ b/scripts/qemuimage-tests/sanity/compiler @@ -1,6 +1,6 @@ #!/bin/bash # Compiler Test Case for Sanity Test -# The case boot up the Qemu target with `poky-qemu qemuxxx`. +# The case boot up the Qemu target with `runqemu qemuxxx`. # Then check if gcc/g++/make command can work in target. # # Author: Jiajun Xu diff --git a/scripts/qemuimage-tests/sanity/connman b/scripts/qemuimage-tests/sanity/connman index fca6a2784..d46ef0a89 100755 --- a/scripts/qemuimage-tests/sanity/connman +++ b/scripts/qemuimage-tests/sanity/connman @@ -1,6 +1,6 @@ #!/bin/bash # Conmman Check Test Case for Sanity Test -# The case boot up the Qemu target with `poky-qemu qemuxxx`. +# The case boot up the Qemu target with `runqemu qemuxxx`. # Then check if connman can work in target. # # Author: Jiajun Xu diff --git a/scripts/qemuimage-tests/sanity/dmesg b/scripts/qemuimage-tests/sanity/dmesg index 5ed31b735..06a99485c 100755 --- a/scripts/qemuimage-tests/sanity/dmesg +++ b/scripts/qemuimage-tests/sanity/dmesg @@ -1,6 +1,6 @@ #!/bin/bash # Dmesg Check Test Case for Sanity Test -# The case boot up the Qemu target with `poky-qemu qemuxxx`. +# The case boot up the Qemu target with `runqemu qemuxxx`. # Then check if there is any error log in dmesg. # # Author: Jiajun Xu diff --git a/scripts/qemuimage-tests/sanity/rpm_query b/scripts/qemuimage-tests/sanity/rpm_query index 08017ffbe..d42c4c49b 100755 --- a/scripts/qemuimage-tests/sanity/rpm_query +++ b/scripts/qemuimage-tests/sanity/rpm_query @@ -1,6 +1,6 @@ #!/bin/bash # RPM Check Test Case for Sanity Test -# The case boot up the Qemu target with `poky-qemu qemuxxx`. +# The case boot up the Qemu target with `runqemu qemuxxx`. # Then check if rpm command can work in target. # # Author: Jiajun Xu diff --git a/scripts/qemuimage-tests/sanity/scp b/scripts/qemuimage-tests/sanity/scp index c72cdc9d6..ce7279cdf 100755 --- a/scripts/qemuimage-tests/sanity/scp +++ b/scripts/qemuimage-tests/sanity/scp @@ -1,6 +1,6 @@ #!/bin/bash # SCP Test Case for Sanity Test -# The case boot up the Qemu target with `poky-qemu qemuxxx`. +# The case boot up the Qemu target with `runqemu qemuxxx`. # Then check if file can be copied into target with scp command. # # Author: Jiajun Xu diff --git a/scripts/qemuimage-tests/sanity/shutdown b/scripts/qemuimage-tests/sanity/shutdown index bc08cf0fd..22662ab25 100755 --- a/scripts/qemuimage-tests/sanity/shutdown +++ b/scripts/qemuimage-tests/sanity/shutdown @@ -1,6 +1,6 @@ #!/bin/bash # Shutdown Test Case for Sanity Test -# The case boot up the Qemu target with `poky-qemu qemuxxx`. +# The case boot up the Qemu target with `runqemu qemuxxx`. # Then check if target can shutdown # For qemux86/x86-64, we use command "poweroff" for target shutdown # For non-x86 targets, we use command "reboot" for target shutdown diff --git a/scripts/qemuimage-tests/sanity/ssh b/scripts/qemuimage-tests/sanity/ssh index 2a0e93439..e4a20dc73 100755 --- a/scripts/qemuimage-tests/sanity/ssh +++ b/scripts/qemuimage-tests/sanity/ssh @@ -1,6 +1,6 @@ #!/bin/bash # SSH Test Case for Sanity Test -# The case boot up the Qemu target with `poky-qemu qemuxxx`. +# The case boot up the Qemu target with `runqemu qemuxxx`. # Then check if ssh service in qemu is up. # # Author: Jiajun Xu diff --git a/scripts/qemuimage-tests/sanity/zypper_help b/scripts/qemuimage-tests/sanity/zypper_help index 1ab6d2407..6dafe5e1f 100755 --- a/scripts/qemuimage-tests/sanity/zypper_help +++ b/scripts/qemuimage-tests/sanity/zypper_help @@ -1,6 +1,6 @@ #!/bin/bash # Zypper Check Test Case for Sanity Test -# The case boot up the Qemu target with `poky-qemu qemuxxx`. +# The case boot up the Qemu target with `runqemu qemuxxx`. # Then check if zypper command can work in target. # # Author: Jiajun Xu diff --git a/scripts/qemuimage-tests/sanity/zypper_search b/scripts/qemuimage-tests/sanity/zypper_search index d6bcd27a3..b96cbdad6 100755 --- a/scripts/qemuimage-tests/sanity/zypper_search +++ b/scripts/qemuimage-tests/sanity/zypper_search @@ -1,6 +1,6 @@ #!/bin/bash # Zypper Check Test Case for Sanity Test -# The case boot up the Qemu target with `poky-qemu qemuxxx`. +# The case boot up the Qemu target with `runqemu qemuxxx`. # Then check if zypper command can work in target. # # Author: Jiajun Xu diff --git a/scripts/runqemu b/scripts/runqemu new file mode 100755 index 000000000..d155b561f --- /dev/null +++ b/scripts/runqemu @@ -0,0 +1,399 @@ +#!/bin/bash +# +# Handle running Poky images standalone with QEMU +# +# Copyright (C) 2006-2010 Intel Corp. +# +# 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=xyz - the machine name (optional, autodetected from KERNEL filename if unspecified)" + echo " Additional 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 " \"\" - enables extra qemu options, excluding serial and kvm" + echo "" + echo "Examples:" + echo " $MYNAME qemuarm" + echo " $MYNAME qemux86-64 poky-image-sato ext3" + echo " $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial" + echo " $MYNAME qemux86 \"<-m 256>\"" + exit 1 +} + +if [ "x$1" = "x" ]; then + usage +fi + +MACHINE=${MACHINE:=""} +KERNEL="" +FSTYPE="" +ROOTFS="" +LAZY_ROOTFS="" +SCRIPT_QEMU_OPT="" +SCRIPT_QEMU_EXTRA_OPT="" +SCRIPT_KERNEL_OPT="" + +TMPDIR="" + +# 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" ]]; 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 +} + +# 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") + if [ -z "$MACHINE" ]; then + MACHINE=$arg + else + echo "Error: conflicting MACHINE types [$MACHINE] and [$arg]" + usage + fi + ;; + "ext2" | "ext3" | "jffs2" | "nfs") + if [[ -z "$FSTYPE" || "$FSTYPE" == "$arg" ]]; then + FSTYPE=$arg + else + echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]" + usage + fi + ;; + *-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 + else + echo "Error: conflicting ROOTFS args [$ROOTFS] and [$arg]" + usage + fi + ;; + "nographic") + SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic" + ;; + "serial") + SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio" + SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0" + ;; + "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."; + 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` + ;; + \<*\>) + SCRIPT_QEMU_EXTRA_OPT=$arg + serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'` + kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'` + echo "$kvm_option" + if [[ ! -z "$serial_option" || ! -z "$kvm_option" ]]; then + echo "Error: Please use serial or kvm params instead!" + usage + fi + ;; + *) + # A directory name is an nfs rootfs + if [ -d "$arg" ]; then + echo "Assuming $arg is an nfs rootfs" + if [[ -z "$FSTYPE" || "$FSTYPE" == "nfs" ]]; then + FSTYPE=nfs + else + echo "Error: conflicting FSTYPE types [$arg] and nfs" + usage + fi + + if [ -z "$ROOTFS" ]; then + ROOTFS=$arg + else + echo "Error: conflicting ROOTFS args [$ROOTFS] and [$arg]" + usage + fi + elif [ -f "$arg" ]; then + process_filename $arg + else + echo "Error: unable to classify arg [$arg]" + usage + fi + ;; + esac + i=$((i + 1)) +done + +POKY_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu" +# 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"; + echo "$POKY_KVM_WIKI"; + exit 1; + fi + if [[ "x$MACHINE" != "xqemux86" && "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 "$POKY_KVM_WIKI"; + exit 1; + fi + if 9<>/dev/kvm ; then + SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm" + else + echo "You have no rights on /dev/kvm. Pls. change the owndership as described at"; + echo "$POKY_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 + 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_ROOTFS="poky-image-sato-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" + +QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin +QEMUX86_64_DEFAULT_FSTYPE=ext3 +QEMUX86_64_DEFAULT_ROOTFS="poky-image-sato-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" + +QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin +QEMUARM_DEFAULT_FSTYPE=ext3 +QEMUARM_DEFAULT_ROOTFS="poky-image-sato-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" + +QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin +QEMUMIPS_DEFAULT_FSTYPE=ext3 +QEMUMIPS_DEFAULT_ROOTFS="poky-image-sato-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" + +QEMUPPC_DEFAULT_KERNEL=zImage-qemuppc.bin +QEMUPPC_DEFAULT_FSTYPE=ext3 +QEMUPPC_DEFAULT_ROOTFS="poky-image-sato-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" + +AKITA_DEFAULT_KERNEL=zImage-akita.bin +AKITA_DEFAULT_FSTYPE=jffs2 +AKITA_DEFAULT_ROOTFS="poky-image-sato" + +SPITZ_DEFAULT_KERNEL=zImage-spitz.bin +SPITZ_DEFAULT_FSTYPE=ext3 +SPITZ_DEFAULT_ROOTFS="poky-image-sato" + +setup_tmpdir() { + if [ -z "$TMPDIR" ]; then + if [ "x$BUILDDIR" = "x" -o ! -d "$BUILDDIR/tmp" ]; then + # BUILDDIR unset, try and get 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 TMPDIR from bitbake + TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2` + else + TMPDIR=$BUILDDIR/tmp + fi + fi +} + +setup_sysroot() { + # Toolchain installs set up $POKY_NATIVE_SYSROOT in their + # environment script. If that variable isn't set, we're + # either in an in-tree poky scenario or the environment + # script wasn't source'd. + if [ -z "$POKY_NATIVE_SYSROOT" ]; then + setup_tmpdir + BUILD_ARCH=`uname -m` + BUILD_OS=`uname | tr '[A-Z]' '[a-z]'` + BUILD_SYS="$BUILD_ARCH-$BUILD_OS" + + POKY_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS + fi +} + +# Locate a rootfs image based on defaults defined above +findimage() { + where=$1 + machine=$2 + extension=$3 + names=$4 + + for name in $names; do + fullname=$where/$name-$machine.$extension + if [ -e "$fullname" ]; then + ROOTFS=$fullname + return + fi + done + + echo "Couldn't find image in $where. Attempted image names were:" + for name in $names; do + echo $name-$machine.$extension + done + + exit 1 +} + +if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then + # Extract the filename extension + EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'` + if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || + "x$EXT" == "xjffs2" ]]; 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=$TMPDIR/deploy/images/$kernel_file + + if [ -z "$KERNEL" ]; then + echo "Error: Unable to determine default kernel for MACHINE [$MACHINE]" + usage + fi +fi +# KERNEL is now set for all cases + +if [ -z "$FSTYPE" ]; then + eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE + + if [ -z "$FSTYPE" ]; then + echo "Error: Unable to determine default fstype for MACHINE [$MACHINE]" + usage + fi +fi +# FSTYPE is now set for all cases + +# Handle cases where a ROOTFS type is given instead of a filename, e.g. +# poky-image-sato +if [ "$LAZY_ROOTFS" = "true" ]; then + setup_tmpdir + echo "Assuming $ROOTFS really means $TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE" + ROOTFS=$TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE +fi + +if [ -z "$ROOTFS" ]; then + setup_tmpdir + T=$TMPDIR/deploy/images + eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS + findimage $T $MACHINE $FSTYPE "$rootfs_list" + + if [ -z "$ROOTFS" ]; then + echo "Error: Unable to determine default rootfs for MACHINE [$MACHINE]" + usage + 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 +# POKY_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' + +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; +fi + +INTERNAL_SCRIPT=`which runqemu-internal` + +. $INTERNAL_SCRIPT diff --git a/scripts/runqemu-ifdown b/scripts/runqemu-ifdown new file mode 100755 index 000000000..99613416c --- /dev/null +++ b/scripts/runqemu-ifdown @@ -0,0 +1,52 @@ +#!/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 a Poky 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: +# +# ALL=NOPASSWD: /path/to/runqemu-ifup +# ALL=NOPASSWD: /path/to/runqemu-ifdown +# +# Copyright (c) 2006-2010 Intel Corp. +# +# 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) " +} + +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 + +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/scripts/runqemu-ifup b/scripts/runqemu-ifup new file mode 100755 index 000000000..c963af5df --- /dev/null +++ b/scripts/runqemu-ifup @@ -0,0 +1,95 @@ +#!/bin/bash +# +# QEMU network interface configuration script. This utility needs to +# be run as root, and will use the tunctl binary from a Poky 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 Poky'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: +# +# ALL=NOPASSWD: /path/to/runqemu-ifup +# ALL=NOPASSWD: /path/to/runqemu-ifdown +# +# If you'd like to create a bank of tap devices at once, you should use +# the poky-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-2010 Intel Corp. +# +# 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) " +} + +if [ $EUID -ne 0 ]; then + echo "Error: This script (runqemu-ifup) must be run with root privileges" + exit 1 +fi + +if [ $# -ne 2 ]; then + usage + exit 1 +fi + +GROUP="-g $1" +NATIVE_SYSROOT_DIR=$2 + +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 + echo "tunctl failed:" + echo $TAP + exit 1 +fi + +IFCONFIG=`which ifconfig` +if [ "x$IFCONFIG" = "x" ]; then + # better than nothing... + IFCONFIG=/sbin/ifconfig +fi + +ROUTE=`which route` +if [ "x$ROUTE" = "x" ]; then + # better than nothing... + ROUTE=/sbin/route +fi + +n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] +$IFCONFIG $TAP 192.168.7.$n + +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=`which iptables` +if [ "x$IPTABLES" = "x" ]; then + IPTABLES=/sbin/iptables +fi + +$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24 +echo 1 > /proc/sys/net/ipv4/ip_forward +$IPTABLES -P FORWARD ACCEPT + +echo $TAP diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal new file mode 100755 index 000000000..206e1cfe8 --- /dev/null +++ b/scripts/runqemu-internal @@ -0,0 +1,470 @@ +#!/bin/bash -x + +# Handle running Poky images under qemu +# +# Copyright (C) 2006-2008 OpenedHand Ltd. +# +# 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///'` +#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") + mem_size=128 + ;; + "qemuppc") + mem_size=128 + ;; + *) + mem_size=64 + ;; + esac + +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" ]; 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/" ` + fi +fi + +# We need to specify -m 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 poky-gen-tapdevs creates a bank of tap +# devices, indicating that the user should not bring up new ones using +# sudo. +NOSUDO_FLAG="/etc/poky-nosudo" + +QEMUIFUP=`which runqemu-ifup` +QEMUIFDOWN=`which runqemu-ifdown` + +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 + 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` +if [ -z "$IFCONFIG" ]; then + IFCONFIG=/sbin/ifconfig +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` + echo "Setting up tap interface under sudo" + tap=`sudo $QEMUIFUP $GROUPID $POKY_NATIVE_SYSROOT` + if [ $? -ne 0 ]; then + # Re-run standalone to see verbose errors + sudo $QEMUIFUP $GROUPID $POKY_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 + sudo $QEMUIFDOWN $TAP $POKY_NATIVE_SYSROOT + fi + echo "Releasing lockfile of preconfigured tap device '$TAP'" + release_lock $LOCKFILE + + if [ "$NFSRUNNING" = "true" ]; then + echo "Shutting down the userspace NFS server..." + echo "poky-export-rootfs stop $ROOTFS" + poky-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 +} + +n1=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] +n2=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ] + +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" +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") ;; + "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_PORT=$[ 21111 + $NFS_INSTANCE ] + NFSD_PORT=$[ 11111 + $NFS_INSTANCE ] + UNFS_OPTS="nfsvers=2,mountprog=$MOUNTD_PORT,nfsprog=$NFSD_PORT,udp" + + PSEUDO_LOCALSTATEDIR=~/.poky-sdk/pseudo + export PSEUDO_LOCALSTATEDIR + + rpcbind_running=`ps ax | grep rpcbind | grep -v grep | wc -l` + portmap_running=`ps ax | grep portmap | grep -v grep | wc -l` + if [[ $rpcbind_running == 0 && $portmap_running == 0 ]]; then + echo "You need to be running either rpcbind or portmap to continue" + cleanup + return + fi + + # Start the userspace NFS server + echo "poky-export-rootfs restart $ROOTFS" + poky-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" ]; then + KERNCMDLINE="root=/dev/sda rw console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off" + QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb -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 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 + QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware -enable-gl" + if [ "$FSTYPE" = "ext3" ]; then + KERNCMDLINE="vga=0 root=/dev/hda rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" + QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $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 + 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 -enable-gl" + if [ "$FSTYPE" = "ext3" ]; then + KERNCMDLINE="vga=0 root=/dev/hda rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" + QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $ROOTFS $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" ]; 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..." + poky-addptable2image $ROOTFS $ROOTFS.qemudisk + fi + QEMUOPTIONS="$QEMU_NETWORK_CMD -M spitz -hda $ROOTFS.qemudisk -portrait" + fi +fi + +if [ "$MACHINE" = "qemumips" ]; then + QEMU=qemu-system-mips + MACHINE_SUBTYPE=malta + QEMU_UI_OPTIONS="-vga cirrus $QEMU_UI_OPTIONS" + if [ "$FSTYPE" = "ext3" ]; 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=prep + CPU_SUBTYPE=603e + BIOS=powerpc_rom.bin + QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -nographic" + if [ "$FSTYPE" = "ext3" ]; then + KERNCMDLINE="root=/dev/hda rw console=ttyS0 console=tty0 $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" + 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=tty0 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" + 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$QEMUOPTIONS" = "x" ]; then + echo "Error: Unable to support this combination of options" + cleanup + return +fi + +PATH=$CROSSPATH:$POKY_NATIVE_SYSROOT/usr/bin:$PATH + +QEMUBIN=`which $QEMU` +if [ ! -x "$QEMUBIN" ]; then + echo "Error: No QEMU binary '$QEMU' could be found." + cleanup + return +fi + +function _quit() { + if [ -n "$PIDFILE" ]; then + #echo kill `cat $PIDFILE` + kill `cat $PIDFILE` + fi + cleanup + return +} + +DISTCCD=`which distccd` +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 + +# qemu got segfault if linked with nVidia's libgl +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. +EOM +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'"' +$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" + + +cleanup + +trap - INT TERM QUIT +return diff --git a/scripts/runqemu.README b/scripts/runqemu.README new file mode 100644 index 000000000..12f1191ab --- /dev/null +++ b/scripts/runqemu.README @@ -0,0 +1,90 @@ +Poky images with QEMU +===================== + +Poky can generate qemu bootable kernels and images with can be used +on a desktop system. Both arm and x86 images can currently be booted. +There are two scripts, runqemu and runqemu, one for use within poky, +the other externally. + +QEMU outside Poky (runqemu) +============================= + +The runqemu script is run as: + + MACHINE= runqemu + +where: + + is the path to a kernel (e.g. zimage-qemuarm.bin) + is the path to an ext2 image (e.g. filesystem-qemuarm.ext2) + is "qemuarm" or "qemux86" + +The MACHINE= prefix is optional and without it the script will try +to detect the machine name from the name of the file. + +If isn't specified, nfs booting will be assumed. + + +QEMU within Poky (runqemu) +========================== + +The runqemu script is run as: + + runqemu + +where: + + is "qemuarm","qemux86","nokia800","spitz" or "akita" + is "ext2", "nfs", "ext3" or "jffs2". (not all machines support all options) + is the path to a kernel (e.g. zimage-qemuarm.bin) + is the path to the image (e.g. filesystem-qemuarm.ext2) + +It will default to the qemuarm, ext2 and the last kernel and poky-image-sdk +image built by poky. + + +Notes +===== + + - The scripts run qemu using sudo. Change perms on /dev/net/tun to + run as non root + - You can access the host computer at 192.168.7.1 within the image. + - Your qemu system will be accessible as 192.16.7.2. + - The default NFS mount points are /srv/nfs/qemux86 or /srv/nfs/qemuarm + depending on the target type. + - Images built for qemux86/qemuarm contain NFS server which export whole + rootfs (/) in read/write mode. + - You can set QEMU_MEMORY to control amount of available memory (default 64M). + - You can set SERIAL_LOGFILE to have the serial output from the image logged + to a file. + + +NFS Image Notes +=============== + +As root; + +% apt-get install nfs-kernel-server + +% mkdir /srv/nfs/qemuarm + +Edit via /etc/exports : + +# /etc/exports: the access control list for filesystems which may be exported +# to NFS clients. See exports(5). +/srv/nfs/qemuarm 192.168.7.2(rw,no_root_squash) + +% /etc/init.d/nfs-kernel-server restart + +% modprobe tun + +untar build/tmp/deploy/images/.rootfs.tar.bz2 into /srv/nfs/qemuarm + +Finally, launch: + +% runqemu nfs + +(Substitute qemux86 for qemuarm when using qemux86) + + + Copyright (C) 2006-2008 OpenedHand Ltd. -- cgit v1.2.3