path: root/meta-yocto-bsp
diff options
authorPaul Eggleton <>2014-04-30 12:38:59 (GMT)
committerRichard Purdie <>2014-04-30 20:52:44 (GMT)
commit57acd08270395cf6b14f408c226d52a7f6740d38 (patch)
treee2f1d5fcd4d6cfa5f19a4db5c04deea1f66c45de /meta-yocto-bsp
parentceb5c4d8c1ebbe96c8ad9e97514792ce3d9d2f50 (diff)
meta-yocto-bsp: oeqa/controllers: add EdgeRouterTarget
Based on BeagleBoneTarget, this provides support for deploying images and running tests on an EdgeRouter Lite (edgerouter). The device must be set up to boot into the master image already - see the instructions in the file. Implements [YOCTO #6253]. (From meta-yocto rev: 6e28284f0dacb40f7533161bfaeb637723297947) Signed-off-by: Paul Eggleton <> Signed-off-by: Richard Purdie <>
Diffstat (limited to 'meta-yocto-bsp')
1 files changed, 89 insertions, 0 deletions
diff --git a/meta-yocto-bsp/lib/oeqa/controllers/ b/meta-yocto-bsp/lib/oeqa/controllers/
new file mode 100644
index 0000000..5df9fda
--- /dev/null
+++ b/meta-yocto-bsp/lib/oeqa/controllers/
@@ -0,0 +1,89 @@
1# Copyright (C) 2014 Intel Corporation
3# Released under the MIT license (see COPYING.MIT)
5# This module adds support to testimage.bbclass to deploy images and run
6# tests on a Ubiquiti Networks EdgeRouter Lite. The device must be set up
7# to boot into the master image already - the easiest way to do that is as
8# follows:
10# 1. Take out the internal USB drive and plug it into your PC
11# 2. Repartition the USB drive so that you have three partitions in this
12# order:
13# 1: vfat, labelled "boot" (it will need to be formatted with mkfs.vfat
14# for this to be possible, since FAT partitions formatted under
15# DOS/Windows will only support uppercase labels)
16# 2: ext3 (for master image) labelled "testmaster"
17# 3: ext3 (for image under test) labelled "testrootfs"
18# 3. Copy the kernel to be used by the master image to the FAT partition
19# (it should be named "vmlinux.64" with the factory u-boot configuration)
20# 4. Install the master image onto the "testmaster" ext3 partition. If
21# you do this by just extracting the contents of an image onto the
22# partition, you will also likely need to create the master image marker
23# file /etc/masterimage within this partition so that we can tell when
24# we're booted into it that it is the master image.
25# 5. Put the USB drive back into the device, and ensure the console port
26# and first ethernet port are connected before powering on
28# TEST_SERIALCONTROL_CMD will need to be set in local.conf so that we can
29# interact with u-boot over the serial console port.
31import os
32import bb
33import time
34import subprocess
35import sys
36import pexpect
38import oeqa.utils.sshcontrol as sshcontrol
39from oeqa.controllers.masterimage import MasterImageHardwareTarget
42class EdgeRouterTarget(MasterImageHardwareTarget):
44 def __init__(self, d):
45 super(EdgeRouterTarget, self).__init__(d)
47 self.deploy_cmds = [
48 'mount -L boot /boot',
49 'mkdir -p /mnt/testrootfs',
50 'mount -L testrootfs /mnt/testrootfs',
51 'cp ~/test-kernel /boot',
52 'rm -rf /mnt/testrootfs/*',
53 'tar xzvf ~/test-rootfs.tar.gz -C /mnt/testrootfs'
54 ]
55 if not self.serialcontrol_cmd:
56 bb.fatal("This TEST_TARGET needs a TEST_SERIALCONTROL_CMD defined in local.conf.")
59 def _deploy(self):
60"umount /mnt/testrootfs;")
61 self.master.ignore_status = False
62 self.master.copy_to(self.kernel, "~/test-kernel")
63 self.master.copy_to(self.rootfs, "~/test-rootfs.tar.gz")
64 for cmd in self.deploy_cmds:
67 def _start(self, params=None):
68 self.power_cycle(self.master)
69 try:
70 serialconn = pexpect.spawn(self.serialcontrol_cmd, env=self.origenv, logfile=sys.stdout)
71 serialconn.expect("U-Boot")
72 serialconn.sendline("a")
73 serialconn.expect("Octeon ubnt_e100#")
74 serialconn.sendline("fatload usb 0:1 $loadaddr test-kernel")
75 serialconn.expect(" bytes read")
76 serialconn.expect("Octeon ubnt_e100#")
77 serialconn.sendline("bootoctlinux $loadaddr coremask=0x3 root=/dev/sda3 rw rootwait mtdparts=phys_mapped_flash:512k(boot0),512k(boot1),64k@3072k(eeprom)")
78 serialconn.expect("login:", timeout=120)
79 serialconn.close()
80 except pexpect.ExceptionPexpect as e:
81 bb.fatal('Serial interaction failed: %s' % str(e))
83 def _wait_until_booted(self):
84 try:
85 serialconn = pexpect.spawn(self.serialcontrol_cmd, env=self.origenv, logfile=sys.stdout)
86 serialconn.expect("login:", timeout=120)
87 serialconn.close()
88 except pexpect.ExceptionPexpect as e:
89 bb.fatal('Serial interaction failed: %s' % str(e))