summaryrefslogtreecommitdiffstats
path: root/scripts/poky-qemu-internal
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/poky-qemu-internal')
-rwxr-xr-xscripts/poky-qemu-internal129
1 files changed, 129 insertions, 0 deletions
diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal
new file mode 100755
index 0000000000..e13f1b6dbe
--- /dev/null
+++ b/scripts/poky-qemu-internal
@@ -0,0 +1,129 @@
1#!/bin/sh
2#
3# Handle running Poky images under qemu
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#
18#
19# Call setting:
20# QEMU_MEMORY (optional) set the amount of memory in the emualted system.
21# SERIAL_LOGFILE (optional) log the serial port output to a file
22#
23# Image options:
24# MACHINE - the machine to run
25# TYPE - the image type to run
26# ZIMAGE - the kernel image file to use
27# HDIMAGE - the disk image file to use
28#
29
30QEMUIFUP=`which poky-qemu-ifup`
31KERNEL_NETWORK_CMD="ip=192.168.7.2::192.168.7.1:255.255.255.0"
32QEMU_NETWORK_CMD="-net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=$QEMUIFUP"
33
34if [ -z "$QEMU_MEMORY" ]; then
35 QEMU_MEMORY="64M"
36fi
37
38SERIALOPTS=""
39if [ "x$SERIAL_LOGFILE" != "x" ]; then
40 SERIALOPTS="-serial file:$SERIAL_LOGFILE"
41fi
42
43if [ "$TYPE" != "nfs" -a ! -f "$HDIMAGE" ]; then
44 echo -e "\nError, image file $HDIMAGE doesn't exist"
45 exit 1
46fi
47
48if [ ! -f "$ZIMAGE" ]; then
49 echo -e "\nError, kernel image file $ZIMAGE doesn't exist"
50 exit 1
51fi
52
53if [ "$MACHINE" != "qemuarm" -a "$MACHINE" != "qemux86" ]; then
54 echo -e "\nError, unsupported machine type $MACHINE"
55 exit 1
56fi
57
58if [ "$MACHINE" = "qemuarm" ]; then
59 QEMU=`which qemu-system-arm`
60 if [ "$TYPE" = "ext2" ]; then
61 QEMUOPTIONS="-append \"root=/dev/sda console=ttyAMA0 console=tty0 mem=$QEMU_MEMORY\" $QEMU_NETWORK_CMD -M versatilepb -hda $HDIMAGE -usb -usbdevice wacom-tablet"
62 fi
63 if [ "$TYPE" = "nfs" ]; then
64 if [ "x$HDIMAGE" = "x" ]; then
65 HDIMAGE=/srv/nfs/qemuarm
66 fi
67 if [ ! -d "$HDIMAGE" ]; then
68 echo -e "\nError, NFS mount point $HDIMAGE doesn't exist"
69 exit 1
70 fi
71 QEMUOPTIONS="-append \"root=/dev/nfs nfsroot=192.168.7.1:$HDIMAGE rw $KERNEL_NETWORK_CMD\" $QEMU_NETWORK_CMD -M versatilepb"
72 fi
73fi
74
75if [ "$MACHINE" = "qemux86" ]; then
76 QEMU=`which qemu`
77 if [ "$TYPE" = "ext2" ]; then
78 QEMUOPTIONS="-std-vga -append \"root=/dev/hda mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD\" $QEMU_NETWORK_CMD -hda $HDIMAGE -usb -usbdevice wacom-tablet"
79 fi
80 if [ "$TYPE" = "nfs" ]; then
81 if [ "x$HDIMAGE" = "x" ]; then
82 HDIMAGE=/srv/nfs/qemux86
83 fi
84 if [ ! -d "$HDIMAGE" ]; then
85 echo -e "\nError, NFS mount point $HDIMAGE doesn't exist."
86 exit 1
87 fi
88 QEMUOPTIONS="-std-vga -append \"root=/dev/nfs nfsroot=192.168.7.1:$HDIMAGE rw $KERNEL_NETWORK_CMD\" $QEMU_NETWORK_CMD"
89 fi
90fi
91
92if [ "$MACHINE" = "spitz" ]; then
93 QEMU=`which qemu-system-arm`
94# QEMU=/usr/local/bin/qemu-system-arm
95# if [ "$TYPE" = "ext2" ]; then
96# if [ "x$HDIMAGE" = "x" ]; then
97# HDIMAGE=`readlink -f $BUILDDIR/tmp/deploy/images/oh-image-sdk-spitz.ext2`
98# if [ ! -e $HDIMAGE.mbr ]; then
99# cp $OEROOT/mbr.bin $HDIMAGE.mbr
100# cat $HDIMAGE >> $HDIMAGE.mbr
101# fi
102# HDIMAGE=$BUILDDIR/tmp/deploy/images/hdaimage.bin
103# fi
104# QEMUOPTIONS="-append \"root=/dev/sda mem=$QEMU_MEMORY\" $QEMU_NETWORK_CMD -M spitz -hda $HDIMAGE"
105# fi
106fi
107
108if [ "$MACHINE" = "akita" ]; then
109 QEMU=`which qemu-system-arm`
110# QEMU=/usr/local/bin/qemu-system-arm
111# if [ "$TYPE" = "ext2" ]; then
112# if [ "x$HDIMAGE" = "x" ]; then
113# HDIMAGE=$BUILDDIR/tmp/deploy/images/oh-image-sdk-akita.jffs2
114# HDIMAGE=$BUILDDIR/tmp/deploy/images/akita.test
115# fi
116# QEMUOPTIONS="$QEMU_NETWORK_CMD -M akita -hdd $HDIMAGE"
117# fi
118fi
119
120if [ "x$QEMUOPTIONS" = "x" ]; then
121 echo -e "\nError, unable to support this combination of options"
122 exit 1
123fi
124
125echo -e "\nRunning $QEMU using sudo..."
126echo "$QEMU -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS"
127sudo $QEMU -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS
128
129