summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-09-12 12:04:52 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-14 08:21:00 +0100
commit6670be71f75c3d7e11362d7c9076ca4de75b50f4 (patch)
tree485fcc33b9f2a7de82db59fd72485fa68ac1d316
parentee7ccda0ec5d0be79bb65868c5827dea91710b2f (diff)
downloadpoky-6670be71f75c3d7e11362d7c9076ca4de75b50f4.tar.gz
bitbake.conf: include machine name in DEPLOY_DIR_IMAGE
This allows a clean seperation between image outputs from different machines, and makes it possible to have convenience symlinks to make the output ready to deploy. This did require some surgery in runqemu; if explicit paths to the image and kernel are not supplied then DEPLOY_DIR_IMAGE needs to be determined from bitbake or set in the environment. However the script does try to avoid requiring it unless it really is needed. Corresponding changes were made in the automated testing code as well. Based on an RFC patch by Koen Kooi <koen@dominion.thruhere.net> (From OE-Core rev: 7e90261aec61f79680b5eaeaf5b18c7b795412a4) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/testimage.bbclass1
-rw-r--r--meta/conf/bitbake.conf2
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py8
-rwxr-xr-xscripts/runqemu56
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"
379DEPLOY_DIR_IPK = "${DEPLOY_DIR}/ipk" 379DEPLOY_DIR_IPK = "${DEPLOY_DIR}/ipk"
380DEPLOY_DIR_RPM = "${DEPLOY_DIR}/rpm" 380DEPLOY_DIR_RPM = "${DEPLOY_DIR}/rpm"
381DEPLOY_DIR_DEB = "${DEPLOY_DIR}/deb" 381DEPLOY_DIR_DEB = "${DEPLOY_DIR}/deb"
382DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR}/images" 382DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR}/images/${MACHINE}"
383DEPLOY_DIR_TOOLS = "${DEPLOY_DIR}/tools" 383DEPLOY_DIR_TOOLS = "${DEPLOY_DIR}/tools"
384 384
385PKGDATA_DIR = "${TMPDIR}/pkgdata/${MULTIMACH_TARGET_SYS}" 385PKGDATA_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
17class QemuRunner: 17class 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
321SPITZ_DEFAULT_KERNEL=zImage-spitz.bin 321SPITZ_DEFAULT_KERNEL=zImage-spitz.bin
322SPITZ_DEFAULT_FSTYPE=ext3 322SPITZ_DEFAULT_FSTYPE=ext3
323 323
324setup_tmpdir() { 324setup_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
405fi 427fi
406 428
407if [ -z "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then 429if [ -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
430if [ "$LAZY_ROOTFS" = "true" ]; then 452if [ "$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
434fi 456fi
435 457
436if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" ]; then 458if [ -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