diff options
| author | Scott Garman <scott.a.garman@intel.com> | 2010-12-07 20:59:06 -0800 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-12-09 15:00:45 +0000 |
| commit | ba5e0b9531b9a967aa3d408a13024590d96b8391 (patch) | |
| tree | 47b7536aa4da6efc78106a1a57c6ebe9a13e91d2 | |
| parent | 7581654a030961eda03b07de0e0f6d62a7f4055e (diff) | |
| download | poky-ba5e0b9531b9a967aa3d408a13024590d96b8391.tar.gz | |
Make poky-qemu and related scripts work with arbitrary SDK locations
* No longer assume SDK toolchains are installed in /opt/poky
* [BUGFIX #568] where specifying paths to both the kernel and fs
image caused an error due to POKY_NATIVE_SYSROOT never being
set, triggering failure of poky-qemu-ifup/ifdown
* Cosmetic improvements to usage() functions by using basename
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
| -rwxr-xr-x | scripts/poky-find-native-sysroot | 2 | ||||
| -rwxr-xr-x | scripts/poky-qemu | 38 | ||||
| -rwxr-xr-x | scripts/poky-qemu-ifdown | 9 | ||||
| -rwxr-xr-x | scripts/poky-qemu-ifup | 9 | ||||
| -rwxr-xr-x | scripts/poky-qemu-internal | 16 |
5 files changed, 26 insertions, 48 deletions
diff --git a/scripts/poky-find-native-sysroot b/scripts/poky-find-native-sysroot index d8002f963e..226229421c 100755 --- a/scripts/poky-find-native-sysroot +++ b/scripts/poky-find-native-sysroot | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | # | 2 | # |
| 3 | # Find a native sysroot to use - either from an in-tree Poky build or | 3 | # Find a native sysroot to use - either from an in-tree Poky build or |
| 4 | # from a toolchain installation in /opt/poky. It then ensures the variable | 4 | # from a toolchain installation. It then ensures the variable |
| 5 | # $POKY_NATIVE_SYSROOT is set to the sysroot's base directory, and sets | 5 | # $POKY_NATIVE_SYSROOT is set to the sysroot's base directory, and sets |
| 6 | # $PSEUDO to the path of the pseudo binary. | 6 | # $PSEUDO to the path of the pseudo binary. |
| 7 | # | 7 | # |
diff --git a/scripts/poky-qemu b/scripts/poky-qemu index bc312e0fb6..67af439ea9 100755 --- a/scripts/poky-qemu +++ b/scripts/poky-qemu | |||
| @@ -31,9 +31,9 @@ usage() { | |||
| 31 | echo " serial - enables a serial console on /dev/ttyS0" | 31 | echo " serial - enables a serial console on /dev/ttyS0" |
| 32 | echo "" | 32 | echo "" |
| 33 | echo "Examples:" | 33 | echo "Examples:" |
| 34 | echo " $0 qemuarm" | 34 | echo " $MYNAME qemuarm" |
| 35 | echo " $0 qemux86-64 poky-image-sato ext3" | 35 | echo " $MYNAME qemux86-64 poky-image-sato ext3" |
| 36 | echo " $0 path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial" | 36 | echo " $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial" |
| 37 | exit 1 | 37 | exit 1 |
| 38 | } | 38 | } |
| 39 | 39 | ||
| @@ -213,23 +213,29 @@ setup_tmpdir() { | |||
| 213 | echo "before running this script" >&2; | 213 | echo "before running this script" >&2; |
| 214 | exit 1; } | 214 | exit 1; } |
| 215 | 215 | ||
| 216 | # We have bitbake in PATH, get TMPDIR and BUILD_SYS | 216 | # We have bitbake in PATH, get TMPDIR from bitbake |
| 217 | # from the environment | ||
| 218 | TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2` | 217 | TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2` |
| 219 | BUILD_SYS=`bitbake -e | grep BUILD_SYS=\" | cut -d '=' -f2 | cut -d '"' -f2` | ||
| 220 | else | 218 | else |
| 221 | BUILD_ARCH=`uname -m` | ||
| 222 | BUILD_OS=`uname | tr '[A-Z]' '[a-z]'` | ||
| 223 | BUILD_SYS="$BUILD_ARCH-$BUILD_OS" | ||
| 224 | TMPDIR=$BUILDDIR/tmp | 219 | TMPDIR=$BUILDDIR/tmp |
| 225 | fi | 220 | fi |
| 226 | if [ -z "$POKY_NATIVE_SYSROOT" ]; then | ||
| 227 | POKY_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS | ||
| 228 | fi | ||
| 229 | CROSSPATH=$POKY_NATIVE_SYSROOT/usr/bin | ||
| 230 | fi | 221 | fi |
| 231 | } | 222 | } |
| 232 | 223 | ||
| 224 | setup_sysroot() { | ||
| 225 | # Toolchain installs set up $POKY_NATIVE_SYSROOT in their | ||
| 226 | # environment script. If that variable isn't set, we're | ||
| 227 | # either in an in-tree poky scenario or the environment | ||
| 228 | # script wasn't source'd. | ||
| 229 | if [ -z "$POKY_NATIVE_SYSROOT" ]; then | ||
| 230 | setup_tmpdir | ||
| 231 | BUILD_ARCH=`uname -m` | ||
| 232 | BUILD_OS=`uname | tr '[A-Z]' '[a-z]'` | ||
| 233 | BUILD_SYS="$BUILD_ARCH-$BUILD_OS" | ||
| 234 | |||
| 235 | POKY_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS | ||
| 236 | fi | ||
| 237 | } | ||
| 238 | |||
| 233 | # Locate a rootfs image based on defaults defined above | 239 | # Locate a rootfs image based on defaults defined above |
| 234 | findimage() { | 240 | findimage() { |
| 235 | where=$1 | 241 | where=$1 |
| @@ -254,8 +260,6 @@ findimage() { | |||
| 254 | } | 260 | } |
| 255 | 261 | ||
| 256 | if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then | 262 | if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then |
| 257 | setup_tmpdir | ||
| 258 | |||
| 259 | # Extract the filename extension | 263 | # Extract the filename extension |
| 260 | EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'` | 264 | EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'` |
| 261 | if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || | 265 | if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || |
| @@ -281,7 +285,6 @@ fi | |||
| 281 | # KERNEL is now set for all cases | 285 | # KERNEL is now set for all cases |
| 282 | 286 | ||
| 283 | if [ -z "$FSTYPE" ]; then | 287 | if [ -z "$FSTYPE" ]; then |
| 284 | setup_tmpdir | ||
| 285 | eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE | 288 | eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE |
| 286 | 289 | ||
| 287 | if [ -z "$FSTYPE" ]; then | 290 | if [ -z "$FSTYPE" ]; then |
| @@ -318,6 +321,9 @@ echo "KERNEL: [$KERNEL]" | |||
| 318 | echo "ROOTFS: [$ROOTFS]" | 321 | echo "ROOTFS: [$ROOTFS]" |
| 319 | echo "FSTYPE: [$FSTYPE]" | 322 | echo "FSTYPE: [$FSTYPE]" |
| 320 | 323 | ||
| 324 | setup_sysroot | ||
| 325 | # POKY_NATIVE_SYSROOT is now set for all cases | ||
| 326 | |||
| 321 | # We can't run without a libGL.so | 327 | # We can't run without a libGL.so |
| 322 | libgl='no' | 328 | libgl='no' |
| 323 | 329 | ||
diff --git a/scripts/poky-qemu-ifdown b/scripts/poky-qemu-ifdown index 60ca919dea..bc90a9c12d 100755 --- a/scripts/poky-qemu-ifdown +++ b/scripts/poky-qemu-ifdown | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 27 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 28 | 28 | ||
| 29 | usage() { | 29 | usage() { |
| 30 | echo "sudo $0 <tap-dev> <native-sysroot-basedir>" | 30 | echo "sudo $(basename $0) <tap-dev> <native-sysroot-basedir>" |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | if [ $EUID -ne 0 ]; then | 33 | if [ $EUID -ne 0 ]; then |
| @@ -46,13 +46,6 @@ NATIVE_SYSROOT_DIR=$2 | |||
| 46 | TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl | 46 | TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl |
| 47 | if [ ! -e "$TUNCTL" ]; then | 47 | if [ ! -e "$TUNCTL" ]; then |
| 48 | echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin'" | 48 | echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin'" |
| 49 | |||
| 50 | if [[ "$NATIVE_SYSROOT_DIR" =~ ^\/opt\/poky ]]; then | ||
| 51 | echo "This shouldn't happen - something is wrong with your toolchain installation" | ||
| 52 | else | ||
| 53 | echo "Have you run 'bitbake meta-ide-support'?" | ||
| 54 | fi | ||
| 55 | |||
| 56 | exit 1 | 49 | exit 1 |
| 57 | fi | 50 | fi |
| 58 | 51 | ||
diff --git a/scripts/poky-qemu-ifup b/scripts/poky-qemu-ifup index 8685c83cce..f82848ccce 100755 --- a/scripts/poky-qemu-ifup +++ b/scripts/poky-qemu-ifup | |||
| @@ -34,7 +34,7 @@ | |||
| 34 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 34 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 35 | 35 | ||
| 36 | usage() { | 36 | usage() { |
| 37 | echo "sudo $0 <gid> <native-sysroot-basedir>" | 37 | echo "sudo $(basename $0) <gid> <native-sysroot-basedir>" |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | if [ $EUID -ne 0 ]; then | 40 | if [ $EUID -ne 0 ]; then |
| @@ -53,13 +53,6 @@ NATIVE_SYSROOT_DIR=$2 | |||
| 53 | TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl | 53 | TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl |
| 54 | if [ ! -x "$TUNCTL" ]; then | 54 | if [ ! -x "$TUNCTL" ]; then |
| 55 | echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin'" | 55 | echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin'" |
| 56 | |||
| 57 | if [[ "$NATIVE_SYSROOT_DIR" =~ ^\/opt\/poky ]]; then | ||
| 58 | echo "This shouldn't happen - something is wrong with your toolchain installation" | ||
| 59 | else | ||
| 60 | echo "Have you run 'bitbake meta-ide-support'?" | ||
| 61 | fi | ||
| 62 | |||
| 63 | exit 1 | 56 | exit 1 |
| 64 | fi | 57 | fi |
| 65 | 58 | ||
diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal index 62c1040f71..ca2511a024 100755 --- a/scripts/poky-qemu-internal +++ b/scripts/poky-qemu-internal | |||
| @@ -394,23 +394,9 @@ if [ "x$QEMUOPTIONS" = "x" ]; then | |||
| 394 | return | 394 | return |
| 395 | fi | 395 | fi |
| 396 | 396 | ||
| 397 | SDKDIR="/opt/poky/sysroots" | 397 | PATH=$CROSSPATH:$POKY_NATIVE_SYSROOT/usr/bin:$PATH |
| 398 | if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o "$MACHINE" = "akita" -o "$MACHINE" = "nokia800" ]; then | ||
| 399 | SDKPATH="$SDKDIR/arm-poky-linux-gnueabi/bin" | ||
| 400 | fi | ||
| 401 | |||
| 402 | if [ "$MACHINE" = "qemux86" ]; then | ||
| 403 | SDKPATH="$SDKDIR/i586-poky-linux/bin" | ||
| 404 | fi | ||
| 405 | |||
| 406 | if [ "$MACHINE" = "qemux86-64" ]; then | ||
| 407 | SDKPATH="$SDKDIR/x86_64-poky-linux/bin" | ||
| 408 | fi | ||
| 409 | |||
| 410 | PATH=$CROSSPATH:$SDKPATH:$PATH | ||
| 411 | 398 | ||
| 412 | QEMUBIN=`which $QEMU` | 399 | QEMUBIN=`which $QEMU` |
| 413 | |||
| 414 | if [ ! -x "$QEMUBIN" ]; then | 400 | if [ ! -x "$QEMUBIN" ]; then |
| 415 | echo "Error: No QEMU binary '$QEMU' could be found." | 401 | echo "Error: No QEMU binary '$QEMU' could be found." |
| 416 | cleanup | 402 | cleanup |
