summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-01-16 12:23:08 +0000
committerRichard Purdie <richard@openedhand.com>2007-01-16 12:23:08 +0000
commit295818470acd4628df8c5de20a8843cb90171b5b (patch)
treeb4734ac58b2195b2b5e8399662df6fc953924533 /scripts/runqemu
parent5d4e6e72ccd5cf680c4924d10651745cf29b62ba (diff)
downloadpoky-295818470acd4628df8c5de20a8843cb90171b5b.tar.gz
runqemu: Revamp scripts, splitting into a core internal script and two helpers, one for use within poky, one outside poky
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1144 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-xscripts/runqemu89
1 files changed, 41 insertions, 48 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 63ea856b65..433ceb7e35 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1,4 +1,20 @@
1#!/bin/sh 1#!/bin/sh
2#
3# Handle Poky <-> QEmu interface voodoo
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 2 as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program; if not, write to the Free Software Foundation, Inc.,
16# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17#
2 18
3if [ "x$BUILDDIR" = "x" ]; then 19if [ "x$BUILDDIR" = "x" ]; then
4 echo "You need to source poky-init-build-env before running this script" 20 echo "You need to source poky-init-build-env before running this script"
@@ -7,17 +23,21 @@ fi
7 23
8PATH=$BUILDDIR/tmp/staging/$BUILD_SYS/bin:$BUILDDIR/tmp/cross/bin:$PATH 24PATH=$BUILDDIR/tmp/staging/$BUILD_SYS/bin:$BUILDDIR/tmp/cross/bin:$PATH
9 25
10KERNEL_NETWORK_CMD="ip=192.168.7.2::192.168.7.1:255.255.255.0"
11QEMU_NETWORK_CMD="-net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=$OEROOT/scripts/qemu-ifup"
12
13if [ -z "$QEMU_MEMORY" ]; then 26if [ -z "$QEMU_MEMORY" ]; then
14 QEMU_MEMORY="64M" 27 QEMU_MEMORY="64M"
15fi 28fi
16 29
17if [ "x$1" != "x" ]; then 30if [ "x$1" = "x" ]; then
18 MACHINE=$1 31 echo
32 echo "Run as $0 MACHINE IMAGETYPE ZIMAGE IMAGEFILE"
33 echo "where:"
34 echo " MACHINE - the machine to emulate (qemuarm, qemux86)"
35 echo " IMAGETYPE - the type of image to run (ext2, nfs) (default: ext2)"
36 echo " ZIMAGE - the kernel to use (optional)"
37 echo " IMAGEFILE - the image file/location to use (optional)"
38 exit 1
19else 39else
20 MACHINE="qemuarm" 40 MACHINE=$1
21fi 41fi
22 42
23if [ "x$2" != "x" ]; then 43if [ "x$2" != "x" ]; then
@@ -35,18 +55,30 @@ if [ "x$4" != "x" ]; then
35fi 55fi
36 56
37if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o "$MACHINE" = "akita" ]; then 57if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o "$MACHINE" = "akita" ]; then
38 QEMU=`which qemu-system-arm`
39 if [ "x$ZIMAGE" = "x" ]; then 58 if [ "x$ZIMAGE" = "x" ]; then
40 ZIMAGE=$BUILDDIR/tmp/deploy/images/zImage-$MACHINE.bin 59 ZIMAGE=$BUILDDIR/tmp/deploy/images/zImage-$MACHINE.bin
41 fi 60 fi
42 CROSSPATH=$BUILDDIR/tmp/cross/arm-poky-linux/bin 61 CROSSPATH=$BUILDDIR/tmp/cross/arm-poky-linux/bin
43fi 62fi
44 63
64
65if [ "$MACHINE" = "qemuarm" ]; then
66 if [ "$TYPE" = "ext2" ]; then
67 if [ "x$HDIMAGE" = "x" ]; then
68 HDIMAGE=$BUILDDIR/tmp/deploy/images/oh-image-sdk-qemuarm.ext2
69 fi
70 fi
71fi
72
45if [ "$MACHINE" = "qemux86" ]; then 73if [ "$MACHINE" = "qemux86" ]; then
46 QEMU=`which qemu`
47 if [ "x$ZIMAGE" = "x" ]; then 74 if [ "x$ZIMAGE" = "x" ]; then
48 ZIMAGE=$BUILDDIR/tmp/deploy/images/bzImage-$MACHINE.bin 75 ZIMAGE=$BUILDDIR/tmp/deploy/images/bzImage-$MACHINE.bin
49 fi 76 fi
77 if [ "$TYPE" = "ext2" ]; then
78 if [ "x$HDIMAGE" = "x" ]; then
79 HDIMAGE=$BUILDDIR/tmp/deploy/images/oh-image-pda-qemux86.ext2
80 fi
81 fi
50 CROSSPATH=$BUILDDIR/tmp/cross/i586-poky-linux/bin 82 CROSSPATH=$BUILDDIR/tmp/cross/i586-poky-linux/bin
51fi 83fi
52 84
@@ -58,54 +90,15 @@ fi
58 90
59DISTCCD=`which distccd` 91DISTCCD=`which distccd`
60 92
61
62if [ -x "$DISTCCD" ]; then 93if [ -x "$DISTCCD" ]; then
63 $DISTCCD --allow 192.168.7.2 --daemon 94 $DISTCCD --allow 192.168.7.2 --daemon
64else 95else
65 echo "Warning: distccd not present, no distcc support loaded" 96 echo "Warning: distccd not present, no distcc support loaded"
66fi 97fi
67 98
68if [ "$MACHINE" = "qemuarm" ]; then 99source $OEROOT/scripts/runqemu-internal
69 if [ "$TYPE" = "ext2" ]; then
70 if [ "x$HDIMAGE" = "x" ]; then
71 HDIMAGE=$BUILDDIR/tmp/deploy/images/oh-image-sdk-qemuarm.ext2
72 fi
73 QEMUOPTIONS="-append \"root=/dev/sda mem=$QEMU_MEMORY\" $QEMU_NETWORK_CMD -M versatilepb -hda $HDIMAGE -usb -usbdevice wacom-tablet"
74 fi
75 if [ "$TYPE" = "nfs" ]; then
76 dd if=/dev/zero of=/tmp/blank bs=1024 count=8192
77 QEMUOPTIONS="-append \"root=/dev/nfs nfsroot=192.168.7.1:/srv/nfs/qemuarm rw $KERNEL_NETWORK_CMD\" $QEMU_NETWORK_CMD -M versatilepb -hda /tmp/blank"
78 fi
79fi
80
81if [ "$MACHINE" = "qemux86" ]; then
82 if [ "$TYPE" = "ext2" ]; then
83 if [ "x$HDIMAGE" = "x" ]; then
84 HDIMAGE=$BUILDDIR/tmp/deploy/images/oh-image-pda-qemux86.ext2
85 fi
86 # video=vesafb:1024x768-32@86
87 QEMUOPTIONS="-std-vga -append \"root=/dev/hda mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD\" $QEMU_NETWORK_CMD -hda $HDIMAGE -usb -usbdevice wacom-tablet"
88 fi
89 if [ "$TYPE" = "nfs" ]; then
90 dd if=/dev/zero of=/tmp/blank bs=1024 count=8192
91 QEMUOPTIONS="-std-vga -append \"root=/dev/nfs nfsroot=192.168.7.1:/srv/nfs/qemux86 rw $KERNEL_NETWORK_CMD\" $QEMU_NETWORK_CMD -hda /tmp/blank"
92 fi
93fi
94
95if [ "x$QEMUOPTIONS" = "x" ]; then
96 echo "Sorry, unable to support this configuration"
97 exit 1
98fi
99
100echo "Running $QEMU using sudo..."
101echo "$QEMU -kernel $ZIMAGE $QEMUOPTIONS"
102sudo $QEMU -kernel $ZIMAGE $QEMUOPTIONS
103# -serial file:serial.log
104 100
105if [ -x "$DISTCCD" ]; then 101if [ -x "$DISTCCD" ]; then
106 killall distccd 102 killall distccd
107fi 103fi
108 104
109if [ -e /tmp/blank ]; then
110 rm /tmp/blank
111fi