summaryrefslogtreecommitdiffstats
path: root/meta-yocto-bsp
diff options
context:
space:
mode:
authorStefan Stanacar <stefanx.stanacar@intel.com>2014-04-30 13:38:58 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-04-30 21:52:43 +0100
commitceb5c4d8c1ebbe96c8ad9e97514792ce3d9d2f50 (patch)
tree74ca4ea8204adc634ff557c75306395f3b6c004d /meta-yocto-bsp
parent3a4bb1aa604189618cc16c702efb9647fbe86108 (diff)
downloadast2050-yocto-poky-ceb5c4d8c1ebbe96c8ad9e97514792ce3d9d2f50.zip
ast2050-yocto-poky-ceb5c4d8c1ebbe96c8ad9e97514792ce3d9d2f50.tar.gz
meta-yocto-bsp: oeqa/controllers: add BeagleBoneTarget
With a serial connection and beaglebone setup correctly as per README.hardware (nand erased, default uboot config assumed, etc) and a correctly deployed core-image-testmaster, we could actually deploy and test AB built images. In the default configuration u-boot will do the right thing and will always boot into the master image (rootfs on second fs on the card, kernel in /boot on the same partition). We just need to tell it for the test image to use the third partition and update the kernel cmdline. Pexpect is used to interact with whatever serial connection we have (which for this target is mandatory). There is some handling for images that don't contain the kernel and dtb files as needed (such as core-image-minimal). Implements [YOCTO #6252]. (From meta-yocto rev: 8235464faf480811b17b062cb9aad8ebf1cd2a67) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-yocto-bsp')
-rw-r--r--meta-yocto-bsp/lib/oeqa/controllers/__init__.py0
-rw-r--r--meta-yocto-bsp/lib/oeqa/controllers/beaglebonetarget.py94
2 files changed, 94 insertions, 0 deletions
diff --git a/meta-yocto-bsp/lib/oeqa/controllers/__init__.py b/meta-yocto-bsp/lib/oeqa/controllers/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/meta-yocto-bsp/lib/oeqa/controllers/__init__.py
diff --git a/meta-yocto-bsp/lib/oeqa/controllers/beaglebonetarget.py b/meta-yocto-bsp/lib/oeqa/controllers/beaglebonetarget.py
new file mode 100644
index 0000000..53f454b
--- /dev/null
+++ b/meta-yocto-bsp/lib/oeqa/controllers/beaglebonetarget.py
@@ -0,0 +1,94 @@
+# Copyright (C) 2014 Intel Corporation
+#
+# Released under the MIT license (see COPYING.MIT)
+
+# This module adds support to testimage.bbclass to deploy images and run
+# tests on a BeagleBone (original "white" or Black models). The device must
+# be set up as per README.hardware and the master image should be deployed
+# onto the card so that it boots into it by default. For booting into the
+# image under test we interact with u-boot over serial, so for the
+# BeagleBone Black you will need an additional TTL serial cable since a
+# serial interface isn't automatically provided over the USB connection as
+# it is on the original BeagleBone ("white") version. The separate ext3
+# partition that will contain the image to be tested must be labelled
+# "testrootfs" so that the deployment code below can find it.
+#
+# NOTE: for the BeagleBone "white" (original version) you may need to use
+# a script which handles the serial device disappearing on power down, such
+# as scripts/contrib/serdevtry in OE-Core.
+
+import os
+import bb
+import time
+import subprocess
+import sys
+import pexpect
+
+import oeqa.utils.sshcontrol as sshcontrol
+from oeqa.controllers.masterimage import MasterImageHardwareTarget
+
+
+class BeagleBoneTarget(MasterImageHardwareTarget):
+
+ def __init__(self, d):
+ super(BeagleBoneTarget, self).__init__(d)
+
+ self.dtbs = [('uImage-am335x-bone.dtb', 'am335x-bone.dtb'),
+ ('uImage-am335x-boneblack.dtb', 'am335x-boneblack.dtb')]
+
+ self.deploy_cmds = [
+ 'mkdir -p /mnt/testrootfs',
+ 'mount -L testrootfs /mnt/testrootfs',
+ 'rm -rf /mnt/testrootfs/*',
+ 'tar xzvf ~/test-rootfs.tar.gz -C /mnt/testrootfs',
+ '[ ! -e /mnt/testrootfs/boot/uImage ] && cp ~/test-kernel /mnt/testrootfs/boot/uImage',
+ ]
+
+ for _, dtbfn in self.dtbs:
+ # Kernel and dtb files may not be in the image, so copy them if not
+ self.deploy_cmds.append('[ ! -e /mnt/testrootfs/boot/{0} ] && cp ~/{0} /mnt/testrootfs/boot/'.format(dtbfn))
+
+ if not self.serialcontrol_cmd:
+ bb.fatal("This TEST_TARGET needs a TEST_SERIALCONTROL_CMD defined in local.conf.")
+
+
+ def _deploy(self):
+ self.master.run("umount /boot; umount /mnt/testrootfs;")
+ self.master.ignore_status = False
+ # Kernel and dtb files may not be in the image, so copy them just in case
+ self.master.copy_to(self.kernel, "~/test-kernel")
+ kernelpath = os.path.dirname(self.kernel)
+ for dtborig, dtbfn in self.dtbs:
+ dtbfile = os.path.join(kernelpath, dtborig)
+ if os.path.exists(dtbfile):
+ self.master.copy_to(dtbfile, "~/%s" % dtbfn)
+ self.master.copy_to(self.rootfs, "~/test-rootfs.tar.gz")
+ for cmd in self.deploy_cmds:
+ self.master.run(cmd)
+
+ def _start(self, params=None):
+ self.power_cycle(self.master)
+ try:
+ serialconn = pexpect.spawn(self.serialcontrol_cmd, env=self.origenv, logfile=sys.stdout)
+ # We'd wait for "U-Boot" here but sometimes we connect too late on BeagleBone white to see it
+ serialconn.expect("NAND:")
+ serialconn.expect("MMC:")
+ serialconn.sendline("a")
+ serialconn.expect("U-Boot#")
+ serialconn.sendline("setenv bootpart 0:3")
+ serialconn.expect("U-Boot#")
+ serialconn.sendline("setenv mmcroot /dev/mmcblk0p3 ro")
+ serialconn.expect("U-Boot#")
+ serialconn.sendline("boot")
+ serialconn.expect("login:", timeout=120)
+ serialconn.close()
+ except pexpect.ExceptionPexpect as e:
+ bb.fatal('Serial interaction failed: %s' % str(e))
+
+ def _wait_until_booted(self):
+ try:
+ serialconn = pexpect.spawn(self.serialcontrol_cmd, env=self.origenv, logfile=sys.stdout)
+ serialconn.expect("login:", timeout=120)
+ serialconn.close()
+ except pexpect.ExceptionPexpect as e:
+ bb.fatal('Serial interaction failed: %s' % str(e))
OpenPOWER on IntegriCloud