diff options
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-x | scripts/runqemu | 89 |
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 | ||
3 | if [ "x$BUILDDIR" = "x" ]; then | 19 | if [ "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 | ||
8 | PATH=$BUILDDIR/tmp/staging/$BUILD_SYS/bin:$BUILDDIR/tmp/cross/bin:$PATH | 24 | PATH=$BUILDDIR/tmp/staging/$BUILD_SYS/bin:$BUILDDIR/tmp/cross/bin:$PATH |
9 | 25 | ||
10 | KERNEL_NETWORK_CMD="ip=192.168.7.2::192.168.7.1:255.255.255.0" | ||
11 | QEMU_NETWORK_CMD="-net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=$OEROOT/scripts/qemu-ifup" | ||
12 | |||
13 | if [ -z "$QEMU_MEMORY" ]; then | 26 | if [ -z "$QEMU_MEMORY" ]; then |
14 | QEMU_MEMORY="64M" | 27 | QEMU_MEMORY="64M" |
15 | fi | 28 | fi |
16 | 29 | ||
17 | if [ "x$1" != "x" ]; then | 30 | if [ "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 | ||
19 | else | 39 | else |
20 | MACHINE="qemuarm" | 40 | MACHINE=$1 |
21 | fi | 41 | fi |
22 | 42 | ||
23 | if [ "x$2" != "x" ]; then | 43 | if [ "x$2" != "x" ]; then |
@@ -35,18 +55,30 @@ if [ "x$4" != "x" ]; then | |||
35 | fi | 55 | fi |
36 | 56 | ||
37 | if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o "$MACHINE" = "akita" ]; then | 57 | if [ "$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 |
43 | fi | 62 | fi |
44 | 63 | ||
64 | |||
65 | if [ "$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 | ||
71 | fi | ||
72 | |||
45 | if [ "$MACHINE" = "qemux86" ]; then | 73 | if [ "$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 |
51 | fi | 83 | fi |
52 | 84 | ||
@@ -58,54 +90,15 @@ fi | |||
58 | 90 | ||
59 | DISTCCD=`which distccd` | 91 | DISTCCD=`which distccd` |
60 | 92 | ||
61 | |||
62 | if [ -x "$DISTCCD" ]; then | 93 | if [ -x "$DISTCCD" ]; then |
63 | $DISTCCD --allow 192.168.7.2 --daemon | 94 | $DISTCCD --allow 192.168.7.2 --daemon |
64 | else | 95 | else |
65 | echo "Warning: distccd not present, no distcc support loaded" | 96 | echo "Warning: distccd not present, no distcc support loaded" |
66 | fi | 97 | fi |
67 | 98 | ||
68 | if [ "$MACHINE" = "qemuarm" ]; then | 99 | source $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 | ||
79 | fi | ||
80 | |||
81 | if [ "$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 | ||
93 | fi | ||
94 | |||
95 | if [ "x$QEMUOPTIONS" = "x" ]; then | ||
96 | echo "Sorry, unable to support this configuration" | ||
97 | exit 1 | ||
98 | fi | ||
99 | |||
100 | echo "Running $QEMU using sudo..." | ||
101 | echo "$QEMU -kernel $ZIMAGE $QEMUOPTIONS" | ||
102 | sudo $QEMU -kernel $ZIMAGE $QEMUOPTIONS | ||
103 | # -serial file:serial.log | ||
104 | 100 | ||
105 | if [ -x "$DISTCCD" ]; then | 101 | if [ -x "$DISTCCD" ]; then |
106 | killall distccd | 102 | killall distccd |
107 | fi | 103 | fi |
108 | 104 | ||
109 | if [ -e /tmp/blank ]; then | ||
110 | rm /tmp/blank | ||
111 | fi | ||