diff options
| -rwxr-xr-x | scripts/runqemu | 89 | ||||
| -rw-r--r-- | scripts/runqemu-internal | 129 | ||||
| -rwxr-xr-x | scripts/runqemu-standalone | 44 |
3 files changed, 214 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 | ||
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 | |||
diff --git a/scripts/runqemu-standalone b/scripts/runqemu-standalone new file mode 100755 index 0000000000..6e8218331e --- /dev/null +++ b/scripts/runqemu-standalone | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # Handle running Poky images standalone | ||
| 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 | if [ "x$1" = "x" ]; then | ||
| 20 | MYNAME=`basename $0` | ||
| 21 | echo -e "\nRun as MACHINE=xyz $MYNAME ZIMAGE IMAGEFILE" | ||
| 22 | echo "where:" | ||
| 23 | echo " ZIMAGE - the kernel image file to use" | ||
| 24 | echo " IMAGEFILE - the image file/location to use" | ||
| 25 | echo " (NFS booting assumed if IMAGEFILE not specified)" | ||
| 26 | echo " MACHINE=xyz - the machine name (optional, autodetected from ZIMAGE if unspecified)" | ||
| 27 | exit 1 | ||
| 28 | else | ||
| 29 | ZIMAGE=$1 | ||
| 30 | fi | ||
| 31 | |||
| 32 | if [ "x$2" = "x" ]; then | ||
| 33 | TYPE="nfs" | ||
| 34 | else | ||
| 35 | TYPE="ext2" | ||
| 36 | HDIMAGE=$2 | ||
| 37 | fi | ||
| 38 | |||
| 39 | if [ "x$MACHINE" = "x" ]; then | ||
| 40 | MACHINE=`basename $ZIMAGE | sed -e 's#.*-\([a-z]*\)-*[0-9]*..*#\1#'` | ||
| 41 | fi | ||
| 42 | |||
| 43 | source $OEROOT/scripts/runqemu-internal | ||
| 44 | |||
