diff options
Diffstat (limited to 'scripts/runqemu')
| -rwxr-xr-x | scripts/runqemu | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index b49678502a..efab1a27b3 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
| @@ -321,9 +321,17 @@ AKITA_DEFAULT_FSTYPE=jffs2 | |||
| 321 | SPITZ_DEFAULT_KERNEL=zImage-spitz.bin | 321 | SPITZ_DEFAULT_KERNEL=zImage-spitz.bin |
| 322 | SPITZ_DEFAULT_FSTYPE=ext3 | 322 | SPITZ_DEFAULT_FSTYPE=ext3 |
| 323 | 323 | ||
| 324 | setup_tmpdir() { | 324 | setup_path_vars() { |
| 325 | if [ -z "$OE_TMPDIR" ]; then | 325 | if [ -z "$OE_TMPDIR" ] ; then |
| 326 | # Try to get OE_TMPDIR from bitbake | 326 | PATHS_REQUIRED=true |
| 327 | elif [ "$1" = "1" -a -z "$DEPLOY_DIR_IMAGE" ] ; then | ||
| 328 | PATHS_REQUIRED=true | ||
| 329 | else | ||
| 330 | PATHS_REQUIRED=false | ||
| 331 | fi | ||
| 332 | |||
| 333 | if [ "$PATHS_REQUIRED" = "true" ]; then | ||
| 334 | # Try to get the variable values from bitbake | ||
| 327 | type -P bitbake &>/dev/null || { | 335 | type -P bitbake &>/dev/null || { |
| 328 | echo "In order for this script to dynamically infer paths"; | 336 | echo "In order for this script to dynamically infer paths"; |
| 329 | echo "to kernels or filesystem images, you either need"; | 337 | echo "to kernels or filesystem images, you either need"; |
| @@ -331,21 +339,35 @@ setup_tmpdir() { | |||
| 331 | echo "before running this script" >&2; | 339 | echo "before running this script" >&2; |
| 332 | exit 1; } | 340 | exit 1; } |
| 333 | 341 | ||
| 334 | # We have bitbake in PATH, get OE_TMPDIR from bitbake | 342 | # We have bitbake in PATH, get the variable values from bitbake |
| 335 | OE_TMPDIR=`MACHINE=$MACHINE bitbake -e | grep ^TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2` | 343 | BITBAKE_ENV_TMPFILE=`mktemp runqemu.XXXXXXXXXX` |
| 344 | if [ "$?" != "0" ] ; then | ||
| 345 | echo "Error: mktemp failed for bitbake environment output" | ||
| 346 | exit 1 | ||
| 347 | fi | ||
| 348 | |||
| 349 | MACHINE=$MACHINE bitbake -e > $BITBAKE_ENV_TMPFILE | ||
| 350 | if [ -z "$OE_TMPDIR" ] ; then | ||
| 351 | OE_TMPDIR=`cat $BITBAKE_ENV_TMPFILE | sed -n 's/^TMPDIR=\"\(.*\)\"/\1/p'` | ||
| 352 | fi | ||
| 353 | if [ -z "$DEPLOY_DIR_IMAGE" ] ; then | ||
| 354 | DEPLOY_DIR_IMAGE=`cat $BITBAKE_ENV_TMPFILE | sed -n 's/^DEPLOY_DIR_IMAGE=\"\(.*\)\"/\1/p'` | ||
| 355 | fi | ||
| 336 | if [ -z "$OE_TMPDIR" ]; then | 356 | if [ -z "$OE_TMPDIR" ]; then |
| 337 | # Check for errors from bitbake that the user needs to know about | 357 | # Check for errors from bitbake that the user needs to know about |
| 338 | BITBAKE_OUTPUT=`bitbake -e | wc -l` | 358 | BITBAKE_OUTPUT=`cat $BITBAKE_ENV_TMPFILE | wc -l` |
| 339 | if [ "$BITBAKE_OUTPUT" -eq "0" ]; then | 359 | if [ "$BITBAKE_OUTPUT" -eq "0" ]; then |
| 340 | echo "Error: this script needs to be run from your build directory," | 360 | echo "Error: this script needs to be run from your build directory, or you need" |
| 341 | echo "or you need to explicitly set OE_TMPDIR in your environment" | 361 | echo "to explicitly set OE_TMPDIR and DEPLOY_DIR_IMAGE in your environment" |
| 342 | else | 362 | else |
| 343 | echo "There was an error running bitbake to determine TMPDIR" | 363 | echo "There was an error running bitbake to determine TMPDIR" |
| 344 | echo "Here is the output from 'bitbake -e':" | 364 | echo "Here is the output from 'bitbake -e':" |
| 345 | bitbake -e | 365 | cat $BITBAKE_ENV_TMPFILE |
| 346 | fi | 366 | fi |
| 367 | rm $BITBAKE_ENV_TMPFILE | ||
| 347 | exit 1 | 368 | exit 1 |
| 348 | fi | 369 | fi |
| 370 | rm $BITBAKE_ENV_TMPFILE | ||
| 349 | fi | 371 | fi |
| 350 | } | 372 | } |
| 351 | 373 | ||
| @@ -355,7 +377,7 @@ setup_sysroot() { | |||
| 355 | # either in an in-tree build scenario or the environment | 377 | # either in an in-tree build scenario or the environment |
| 356 | # script wasn't source'd. | 378 | # script wasn't source'd. |
| 357 | if [ -z "$OECORE_NATIVE_SYSROOT" ]; then | 379 | if [ -z "$OECORE_NATIVE_SYSROOT" ]; then |
| 358 | setup_tmpdir | 380 | setup_path_vars |
| 359 | BUILD_ARCH=`uname -m` | 381 | BUILD_ARCH=`uname -m` |
| 360 | BUILD_OS=`uname | tr '[A-Z]' '[a-z]'` | 382 | BUILD_OS=`uname | tr '[A-Z]' '[a-z]'` |
| 361 | BUILD_SYS="$BUILD_ARCH-$BUILD_OS" | 383 | BUILD_SYS="$BUILD_ARCH-$BUILD_OS" |
| @@ -405,9 +427,9 @@ if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then | |||
| 405 | fi | 427 | fi |
| 406 | 428 | ||
| 407 | if [ -z "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then | 429 | if [ -z "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then |
| 408 | setup_tmpdir | 430 | setup_path_vars 1 |
| 409 | eval kernel_file=\$${machine2}_DEFAULT_KERNEL | 431 | eval kernel_file=\$${machine2}_DEFAULT_KERNEL |
| 410 | KERNEL=$OE_TMPDIR/deploy/images/$kernel_file | 432 | KERNEL=$DEPLOY_DIR_IMAGE/$kernel_file |
| 411 | 433 | ||
| 412 | if [ -z "$KERNEL" ]; then | 434 | if [ -z "$KERNEL" ]; then |
| 413 | error "Unable to determine default kernel for MACHINE [$MACHINE]" | 435 | error "Unable to determine default kernel for MACHINE [$MACHINE]" |
| @@ -428,14 +450,14 @@ fi | |||
| 428 | # Handle cases where a ROOTFS type is given instead of a filename, e.g. | 450 | # Handle cases where a ROOTFS type is given instead of a filename, e.g. |
| 429 | # core-image-sato | 451 | # core-image-sato |
| 430 | if [ "$LAZY_ROOTFS" = "true" ]; then | 452 | if [ "$LAZY_ROOTFS" = "true" ]; then |
| 431 | setup_tmpdir | 453 | setup_path_vars 1 |
| 432 | echo "Assuming $ROOTFS really means $OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE" | 454 | echo "Assuming $ROOTFS really means $DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE" |
| 433 | ROOTFS=$OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE | 455 | ROOTFS=$DEPLOY_DIR_IMAGE/$ROOTFS-$MACHINE.$FSTYPE |
| 434 | fi | 456 | fi |
| 435 | 457 | ||
| 436 | if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" ]; then | 458 | if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" ]; then |
| 437 | setup_tmpdir | 459 | setup_path_vars 1 |
| 438 | T=$OE_TMPDIR/deploy/images | 460 | T=$DEPLOY_DIR_IMAGE |
| 439 | eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS | 461 | eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS |
| 440 | findimage $T $MACHINE $FSTYPE | 462 | findimage $T $MACHINE $FSTYPE |
| 441 | 463 | ||
