diff options
| author | Scott Garman <scott.a.garman@intel.com> | 2010-10-04 21:04:15 -0700 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-07 19:57:34 +0100 |
| commit | 0f973ed66551cdd1112ee9df42df5603835b8384 (patch) | |
| tree | 753442dd27a029749846a718353e1fba02a09e49 /scripts | |
| parent | e70c8981f250ead9e025ecd27aef94b67d784fc6 (diff) | |
| download | poky-0f973ed66551cdd1112ee9df42df5603835b8384.tar.gz | |
Merge runqemu features into poky-qemu
This merges the functionality of the runqemu script into poky-qemu.
It also removes the requirement to order command line args to poky-qemu
in any particular order.
This fixes a slew of runqemu-related bugs by making the runqemu script
obsolete (and fixing the issues in the new poky-qemu), including
[BUGID #294] [BUGID #295] [BUGID #371] and [BUGID #324].
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/poky-env-internal | 2 | ||||
| -rwxr-xr-x | scripts/poky-qemu | 280 | ||||
| -rwxr-xr-x | scripts/poky-qemu-internal | 26 | ||||
| -rwxr-xr-x | scripts/runqemu | 218 |
4 files changed, 264 insertions, 262 deletions
diff --git a/scripts/poky-env-internal b/scripts/poky-env-internal index 52747bf5c3..ae26cab7e4 100755 --- a/scripts/poky-env-internal +++ b/scripts/poky-env-internal | |||
| @@ -128,7 +128,7 @@ Common targets are: | |||
| 128 | meta-toolchain | 128 | meta-toolchain |
| 129 | meta-toolchain-sdk | 129 | meta-toolchain-sdk |
| 130 | 130 | ||
| 131 | You can also run generated qemu images with a command like 'runqemu qemux86' | 131 | You can also run generated qemu images with a command like 'poky-qemu qemux86' |
| 132 | 132 | ||
| 133 | EOM | 133 | EOM |
| 134 | 134 | ||
diff --git a/scripts/poky-qemu b/scripts/poky-qemu index 111aa15b70..ad4bdbf91c 100755 --- a/scripts/poky-qemu +++ b/scripts/poky-qemu | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | 2 | # | |
| 3 | # Handle running Poky images standalone with QEMU | 3 | # Handle running Poky images standalone with QEMU |
| 4 | # | 4 | # |
| 5 | # Copyright (C) 2006-2007 OpenedHand Ltd. | 5 | # Copyright (C) 2006-2010 Intel Corp. |
| 6 | # | 6 | # |
| 7 | # This program is free software; you can redistribute it and/or modify | 7 | # This program is free software; you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License version 2 as | 8 | # it under the terms of the GNU General Public License version 2 as |
| @@ -17,47 +17,267 @@ | |||
| 17 | # with this program; if not, write to the Free Software Foundation, Inc., | 17 | # with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | 19 | ||
| 20 | 20 | usage() { | |
| 21 | if [ "x$1" = "x" ]; then | ||
| 22 | MYNAME=`basename $0` | 21 | MYNAME=`basename $0` |
| 23 | echo "Run as MACHINE=xyz $MYNAME KERNEL ROOTFS [OPTIONS]" | 22 | echo "" |
| 24 | echo "where:" | 23 | echo "Usage: you can run this script with any valid combination" |
| 24 | echo "of the following options (in any order):" | ||
| 25 | echo " QEMUARCH - the qemu machine architecture to use" | ||
| 25 | echo " KERNEL - the kernel image file to use" | 26 | echo " KERNEL - the kernel image file to use" |
| 26 | echo " ROOTFS - the rootfs image file or nfsroot directory to use" | 27 | echo " ROOTFS - the rootfs image file or nfsroot directory to use" |
| 27 | # echo " (NFS booting assumed if ROOTFS not specified)" | ||
| 28 | echo " MACHINE=xyz - the machine name (optional, autodetected from KERNEL filename if unspecified)" | 28 | echo " MACHINE=xyz - the machine name (optional, autodetected from KERNEL filename if unspecified)" |
| 29 | echo " OPTIONS - extra options to pass to QEMU" | 29 | echo " Additional QEMU command-line options can be passed with:" |
| 30 | echo " serial - enables a serial console on /dev/ttyS0" | ||
| 31 | echo "" | ||
| 32 | echo "Examples:" | ||
| 33 | echo " $0 qemuarm" | ||
| 34 | echo " $0 qemux86-64 poky-image-sato ext3" | ||
| 35 | echo " $0 path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial" | ||
| 30 | exit 1 | 36 | exit 1 |
| 31 | else | 37 | } |
| 32 | KERNEL=$1 | 38 | |
| 33 | shift | 39 | if [ "x$1" = "x" ]; then |
| 40 | usage | ||
| 34 | fi | 41 | fi |
| 35 | 42 | ||
| 36 | if [ "x$MACHINE" = "x" ]; then | 43 | MACHINE=${MACHINE:=""} |
| 44 | KERNEL="" | ||
| 45 | FSTYPE="" | ||
| 46 | ROOTFS="" | ||
| 47 | SCRIPT_QEMU_OPT="" | ||
| 48 | SCRIPT_KERNEL_OPT="" | ||
| 49 | |||
| 50 | TMPDIR="" | ||
| 51 | |||
| 52 | # Parse command line args without requiring specific ordering. It's a | ||
| 53 | # bit more complex, but offers a great user experience. | ||
| 54 | i=1 | ||
| 55 | while [ $i -le $# ]; do | ||
| 56 | arg=${!i} | ||
| 57 | case $arg in | ||
| 58 | "qemux86" | "qemux86-64" | "qemuarm" | "qemumips" | "qemuppc") | ||
| 59 | if [ -z "$MACHINE" ]; then | ||
| 60 | MACHINE=$arg | ||
| 61 | else | ||
| 62 | echo "Error: conflicting MACHINE types [$MACHINE] and [$arg]" | ||
| 63 | usage | ||
| 64 | fi | ||
| 65 | ;; | ||
| 66 | "ext2" | "ext3" | "jffs2" | "nfs") | ||
| 67 | if [ -z "$FSTYPE" ]; then | ||
| 68 | FSTYPE=$arg | ||
| 69 | else | ||
| 70 | echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]" | ||
| 71 | usage | ||
| 72 | fi | ||
| 73 | ;; | ||
| 74 | *-image-*) | ||
| 75 | if [ -z "$ROOTFS" ]; then | ||
| 76 | ROOTFS=$arg | ||
| 77 | else | ||
| 78 | echo "Error: conflicting ROOTFS args [$ROOTFS] and [$arg]" | ||
| 79 | usage | ||
| 80 | fi | ||
| 81 | ;; | ||
| 82 | "serial") | ||
| 83 | # Will need to append to these variables when we | ||
| 84 | # accept more values | ||
| 85 | SCRIPT_QEMU_OPT="-serial stdio" | ||
| 86 | SCRIPT_KERNEL_OPT="console=ttyS0" | ||
| 87 | ;; | ||
| 88 | *) | ||
| 89 | # A directory name is an nfs rootfs | ||
| 90 | if [ -d "$arg" ]; then | ||
| 91 | echo "Assuming $arg is an nfs rootfs" | ||
| 92 | if [[ -z "$FSTYPE" || "$FSTYPE" == "nfs" ]]; then | ||
| 93 | FSTYPE=nfs | ||
| 94 | else | ||
| 95 | echo "Error: conflicting FSTYPE types [$arg] and nfs" | ||
| 96 | usage | ||
| 97 | fi | ||
| 98 | |||
| 99 | if [ -z "$ROOTFS" ]; then | ||
| 100 | ROOTFS=$arg | ||
| 101 | else | ||
| 102 | echo "Error: conflicting ROOTFS args [$ROOTFS] and [$arg]" | ||
| 103 | usage | ||
| 104 | fi | ||
| 105 | elif [ -f "$arg" ]; then | ||
| 106 | # Extract the filename extension | ||
| 107 | EXT=`echo $arg | awk -F . '{ print \$NF }'` | ||
| 108 | # A file ending in .bin is a kernel | ||
| 109 | if [ "x$EXT" = "xbin" ]; then | ||
| 110 | if [ -z "$KERNEL" ]; then | ||
| 111 | KERNEL=$arg | ||
| 112 | else | ||
| 113 | echo "Error: conflicting KERNEL args [$KERNEL] and [$arg]" | ||
| 114 | usage | ||
| 115 | fi | ||
| 116 | elif [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || | ||
| 117 | "x$EXT" == "xjffs2" ]]; then | ||
| 118 | # A file ending in a supportted fs type is a rootfs image | ||
| 119 | if [[ -z "$FSTYPE" || "$FSTYPE" == "$EXT" ]]; then | ||
| 120 | FSTYPE=$EXT | ||
| 121 | ROOTFS=$arg | ||
| 122 | else | ||
| 123 | echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]" | ||
| 124 | usage | ||
| 125 | fi | ||
| 126 | else | ||
| 127 | echo "Error: unknown file arg [$arg]" | ||
| 128 | usage | ||
| 129 | fi | ||
| 130 | else | ||
| 131 | echo "Error: unable to classify arg [$arg]" | ||
| 132 | usage | ||
| 133 | fi | ||
| 134 | ;; | ||
| 135 | esac | ||
| 136 | i=$((i + 1)) | ||
| 137 | done | ||
| 138 | |||
| 139 | # Report errors for missing combinations of options | ||
| 140 | if [[ -z "$MACHINE" && -z "$KERNEL" ]]; then | ||
| 141 | echo "Error: you must specify at least a MACHINE or KERNEL argument" | ||
| 142 | usage | ||
| 143 | fi | ||
| 144 | if [[ "$FSTYPE" == "nfs" && -z "$ROOTFS" ]]; then | ||
| 145 | echo "Error: NFS booting without an explicit ROOTFS path is not yet supported" | ||
| 146 | usage | ||
| 147 | fi | ||
| 148 | |||
| 149 | if [ -z "$MACHINE" ]; then | ||
| 37 | MACHINE=`basename $KERNEL | sed -r -e 's#.*-([a-z]+[0-9\-]*)-?[0-9]*..*#\1#'` | 150 | MACHINE=`basename $KERNEL | sed -r -e 's#.*-([a-z]+[0-9\-]*)-?[0-9]*..*#\1#'` |
| 151 | if [ -z "$MACHINE" ]; then | ||
| 152 | echo "Error: Unable to set MACHINE from kernel filename [$KERNEL]" | ||
| 153 | usage | ||
| 154 | fi | ||
| 155 | echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]" | ||
| 38 | fi | 156 | fi |
| 157 | machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'` | ||
| 158 | # MACHINE is now set for all cases | ||
| 39 | 159 | ||
| 40 | if [ "x$1" = "x" ]; then | 160 | # Defaults used when these vars need to be inferred |
| 41 | FSTYPE="nfs" | 161 | QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin |
| 42 | echo "Error: NFS booting without an explicit ROOTFS path is not yet supported" | 162 | QEMUX86_DEFAULT_FSTYPE=ext3 |
| 43 | exit 1 | 163 | QEMUX86_DEFAULT_ROOTFS="poky-image-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" |
| 44 | else | 164 | |
| 45 | ROOTFS=$1 | 165 | QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin |
| 46 | 166 | QEMUX86_64_DEFAULT_FSTYPE=ext3 | |
| 47 | if [ -d "$1" ]; then | 167 | QEMUX86_64_DEFAULT_ROOTFS="poky-image-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" |
| 48 | echo "$ROOTFS is a directory, assuming nfsroot" | 168 | |
| 49 | FSTYPE="nfs" | 169 | QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin |
| 50 | else | 170 | QEMUARM_DEFAULT_FSTYPE=ext3 |
| 51 | FSTYPE="ext3" | 171 | QEMUARM_DEFAULT_ROOTFS="poky-image-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" |
| 52 | EXT=${ROOTFS##.*} | 172 | |
| 53 | if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || | 173 | QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin |
| 54 | "x$EXT" == "xjffs2" ]]; then | 174 | QEMUMIPS_DEFAULT_FSTYPE=ext3 |
| 55 | FSTYPE=$EXT | 175 | QEMUMIPS_DEFAULT_ROOTFS="poky-image-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" |
| 176 | |||
| 177 | QEMUPPC_DEFAULT_KERNEL=zImage-qemuppc.bin | ||
| 178 | QEMUPPC_DEFAULT_FSTYPE=ext3 | ||
| 179 | QEMUPPC_DEFAULT_ROOTFS="poky-image-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" | ||
| 180 | |||
| 181 | AKITA_DEFAULT_KERNEL=zImage-akita.bin | ||
| 182 | AKITA_DEFAULT_FSTYPE=jffs2 | ||
| 183 | AKITA_DEFAULT_ROOTFS="poky-image-sato" | ||
| 184 | |||
| 185 | SPITZ_DEFAULT_KERNEL=zImage-spitz.bin | ||
| 186 | SPITZ_DEFAULT_FSTYPE=ext3 | ||
| 187 | SPITZ_DEFAULT_ROOTFS="poky-image-sato" | ||
| 188 | |||
| 189 | setup_tmpdir() { | ||
| 190 | if [ -z "$TMPDIR" ]; then | ||
| 191 | if [ "x$BUILDDIR" = "x" ]; then | ||
| 192 | # BUILDDIR unset, try and get TMPDIR from bitbake | ||
| 193 | type -P bitbake &>/dev/null || { | ||
| 194 | echo "In order for this script to dynamically infer paths"; | ||
| 195 | echo "to kernels or filesystem images, you either need"; | ||
| 196 | echo "bitbake in your PATH or to source poky-init-build-env"; | ||
| 197 | echo "before running this script" >&2; | ||
| 198 | exit 1; } | ||
| 199 | |||
| 200 | # We have bitbake in PATH, get TMPDIR and BUILD_SYS | ||
| 201 | # from the environment | ||
| 202 | TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2` | ||
| 203 | BUILD_SYS=`bitbake -e | grep BUILD_SYS=\" | cut -d '=' -f2 | cut -d '"' -f2` | ||
| 204 | else | ||
| 205 | BUILD_ARCH=`uname -m` | ||
| 206 | BUILD_OS=`uname | tr '[A-Z]' '[a-z]'` | ||
| 207 | BUILD_SYS="$BUILD_ARCH-$BUILD_OS" | ||
| 208 | TMPDIR=$BUILDDIR/tmp | ||
| 56 | fi | 209 | fi |
| 57 | echo "Using $FSTYPE as filesytem type for $ROOTFS" | 210 | if [ -z "$POKY_NATIVE_SYSROOT" ]; then |
| 211 | POKY_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS | ||
| 212 | fi | ||
| 213 | CROSSPATH=$POKY_NATIVE_SYSROOT/usr/bin | ||
| 214 | fi | ||
| 215 | } | ||
| 216 | |||
| 217 | # Locate a rootfs image based on defaults defined above | ||
| 218 | findimage() { | ||
| 219 | where=$1 | ||
| 220 | machine=$2 | ||
| 221 | extension=$3 | ||
| 222 | names=$4 | ||
| 223 | |||
| 224 | for name in $names; do | ||
| 225 | fullname=$where/$name-$machine.$extension | ||
| 226 | if [ -e "$fullname" ]; then | ||
| 227 | ROOTFS=$fullname | ||
| 228 | return | ||
| 229 | fi | ||
| 230 | done | ||
| 231 | |||
| 232 | echo "Couldn't find image in $where. Attempted image names were:" | ||
| 233 | for name in $names; do | ||
| 234 | echo $name-$machine.$extension | ||
| 235 | done | ||
| 236 | |||
| 237 | exit 1 | ||
| 238 | } | ||
| 239 | |||
| 240 | if [ -z "$KERNEL" ]; then | ||
| 241 | setup_tmpdir | ||
| 242 | eval kernel_file=\$${machine2}_DEFAULT_KERNEL | ||
| 243 | KERNEL=$TMPDIR/deploy/images/$kernel_file | ||
| 244 | |||
| 245 | if [ -z "$KERNEL" ]; then | ||
| 246 | echo "Error: Unable to determine default kernel for MACHINE [$MACHINE]" | ||
| 247 | usage | ||
| 248 | fi | ||
| 249 | fi | ||
| 250 | # KERNEL is now set for all cases | ||
| 251 | |||
| 252 | if [ -z "$FSTYPE" ]; then | ||
| 253 | setup_tmpdir | ||
| 254 | eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE | ||
| 255 | |||
| 256 | if [ -z "$FSTYPE" ]; then | ||
| 257 | echo "Error: Unable to determine default fstype for MACHINE [$MACHINE]" | ||
| 258 | usage | ||
| 58 | fi | 259 | fi |
| 59 | shift | ||
| 60 | fi | 260 | fi |
| 261 | # FSTYPE is now set for all cases | ||
| 262 | |||
| 263 | if [ -z "$ROOTFS" ]; then | ||
| 264 | setup_tmpdir | ||
| 265 | T=$TMPDIR/deploy/images | ||
| 266 | eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS | ||
| 267 | findimage $T $MACHINE $FSTYPE "$rootfs_list" | ||
| 268 | |||
| 269 | if [ -z "$ROOTFS" ]; then | ||
| 270 | echo "Error: Unable to determine default rootfs for MACHINE [$MACHINE]" | ||
| 271 | usage | ||
| 272 | fi | ||
| 273 | fi | ||
| 274 | # ROOTFS is now set for all cases | ||
| 275 | |||
| 276 | echo "" | ||
| 277 | echo "Continuing with the following parameters:" | ||
| 278 | echo "KERNEL: [$KERNEL]" | ||
| 279 | echo "ROOTFS: [$ROOTFS]" | ||
| 280 | echo "FSTYPE: [$FSTYPE]" | ||
| 61 | 281 | ||
| 62 | # We can't run without a libGL.so | 282 | # We can't run without a libGL.so |
| 63 | libgl='no' | 283 | libgl='no' |
diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal index 532b255da9..01c92ee980 100755 --- a/scripts/poky-qemu-internal +++ b/scripts/poky-qemu-internal | |||
| @@ -115,16 +115,16 @@ fi | |||
| 115 | 115 | ||
| 116 | release_lock() { | 116 | release_lock() { |
| 117 | if [ ! -e "$NOSUDO_FLAG" ]; then | 117 | if [ ! -e "$NOSUDO_FLAG" ]; then |
| 118 | $QEMUIFDOWN $TAP $POKY_NATIVE_SYSROOT | 118 | sudo $QEMUIFDOWN $TAP $POKY_NATIVE_SYSROOT |
| 119 | fi | ||
| 120 | echo "Releasing lockfile of preconfigured tap device '$TAP'" | ||
| 121 | lockfile-remove $LOCKFILE | ||
| 122 | |||
| 123 | if [ "$NFSRUNNING" = "true" ]; then | ||
| 124 | echo "Shutting down the userspace NFS server..." | ||
| 125 | echo "poky-export-rootfs stop $ROOTFS" | ||
| 126 | poky-export-rootfs stop $ROOTFS | ||
| 119 | fi | 127 | fi |
| 120 | echo "Releasing lockfile of preconfigured tap device '$TAP'" | ||
| 121 | lockfile-remove $LOCKFILE | ||
| 122 | |||
| 123 | if [ "$NFSRUNNING" = "true" ]; then | ||
| 124 | echo "Shutting down the userspace NFS server..." | ||
| 125 | echo "poky-export-rootfs stop $ROOTFS" | ||
| 126 | poky-export-rootfs stop $ROOTFS | ||
| 127 | fi | ||
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | n1=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] | 130 | n1=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ] |
| @@ -209,7 +209,7 @@ if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarm | |||
| 209 | if [ -e /proc/sys/vm/mmap_min_addr ]; then | 209 | if [ -e /proc/sys/vm/mmap_min_addr ]; then |
| 210 | if [ `cat /proc/sys/vm/mmap_min_addr` != "0" ]; then | 210 | if [ `cat /proc/sys/vm/mmap_min_addr` != "0" ]; then |
| 211 | echo "Error, please set /proc/sys/vm/mmap_min_addr to 0 since otherwise it can cause problems with QEMU" | 211 | echo "Error, please set /proc/sys/vm/mmap_min_addr to 0 since otherwise it can cause problems with QEMU" |
| 212 | return | 212 | return |
| 213 | fi | 213 | fi |
| 214 | fi | 214 | fi |
| 215 | 215 | ||
| @@ -295,7 +295,7 @@ if [ "$MACHINE" = "qemumips" ]; then | |||
| 295 | QEMU=qemu-system-mips | 295 | QEMU=qemu-system-mips |
| 296 | MACHINE_SUBTYPE=malta | 296 | MACHINE_SUBTYPE=malta |
| 297 | QEMU_UI_OPTIONS="-vga cirrus" | 297 | QEMU_UI_OPTIONS="-vga cirrus" |
| 298 | if [ "$TYPE" = "ext3" ]; then | 298 | if [ "$FSTYPE" = "ext3" ]; then |
| 299 | #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 299 | #KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 300 | KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" | 300 | KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY" |
| 301 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS" | 301 | QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS" |
| @@ -396,8 +396,8 @@ else | |||
| 396 | fi | 396 | fi |
| 397 | 397 | ||
| 398 | echo "Running $QEMU..." | 398 | echo "Running $QEMU..." |
| 399 | echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS $* --append '"'$KERNCMDLINE'"' | 399 | echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS $SCRIPT_QEMU_CMDLINE_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' |
| 400 | $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS $* --append "$KERNCMDLINE" || /bin/true | 400 | $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS $SCRIPT_QEMU_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" || /bin/true |
| 401 | 401 | ||
| 402 | release_lock | 402 | release_lock |
| 403 | 403 | ||
diff --git a/scripts/runqemu b/scripts/runqemu deleted file mode 100755 index 8a1c2120c2..0000000000 --- a/scripts/runqemu +++ /dev/null | |||
| @@ -1,218 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | # Handle Poky <-> QEmu interface voodoo | ||
| 4 | # | ||
| 5 | # Copyright (C) 2006-2007 OpenedHand Ltd. | ||
| 6 | # | ||
| 7 | # This program is free software; you can redistribute it and/or modify | ||
| 8 | # it under the terms of the GNU General Public License version 2 as | ||
| 9 | # published by the Free Software Foundation. | ||
| 10 | # | ||
| 11 | # This program is distributed in the hope that it will be useful, | ||
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | # GNU General Public License for more details. | ||
| 15 | # | ||
| 16 | # You should have received a copy of the GNU General Public License along | ||
| 17 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
| 18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | |||
| 20 | |||
| 21 | if [ "x$BUILDDIR" = "x" ]; then | ||
| 22 | # BUILDDIR unset, try and get TMPDIR from bitbake | ||
| 23 | type -P bitbake &>/dev/null || { | ||
| 24 | echo "You either need bitbake in your PATH or to source poky-init-build-env before running this script" >&2; exit 1; } | ||
| 25 | |||
| 26 | # we have bitbake in PATH, get TMPDIR and BUILD_SYS from the environment | ||
| 27 | TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2` | ||
| 28 | BUILD_SYS=`bitbake -e | grep BUILD_SYS=\" | cut -d '=' -f2 | cut -d '"' -f2` | ||
| 29 | else | ||
| 30 | BUILD_ARCH=`uname -m` | ||
| 31 | BUILD_OS=`uname | tr '[A-Z]' '[a-z]'` | ||
| 32 | BUILD_SYS="$BUILD_ARCH-$BUILD_OS" | ||
| 33 | TMPDIR=$BUILDDIR/tmp | ||
| 34 | fi | ||
| 35 | |||
| 36 | if ! (test -d "$TMPDIR"); then | ||
| 37 | echo >&2 "Error: no $TMPDIR directory, please re-run the script from the Poky build directory." | ||
| 38 | return | ||
| 39 | fi | ||
| 40 | |||
| 41 | SCRIPTSDIR=`dirname "$0"` | ||
| 42 | INTERNAL_SCRIPT=$SCRIPTSDIR/poky-qemu-internal | ||
| 43 | |||
| 44 | if [ "x$1" = "x" ]; then | ||
| 45 | echo | ||
| 46 | echo "Run as $0 MACHINE IMAGETYPE ZIMAGE IMAGEFILE" | ||
| 47 | echo "where:" | ||
| 48 | echo " MACHINE - the machine to emulate (qemuarm, qemux86)" | ||
| 49 | echo " IMAGETYPE - the type of image to run (ext3, nfs) (default: ext3)" | ||
| 50 | echo " ZIMAGE - the kernel to use (optional)" | ||
| 51 | echo " IMAGEFILE - the image file/location to use (optional)" | ||
| 52 | exit 1 | ||
| 53 | else | ||
| 54 | MACHINE=$1 | ||
| 55 | shift | ||
| 56 | fi | ||
| 57 | |||
| 58 | if [ "x$1" != "x" ]; then | ||
| 59 | TYPE=$1 | ||
| 60 | shift | ||
| 61 | else | ||
| 62 | TYPE="ext3" | ||
| 63 | if [ "$MACHINE" = "akita" ]; then | ||
| 64 | TYPE="jffs2" | ||
| 65 | fi | ||
| 66 | if [ "$MACHINE" = "nokia800" ]; then | ||
| 67 | TYPE="jffs2" | ||
| 68 | fi | ||
| 69 | if [ "$MACHINE" = "spitz" ]; then | ||
| 70 | TYPE="ext3" | ||
| 71 | fi | ||
| 72 | fi | ||
| 73 | |||
| 74 | if [ "x$1" != "x" ]; then | ||
| 75 | ZIMAGE=$1 | ||
| 76 | shift | ||
| 77 | fi | ||
| 78 | |||
| 79 | if [ "x$1" != "x" ]; then | ||
| 80 | HDIMAGE=$1 | ||
| 81 | shift | ||
| 82 | fi | ||
| 83 | |||
| 84 | if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o "$MACHINE" = "akita" -o "$MACHINE" = "nokia800" ]; then | ||
| 85 | if [ "x$ZIMAGE" = "x" ]; then | ||
| 86 | ZIMAGE=$TMPDIR/deploy/images/zImage-$MACHINE.bin | ||
| 87 | fi | ||
| 88 | CROSSPATH=$TMPDIR/sysroots/$BUILD_SYS/bin | ||
| 89 | fi | ||
| 90 | |||
| 91 | function findimage { | ||
| 92 | where=$1 | ||
| 93 | machine=$2 | ||
| 94 | extension=$3 | ||
| 95 | names=$4 | ||
| 96 | for name in $names; | ||
| 97 | do | ||
| 98 | fullname=$where/$name-$machine.$extension | ||
| 99 | if [ -e "$fullname" ]; then | ||
| 100 | HDIMAGE=$fullname | ||
| 101 | return | ||
| 102 | fi | ||
| 103 | done | ||
| 104 | echo "Couldn't find image in $where. Attempted image names were:" | ||
| 105 | for name in $names; | ||
| 106 | do | ||
| 107 | echo $name-$machine.$extension | ||
| 108 | done | ||
| 109 | exit 1 | ||
| 110 | } | ||
| 111 | |||
| 112 | if [ "$MACHINE" = "qemuarm" ]; then | ||
| 113 | if [ "$TYPE" = "ext3" ]; then | ||
| 114 | if [ "x$HDIMAGE" = "x" ]; then | ||
| 115 | T=$TMPDIR/deploy/images | ||
| 116 | findimage $T qemuarm ext3 "poky-image-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" | ||
| 117 | fi | ||
| 118 | fi | ||
| 119 | fi | ||
| 120 | |||
| 121 | if [ "$MACHINE" = "qemumips" ]; then | ||
| 122 | if [ "x$ZIMAGE" = "x" ]; then | ||
| 123 | ZIMAGE=$TMPDIR/deploy/images/vmlinux-$MACHINE.bin | ||
| 124 | fi | ||
| 125 | if [ "$TYPE" = "ext3" ]; then | ||
| 126 | if [ "x$HDIMAGE" = "x" ]; then | ||
| 127 | T=$TMPDIR/deploy/images | ||
| 128 | findimage $T $MACHINE ext3 "poky-image-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" | ||
| 129 | fi | ||
| 130 | fi | ||
| 131 | CROSSPATH=$TMPDIR/sysroots/$BUILD_SYS/usr | ||
| 132 | fi | ||
| 133 | |||
| 134 | if [ "$MACHINE" = "qemuppc" ]; then | ||
| 135 | if [ "x$ZIMAGE" = "x" ]; then | ||
| 136 | ZIMAGE=$TMPDIR/deploy/images/zImage-$MACHINE.bin | ||
| 137 | fi | ||
| 138 | if [ "$TYPE" = "ext3" ]; then | ||
| 139 | if [ "x$HDIMAGE" = "x" ]; then | ||
| 140 | T=$TMPDIR/deploy/images | ||
| 141 | findimage $T $MACHINE ext3 "poky-image-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" | ||
| 142 | fi | ||
| 143 | fi | ||
| 144 | CROSSPATH=$TMPDIR/sysroots/$BUILD_SYS/usr | ||
| 145 | fi | ||
| 146 | |||
| 147 | if [ "$MACHINE" = "spitz" ]; then | ||
| 148 | if [ "$TYPE" = "ext3" ]; then | ||
| 149 | if [ "x$HDIMAGE" = "x" ]; then | ||
| 150 | HDIMAGE=$TMPDIR/deploy/images/poky-image-sato-spitz.ext3 | ||
| 151 | fi | ||
| 152 | fi | ||
| 153 | fi | ||
| 154 | |||
| 155 | if [ "$MACHINE" = "akita" ]; then | ||
| 156 | if [ "$TYPE" = "jffs2" ]; then | ||
| 157 | if [ "x$HDIMAGE" = "x" ]; then | ||
| 158 | HDIMAGE=$TMPDIR/deploy/images/poky-image-sato-akita.jffs2 | ||
| 159 | fi | ||
| 160 | fi | ||
| 161 | fi | ||
| 162 | |||
| 163 | if [ "$MACHINE" = "nokia800" ]; then | ||
| 164 | if [ "$TYPE" = "jffs2" ]; then | ||
| 165 | if [ "x$HDIMAGE" = "x" ]; then | ||
| 166 | HDIMAGE=$TMPDIR/deploy/images/poky-image-sato-nokia800.jffs2 | ||
| 167 | fi | ||
| 168 | fi | ||
| 169 | fi | ||
| 170 | |||
| 171 | |||
| 172 | if [ "$MACHINE" = "qemux86" ]; then | ||
| 173 | if [ "x$ZIMAGE" = "x" ]; then | ||
| 174 | ZIMAGE=$TMPDIR/deploy/images/bzImage-$MACHINE.bin | ||
| 175 | fi | ||
| 176 | if [ "$TYPE" = "ext3" ]; then | ||
| 177 | if [ "x$HDIMAGE" = "x" ]; then | ||
| 178 | T=$TMPDIR/deploy/images | ||
| 179 | findimage $T qemux86 ext3 "moblin-image-sdk moblin-image-netbook poky-image-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" | ||
| 180 | fi | ||
| 181 | fi | ||
| 182 | CROSSPATH=$TMPDIR/sysroots/$BUILD_SYS/usr | ||
| 183 | fi | ||
| 184 | |||
| 185 | if [ "$MACHINE" = "qemux86-64" ]; then | ||
| 186 | if [ "x$ZIMAGE" = "x" ]; then | ||
| 187 | ZIMAGE=$TMPDIR/deploy/images/bzImage-$MACHINE.bin | ||
| 188 | fi | ||
| 189 | if [ "$TYPE" = "ext3" ]; then | ||
| 190 | if [ "x$HDIMAGE" = "x" ]; then | ||
| 191 | T=$TMPDIR/deploy/images | ||
| 192 | findimage $T qemux86-64 ext3 "moblin-image-sdk moblin-image-netbook poky-image-sdk poky-image-sato poky-image-lsb poky-image-basic poky-image-minimal" | ||
| 193 | fi | ||
| 194 | fi | ||
| 195 | CROSSPATH=$TMPDIR/sysroots/$BUILD_SYS/usr | ||
| 196 | fi | ||
| 197 | |||
| 198 | if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o "$MACHINE" = "akita" -o "$MACHINE" = "nokia800" ]; then | ||
| 199 | TARGET_SYS="arm-poky-linux" | ||
| 200 | elif [ "$MACHINE" = "qemux86" ]; then | ||
| 201 | TARGET_SYS="i586-poky-linux" | ||
| 202 | elif [ "$MACHINE" = "qemux86-64" ]; then | ||
| 203 | TARGET_SYS="x86_64-poky-linux" | ||
| 204 | elif [ "$MACHINE" = "qemumips" ]; then | ||
| 205 | TARGET_SYS="mips-poky-linux" | ||
| 206 | fi | ||
| 207 | |||
| 208 | CROSSPATH=$TMPDIR/sysroots/$BUILD_SYS/usr/bin:$CROSSPATH | ||
| 209 | |||
| 210 | SYSROOT_SETUP_SCRIPT=`which poky-find-native-sysroot` | ||
| 211 | if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then | ||
| 212 | echo "Error: Unable to find the poky-find-native-sysroot script" | ||
| 213 | echo "Did you forget to source your Poky environment script?" | ||
| 214 | exit 1 | ||
| 215 | fi | ||
| 216 | . $SYSROOT_SETUP_SCRIPT | ||
| 217 | |||
| 218 | . $INTERNAL_SCRIPT | ||
