diff options
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-x | scripts/runqemu | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index c7c51ec77a..bb26f8b633 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -19,11 +19,23 @@ if [ "x$BUILDDIR" = "x" ]; then - echo "You need to source poky-init-build-env before running this script" - exit 1 + # BUILDDIR unset, try and get TMPDIR from bitbake + type -P bitbake &>/dev/null || { + echo "You either need bitbake in your PATH or to source poky-init-build-env before running this script" >&2; exit 1; } + + # we have bitbake in PATH, get TMPDIR from the environment + TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2` +else + TMPDIR=$BUILDDIR/tmp +fi + +if ! (test -d "$TMPDIR"); then + echo >&2 "Error: no $TMPDIR directory, please re-run the script from the Poky build directory." + return fi -INTERNAL_SCRIPT=`which poky-qemu-internal` +SCRIPTSDIR=`dirname "$0"` +INTERNAL_SCRIPT=SCRIPTSDIR/poky-qemu-internal` if [ "x$1" = "x" ]; then echo @@ -67,9 +79,9 @@ fi if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o "$MACHINE" = "akita" -o "$MACHINE" = "nokia800" ]; then if [ "x$ZIMAGE" = "x" ]; then - ZIMAGE=$BUILDDIR/tmp/deploy/images/zImage-$MACHINE.bin + ZIMAGE=$TMPDIR/deploy/images/zImage-$MACHINE.bin fi - CROSSPATH=$BUILDDIR/sysroots/$BUILD_SYS/arm-poky-linux-gnueabi/bin + CROSSPATH=$TMPDIR/sysroots/$BUILD_SYS/arm-poky-linux-gnueabi/bin fi function findimage { @@ -96,7 +108,7 @@ function findimage { if [ "$MACHINE" = "qemuarm" ]; then if [ "$TYPE" = "ext3" ]; then if [ "x$HDIMAGE" = "x" ]; then - T=$BUILDDIR/tmp/deploy/images + T=$TMPDIR/deploy/images findimage $T qemuarm ext3 "poky-image-sdk poky-image-sato poky-image-minimal" fi fi @@ -104,34 +116,34 @@ fi if [ "$MACHINE" = "qemumips" ]; then if [ "x$ZIMAGE" = "x" ]; then - ZIMAGE=$BUILDDIR/tmp/deploy/images/vmlinux-$MACHINE.bin + ZIMAGE=$TMPDIR/tmp/deploy/images/vmlinux-$MACHINE.bin fi if [ "$TYPE" = "ext3" ]; then if [ "x$HDIMAGE" = "x" ]; then - T=$BUILDDIR/tmp/deploy/images + T=$TMPDIR/tmp/deploy/images findimage $T $MACHINE ext3 "poky-image-sdk poky-image-sato poky-image-minimal" fi fi - CROSSPATH=$BUILDDIR/tmp/sysroots/$BUILD_SYS/usr + CROSSPATH=$TMPDIR/tmp/sysroots/$BUILD_SYS/usr fi if [ "$MACHINE" = "qemuppc" ]; then if [ "x$ZIMAGE" = "x" ]; then - ZIMAGE=$BUILDDIR/tmp/deploy/images/zImage-$MACHINE.bin + ZIMAGE=$TMPDIR/tmp/deploy/images/zImage-$MACHINE.bin fi if [ "$TYPE" = "ext3" ]; then if [ "x$HDIMAGE" = "x" ]; then - T=$BUILDDIR/tmp/deploy/images + T=$TMPDIR/tmp/deploy/images findimage $T $MACHINE ext3 "poky-image-sdk poky-image-sato poky-image-minimal" fi fi - CROSSPATH=$BUILDDIR/tmp/sysroots/$BUILD_SYS/usr + CROSSPATH=$TMPDIR/tmp/sysroots/$BUILD_SYS/usr fi if [ "$MACHINE" = "spitz" ]; then if [ "$TYPE" = "ext3" ]; then if [ "x$HDIMAGE" = "x" ]; then - HDIMAGE=$BUILDDIR/tmp/deploy/images/poky-image-sato-spitz.ext3 + HDIMAGE=$TMPDIR/tmp/deploy/images/poky-image-sato-spitz.ext3 fi fi fi @@ -139,7 +151,7 @@ fi if [ "$MACHINE" = "akita" ]; then if [ "$TYPE" = "jffs2" ]; then if [ "x$HDIMAGE" = "x" ]; then - HDIMAGE=$BUILDDIR/tmp/deploy/images/poky-image-sato-akita.jffs2 + HDIMAGE=$TMPDIR/tmp/deploy/images/poky-image-sato-akita.jffs2 fi fi fi @@ -147,7 +159,7 @@ fi if [ "$MACHINE" = "nokia800" ]; then if [ "$TYPE" = "jffs2" ]; then if [ "x$HDIMAGE" = "x" ]; then - HDIMAGE=$BUILDDIR/tmp/deploy/images/poky-image-sato-nokia800.jffs2 + HDIMAGE=$TMPDIR/tmp/deploy/images/poky-image-sato-nokia800.jffs2 fi fi fi @@ -155,15 +167,15 @@ fi if [ "$MACHINE" = "qemux86" ]; then if [ "x$ZIMAGE" = "x" ]; then - ZIMAGE=$BUILDDIR/tmp/deploy/images/bzImage-$MACHINE.bin + ZIMAGE=$TMPDIR/tmp/deploy/images/bzImage-$MACHINE.bin fi if [ "$TYPE" = "ext3" ]; then if [ "x$HDIMAGE" = "x" ]; then - T=$BUILDDIR/tmp/deploy/images + T=$TMPDIR/tmp/deploy/images findimage $T qemux86 ext3 "moblin-image-sdk moblin-image-netbook poky-image-sdk poky-image-sato poky-image-minimal" fi fi - CROSSPATH=$BUILDDIR/tmp/sysroots/$BUILD_SYS/usr + CROSSPATH=$TMPDIR/tmp/sysroots/$BUILD_SYS/usr fi if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o "$MACHINE" = "akita" -o "$MACHINE" = "nokia800" ]; then @@ -182,6 +194,6 @@ if [ ! -e $CROSSPATH/$TARGET_SYS/bin/gcc ]; then ln -s $CROSSPATH/bin/$TARGET_SYS-gcc $CROSSPATH/$TARGET_SYS/bin/gcc fi -CROSSPATH=$BUILDDIR/tmp/sysroots/$BUILD_SYS/usr/bin:$CROSSPATH:$BUILDDIR/tmp/cross/bin +CROSSPATH=$TMPDIR/tmp/sysroots/$BUILD_SYS/usr/bin:$CROSSPATH:$TMPDIR/tmp/cross/bin . $INTERNAL_SCRIPT |