diff options
-rw-r--r-- | meta/classes/testimage.bbclass | 1 | ||||
-rw-r--r-- | meta/conf/bitbake.conf | 2 | ||||
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 8 | ||||
-rwxr-xr-x | scripts/runqemu | 56 |
4 files changed, 48 insertions, 19 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass index 4eef0be1d6..c83906d0f8 100644 --- a/meta/classes/testimage.bbclass +++ b/meta/classes/testimage.bbclass | |||
@@ -122,6 +122,7 @@ def testimage_main(d): | |||
122 | 122 | ||
123 | qemu = QemuRunner(machine, rootfs) | 123 | qemu = QemuRunner(machine, rootfs) |
124 | qemu.tmpdir = d.getVar("TMPDIR", True) | 124 | qemu.tmpdir = d.getVar("TMPDIR", True) |
125 | qemu.deploy_dir_image = d.getVar("DEPLOY_DIR_IMAGE", True) | ||
125 | qemu.display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY", True) | 126 | qemu.display = d.getVar("BB_ORIGENV", False).getVar("DISPLAY", True) |
126 | qemu.logfile = os.path.join(testdir, "qemu_boot_log.%s" % d.getVar('DATETIME', True)) | 127 | qemu.logfile = os.path.join(testdir, "qemu_boot_log.%s" % d.getVar('DATETIME', True)) |
127 | try: | 128 | try: |
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 578c7d00eb..9eed72ad3f 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf | |||
@@ -379,7 +379,7 @@ DEPLOY_DIR_TAR = "${DEPLOY_DIR}/tar" | |||
379 | DEPLOY_DIR_IPK = "${DEPLOY_DIR}/ipk" | 379 | DEPLOY_DIR_IPK = "${DEPLOY_DIR}/ipk" |
380 | DEPLOY_DIR_RPM = "${DEPLOY_DIR}/rpm" | 380 | DEPLOY_DIR_RPM = "${DEPLOY_DIR}/rpm" |
381 | DEPLOY_DIR_DEB = "${DEPLOY_DIR}/deb" | 381 | DEPLOY_DIR_DEB = "${DEPLOY_DIR}/deb" |
382 | DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR}/images" | 382 | DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR}/images/${MACHINE}" |
383 | DEPLOY_DIR_TOOLS = "${DEPLOY_DIR}/tools" | 383 | DEPLOY_DIR_TOOLS = "${DEPLOY_DIR}/tools" |
384 | 384 | ||
385 | PKGDATA_DIR = "${TMPDIR}/pkgdata/${MULTIMACH_TARGET_SYS}" | 385 | PKGDATA_DIR = "${TMPDIR}/pkgdata/${MULTIMACH_TARGET_SYS}" |
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index b5c757a927..d362edeecb 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
@@ -16,7 +16,7 @@ import bb | |||
16 | 16 | ||
17 | class QemuRunner: | 17 | class QemuRunner: |
18 | 18 | ||
19 | def __init__(self, machine, rootfs, display = None, tmpdir = None, logfile = None, boottime = 400, runqemutime = 60): | 19 | def __init__(self, machine, rootfs, display = None, tmpdir = None, deploy_dir_image = None, logfile = None, boottime = 400, runqemutime = 60): |
20 | # Popen object | 20 | # Popen object |
21 | self.runqemu = None | 21 | self.runqemu = None |
22 | 22 | ||
@@ -28,6 +28,7 @@ class QemuRunner: | |||
28 | 28 | ||
29 | self.display = display | 29 | self.display = display |
30 | self.tmpdir = tmpdir | 30 | self.tmpdir = tmpdir |
31 | self.deploy_dir_image = deploy_dir_image | ||
31 | self.logfile = logfile | 32 | self.logfile = logfile |
32 | self.boottime = boottime | 33 | self.boottime = boottime |
33 | self.runqemutime = runqemutime | 34 | self.runqemutime = runqemutime |
@@ -71,6 +72,11 @@ class QemuRunner: | |||
71 | return False | 72 | return False |
72 | else: | 73 | else: |
73 | os.environ["OE_TMPDIR"] = self.tmpdir | 74 | os.environ["OE_TMPDIR"] = self.tmpdir |
75 | if not os.path.exists(self.deploy_dir_image): | ||
76 | bb.error("Invalid DEPLOY_DIR_IMAGE path %s" % self.deploy_dir_image) | ||
77 | return False | ||
78 | else: | ||
79 | os.environ["DEPLOY_DIR_IMAGE"] = self.deploy_dir_image | ||
74 | 80 | ||
75 | self.qemuparams = 'bootparams="console=tty1 console=ttyS0,115200n8" qemuparams="-serial tcp:127.0.0.1:%s"' % self.serverport | 81 | self.qemuparams = 'bootparams="console=tty1 console=ttyS0,115200n8" qemuparams="-serial tcp:127.0.0.1:%s"' % self.serverport |
76 | if qemuparams: | 82 | if qemuparams: |
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 | ||