diff options
| author | Richard Purdie <richard@openedhand.com> | 2007-01-16 12:23:08 +0000 |
|---|---|---|
| committer | Richard Purdie <richard@openedhand.com> | 2007-01-16 12:23:08 +0000 |
| commit | 295818470acd4628df8c5de20a8843cb90171b5b (patch) | |
| tree | b4734ac58b2195b2b5e8399662df6fc953924533 /scripts/runqemu-internal | |
| parent | 5d4e6e72ccd5cf680c4924d10651745cf29b62ba (diff) | |
| download | poky-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-internal')
| -rw-r--r-- | scripts/runqemu-internal | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal new file mode 100644 index 0000000000..1ad0ef34b8 --- /dev/null +++ b/scripts/runqemu-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 | |||
| 30 | QEMUIFUP=`which qemu-ifup` | ||
| 31 | KERNEL_NETWORK_CMD="ip=192.168.7.2::192.168.7.1:255.255.255.0" | ||
| 32 | QEMU_NETWORK_CMD="-net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=$QEMUIFUP" | ||
| 33 | |||
| 34 | if [ -z "$QEMU_MEMORY" ]; then | ||
| 35 | QEMU_MEMORY="64M" | ||
| 36 | fi | ||
| 37 | |||
| 38 | SERIALOPTS="" | ||
| 39 | if [ "x$SERIAL_LOGFILE" != "x" ]; then | ||
| 40 | SERIALOPTS="-serial file:$SERIAL_LOGFILE" | ||
| 41 | fi | ||
| 42 | |||
| 43 | if [ "$TYPE" != "nfs" -a ! -f "$HDIMAGE" ]; then | ||
| 44 | echo -e "\nError, image file $HDIMAGE doesn't exist" | ||
| 45 | exit 1 | ||
| 46 | fi | ||
| 47 | |||
| 48 | if [ ! -f "$ZIMAGE" ]; then | ||
| 49 | echo -e "\nError, kernel image file $ZIMAGE doesn't exist" | ||
| 50 | exit 1 | ||
| 51 | fi | ||
| 52 | |||
| 53 | if [ "$MACHINE" != "qemuarm" -a "$MACHINE" != "qemux86" ]; then | ||
| 54 | echo -e "\nError, unsupported machine type $MACHINE" | ||
| 55 | exit 1 | ||
| 56 | fi | ||
| 57 | |||
| 58 | if [ "$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 | ||
| 73 | fi | ||
| 74 | |||
| 75 | if [ "$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 | ||
| 90 | fi | ||
| 91 | |||
| 92 | if [ "$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 | ||
| 106 | fi | ||
| 107 | |||
| 108 | if [ "$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 | ||
| 118 | fi | ||
| 119 | |||
| 120 | if [ "x$QEMUOPTIONS" = "x" ]; then | ||
| 121 | echo -e "\nError, unable to support this combination of options" | ||
| 122 | exit 1 | ||
| 123 | fi | ||
| 124 | |||
| 125 | echo -e "\nRunning $QEMU using sudo..." | ||
| 126 | echo "$QEMU -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS" | ||
| 127 | sudo $QEMU -kernel $ZIMAGE $QEMUOPTIONS $SERIALOPTS | ||
| 128 | |||
| 129 | |||
