diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 588: Add uefi interactive boot support

Message ID 20130425100216.24058.58253.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Dave Pigott April 25, 2013, 10:02 a.m. UTC
Merge authors:
  Dave Pigott (dpigott)
Related merge proposals:
  https://code.launchpad.net/~dpigott/lava-dispatcher/add-arndale-uefi-support/+merge/155765
  proposed by: Dave Pigott (dpigott)
  review: Needs Fixing - Antonio Terceiro (terceiro)
  review: Resubmit - Dave Pigott (dpigott)
------------------------------------------------------------
revno: 588 [merge]
committer: dave.pigott@linaro.org
branch nick: trunk
timestamp: Thu 2013-04-25 11:00:17 +0100
message:
  Add uefi interactive boot support
added:
  lava_dispatcher/default-config/lava-dispatcher/device-types/arndale-uefi.conf
  lava_dispatcher/device/uefi.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription
diff mbox

Patch

=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/arndale-uefi.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/arndale-uefi.conf	1970-01-01 00:00:00 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/arndale-uefi.conf	2013-04-17 09:33:07 +0000
@@ -0,0 +1,48 @@ 
+boot_part = 2
+root_part = 3
+
+boot_cmds = sendline a,
+           expect Choice:,
+           sendline 1,
+           expect Select the Boot Device:,
+           sendline 2,
+           expect File path of the EFI Application or the kernel:,
+           sendline uImage,
+           expect Boot Type: [a] ATAGS, [g] Global FDT or [l] Local FDT? [a/g/l],
+           sendline g,
+           expect Add an initrd: [y/n],
+           sendline y,
+           expect File path of the initrd:,
+           sendline uInitrd,
+           expect Arguments to pass to the binary:,
+           sendline "root=/dev/mmcblk1p6 rw rootwait console=ttySAC2,115200n8 init --no-log",
+           expect Description for this new Entry:,
+           sendline Test Image,
+           expect Choice:,
+           sendline 5,
+           expect Start:,
+           sendline 2
+
+
+client_type = uefi
+
+boot_cmds_android = 3
+
+interrupt_boot_prompt = The default boot selection will start in
+
+bootloader_prompt = Start:
+
+lmc_dev_arg = arndale
+
+# Original linaro-android-media-create generated Android system SD card layout
+boot_part_android_org = 2
+sys_part_android_org = 3
+cache_part_android_org = 5
+data_part_android_org = 6
+sdcard_part_android_org = 7
+
+# Android LAVA test image SD card layout
+sys_part_android = 6
+sdcard_part_android = 7
+data_part_android = 7
+

=== added file 'lava_dispatcher/device/uefi.py'
--- lava_dispatcher/device/uefi.py	1970-01-01 00:00:00 +0000
+++ lava_dispatcher/device/uefi.py	2013-04-17 09:37:29 +0000
@@ -0,0 +1,60 @@ 
+# Copyright (C) 2013 Linaro Limited
+#
+# Author: Dave Pigott <dave.pigott@linaro.org>
+#
+# This file is part of LAVA Dispatcher.
+#
+# LAVA Dispatcher is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# LAVA Dispatcher is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along
+# with this program; if not, see <http://www.gnu.org/licenses>.
+
+import logging
+import re
+from lava_dispatcher.device.master import (
+    MasterImageTarget
+)
+
+class UEFITarget(MasterImageTarget):
+
+    def __init__(self, context, config):
+        super(UEFITarget, self).__init__(context, config)
+
+    def _boot(self, boot_cmds):
+        """
+
+        :param boot_cmds:
+        :raise:
+        """
+        try:
+            self._soft_reboot()
+            self._enter_bootloader()
+        except:
+            logging.exception("enter uefi failed")
+            self._hard_reboot()
+            self._enter_bootloader()
+        self.proc.expect(self.config.bootloader_prompt, timeout=300)
+        for line in range(0, len(boot_cmds)):
+            parts = re.match('^(?P<action>sendline|expect)\s*(?P<command>.*)', line)
+            try:
+                action = parts.group('action')
+                command = re.escape(parts.group('command'))
+            except AttributeError as e:
+                raise Exception("Badly formatted command in boot_cmds %s" % e)
+            if action == "sendline":
+                self.proc.sendline(command)
+            elif action == "expect":
+                self.proc.expect(command, timeout=300)
+            else:
+                raise Exception("Unrecognised action in boot_cmds")
+
+target_class = UEFITarget