Merge lp:~doanac/lava-dispatcher/uefi-from-prak into lp:lava-dispatcher

Proposed by Andy Doan
Status: Rejected
Rejected by: Neil Williams
Proposed branch: lp:~doanac/lava-dispatcher/uefi-from-prak
Merge into: lp:lava-dispatcher
Diff against target: 366 lines (+199/-4)
10 files modified
lava_dispatcher/actions/boot_control.py (+22/-0)
lava_dispatcher/actions/deploy.py (+14/-0)
lava_dispatcher/client/base.py (+14/-0)
lava_dispatcher/client/targetdevice.py (+9/-0)
lava_dispatcher/config.py (+1/-0)
lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf (+5/-0)
lava_dispatcher/default-config/lava-dispatcher/device-types/origen.conf (+5/-0)
lava_dispatcher/device/fastmodel.py (+8/-0)
lava_dispatcher/device/master.py (+118/-4)
lava_dispatcher/device/target.py (+3/-0)
To merge this branch: bzr merge lp:~doanac/lava-dispatcher/uefi-from-prak
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+137243@code.launchpad.net

Description of the change

These are the changes from Prakash for UEFI booting in Origen. I've made them into a proper branch so we can discuss the changes.

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) wrote :
Download full text (7.9 KiB)

Hey Guys,

I turned this into a proper merge proposal on LP so we have a way to
discuss the changes. My comments are below, basically - I'm pretty sure
we can dramatically simplify this to be a very small change (my guess
<15 lines of code).

On 11/30/2012 09:54 AM, Andy Doan wrote:
> === modified file 'lava_dispatcher/actions/boot_control.py'
> --- lava_dispatcher/actions/boot_control.py 2012-11-20 21:22:17 +0000
> +++ lava_dispatcher/actions/boot_control.py 2012-11-30 15:53:29 +0000
> @@ -70,6 +70,28 @@
> finally:
> self.context.test_data.add_result("boot_image", status)
>
> +### UEFI
> +
> +class cmd_boot_linaro_uefi_image(BaseAction):
> + """ Call client code to boot to the master image
> + """
> +
> + parameters_schema = _boot_schema
> +
> + def run(self,options=[]):
> + client = self.client
> + client.target_device.boot_options = options
> + status = 'pass'
> + try:
> + client.boot_linaro_uefi_image()
> + except:
> + logging.exception("boot_linaro_image failed")
> + status = 'fail'
> + raise CriticalError("Failed to boot uefi test image.")
> + finally:
> + self.context.test_data.add_result("boot_uefi_image",status)
> +
> +### UEFI

I don't think this is needed. See my comments for the deploy logic in
master.py below.

> === modified file 'lava_dispatcher/actions/deploy.py'
> --- lava_dispatcher/actions/deploy.py 2012-11-20 13:34:19 +0000
> +++ lava_dispatcher/actions/deploy.py 2012-11-30 15:53:29 +0000
> @@ -91,6 +91,20 @@
> def run(self, boot, system, data, rootfstype='ext4'):
> self.client.deploy_linaro_android(boot, system, data, rootfstype)
>
> +## UEFI ##
> +class cmd_deploy_linaro_uefi_image(BaseAction):
> + parameters_schema = {
> + 'type': 'object',
> + 'properties' : {
> + 'hwpack': {'type':'string','optional': True},
> + 'rootfs' : {'type':'string','optional': True},
> + },
> + 'additionalProperties': False,
> + }
> +
> + def run(self, hwpack, rootfs):
> + self.client.deploy_linaro_uefi(hwpack,rootfs)
> +## UEFI ##

I don't think this is needed. See my comments for the deploy logic in
master.py below.

> === modified file 'lava_dispatcher/client/base.py'
> --- lava_dispatcher/client/base.py 2012-11-29 08:54:47 +0000
> +++ lava_dispatcher/client/base.py 2012-11-30 15:53:29 +0000
> @@ -402,6 +402,20 @@
> self.setup_proxy(TESTER_PS1_PATTERN)
> logging.info("System is in test image now")
>
> +### UEFI
> + def boot_linaro_uefi_image(self):
> + """
> + Reboot the system to the uefi test image
> + """
> + logging.info("Boot the uefi test image")
> +
> + self._boot_linaro_uefi_image()
> +
> + wait_for_prompt(self.proc,'/bin/sh', timeout=300)
> + logging.info("System is in test image now")
> +
> +### UEFI
> +

I don't think this is needed. See my comments for the deploy logic in
master.py below.

> === modified file 'lava_dispatcher/client/targetdevice.py'
> --- lava_dispatcher/client/targetdevice.py 2012-11-21 22:07:45 +0000
> +++ lava_dis...

Read more...

Unmerged revisions

474. By Andy Doan

uefi support changes from prakash

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_dispatcher/actions/boot_control.py'
2--- lava_dispatcher/actions/boot_control.py 2012-11-20 21:22:17 +0000
3+++ lava_dispatcher/actions/boot_control.py 2012-11-30 15:53:29 +0000
4@@ -70,6 +70,28 @@
5 finally:
6 self.context.test_data.add_result("boot_image", status)
7
8+### UEFI
9+
10+class cmd_boot_linaro_uefi_image(BaseAction):
11+ """ Call client code to boot to the master image
12+ """
13+
14+ parameters_schema = _boot_schema
15+
16+ def run(self,options=[]):
17+ client = self.client
18+ client.target_device.boot_options = options
19+ status = 'pass'
20+ try:
21+ client.boot_linaro_uefi_image()
22+ except:
23+ logging.exception("boot_linaro_image failed")
24+ status = 'fail'
25+ raise CriticalError("Failed to boot uefi test image.")
26+ finally:
27+ self.context.test_data.add_result("boot_uefi_image",status)
28+
29+### UEFI
30
31 class cmd_boot_master_image(BaseAction):
32 """ Call client code to boot to the master image
33
34=== modified file 'lava_dispatcher/actions/deploy.py'
35--- lava_dispatcher/actions/deploy.py 2012-11-20 13:34:19 +0000
36+++ lava_dispatcher/actions/deploy.py 2012-11-30 15:53:29 +0000
37@@ -91,6 +91,20 @@
38 def run(self, boot, system, data, rootfstype='ext4'):
39 self.client.deploy_linaro_android(boot, system, data, rootfstype)
40
41+## UEFI ##
42+class cmd_deploy_linaro_uefi_image(BaseAction):
43+ parameters_schema = {
44+ 'type': 'object',
45+ 'properties' : {
46+ 'hwpack': {'type':'string','optional': True},
47+ 'rootfs' : {'type':'string','optional': True},
48+ },
49+ 'additionalProperties': False,
50+ }
51+
52+ def run(self, hwpack, rootfs):
53+ self.client.deploy_linaro_uefi(hwpack,rootfs)
54+## UEFI ##
55
56 class cmd_dummy_deploy(BaseAction):
57
58
59=== modified file 'lava_dispatcher/client/base.py'
60--- lava_dispatcher/client/base.py 2012-11-29 08:54:47 +0000
61+++ lava_dispatcher/client/base.py 2012-11-30 15:53:29 +0000
62@@ -402,6 +402,20 @@
63 self.setup_proxy(TESTER_PS1_PATTERN)
64 logging.info("System is in test image now")
65
66+### UEFI
67+ def boot_linaro_uefi_image(self):
68+ """
69+ Reboot the system to the uefi test image
70+ """
71+ logging.info("Boot the uefi test image")
72+
73+ self._boot_linaro_uefi_image()
74+
75+ wait_for_prompt(self.proc,'/bin/sh', timeout=300)
76+ logging.info("System is in test image now")
77+
78+### UEFI
79+
80 def get_www_scratch_dir(self):
81 """ returns a temporary directory available for downloads that gets
82 deleted when the process exits """
83
84=== modified file 'lava_dispatcher/client/targetdevice.py'
85--- lava_dispatcher/client/targetdevice.py 2012-11-21 22:07:45 +0000
86+++ lava_dispatcher/client/targetdevice.py 2012-11-30 15:53:29 +0000
87@@ -50,6 +50,10 @@
88 def deploy_linaro_android(self, boot, system, data, rootfstype='ext4'):
89 self.target_device.deploy_android(boot, system, data)
90
91+## UEFI ##
92+ def deploy_linaro_uefi(self,hwpack,rootfs):
93+ self.target_device.deploy_uefi(hwpack,rootfs)
94+## UEFI ##
95 def deploy_linaro(self, hwpack=None, rootfs=None, image=None,
96 rootfstype='ext3', bootloader='u_boot'):
97 if image is None:
98@@ -68,6 +72,11 @@
99 def _boot_linaro_image(self):
100 self.proc = self.target_device.power_on()
101
102+### UEFI
103+ def _boot_linaro_uefi_image(self):
104+ self.proc = self.target_device.uefi_power_on()
105+
106+### UEFI
107 def _boot_linaro_android_image(self):
108 """Booting android or ubuntu style images don't differ much"""
109
110
111=== modified file 'lava_dispatcher/config.py'
112--- lava_dispatcher/config.py 2012-11-30 01:54:29 +0000
113+++ lava_dispatcher/config.py 2012-11-30 15:53:29 +0000
114@@ -73,6 +73,7 @@
115 simulator_version_command = schema.StringOption()
116 simulator_command = schema.StringOption()
117 simulator_axf_files = schema.ListOption()
118+ boot_cmds_uefi = schema.StringOption(fatal=True) ### UEFI
119
120 class OptionDescriptor(object):
121 def __init__(self, name):
122
123=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf'
124--- lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 2012-11-30 01:54:29 +0000
125+++ lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 2012-11-30 15:53:29 +0000
126@@ -34,6 +34,11 @@
127 # XXX should be called # boot_oe_test_image_commands ?
128 boot_cmds_oe =
129
130+
131+### UEFI
132+boot_cmds_uefi =
133+### UEFI
134+
135 # The device type. Settings in device-types/${DEVICE_TYPE}.conf
136 # override settings in this file, but are overridden by the
137 # devices/${DEVICE}.conf file.
138
139=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/origen.conf'
140--- lava_dispatcher/default-config/lava-dispatcher/device-types/origen.conf 2012-06-29 08:42:13 +0000
141+++ lava_dispatcher/default-config/lava-dispatcher/device-types/origen.conf 2012-11-30 15:53:29 +0000
142@@ -24,6 +24,11 @@
143 setenv bootargs "'console=ttySAC2,115200n8 rootwait ro init=/init androidboot.console=ttySAC2'",
144 boot
145
146+
147+boot_cmds_uefi = mmc init,
148+ fatload mmc 0:5 0x43e00000 ORIGENBOARD_EFI.fd,
149+ go 0x43e00000
150+
151 bootloader_prompt = #
152
153 lmc_dev_arg = origen
154
155=== modified file 'lava_dispatcher/device/fastmodel.py'
156--- lava_dispatcher/device/fastmodel.py 2012-11-22 02:14:51 +0000
157+++ lava_dispatcher/device/fastmodel.py 2012-11-30 15:53:29 +0000
158@@ -97,6 +97,7 @@
159 if not self._axf:
160 raise RuntimeError('No AXF found, %r' % os.listdir(subdir))
161
162+
163 def deploy_android(self, boot, system, data):
164 logging.info("Deploying Android on %s" % self.config.hostname)
165
166@@ -114,6 +115,13 @@
167
168 self._customize_android()
169
170+## UEFI ##
171+ def deploy_uefi(self,bootfs,rootfs):
172+ logging.info("[UEFI fast_model.py: deploy_uefi]: %s" % self.bootfs)
173+ logging.info("[UEFI fast_model.py: deploy_uefi]: %s" % self.rootfs)
174+
175+## UEFI ##
176+
177 def deploy_linaro(self, hwpack=None, rootfs=None, bootloader='u_boot'):
178 hwpack = download_image(hwpack, self.context, decompress=False)
179 rootfs = download_image(rootfs, self.context, decompress=False)
180
181=== modified file 'lava_dispatcher/device/master.py'
182--- lava_dispatcher/device/master.py 2012-11-30 01:57:34 +0000
183+++ lava_dispatcher/device/master.py 2012-11-30 15:53:29 +0000
184@@ -70,6 +70,7 @@
185 Target.android_deployment_data['boot_cmds'] = 'boot_cmds_android'
186 Target.ubuntu_deployment_data['boot_cmds'] = 'boot_cmds'
187 Target.oe_deployment_data['boot_cmds'] = 'boot_cmds_oe'
188+ Target.uefi_deployment_data['boot_cmds'] = 'boot_cmds_uefi'
189
190 # used for tarballcache logic to get proper boot_cmds
191 Target.ubuntu_deployment_data['data_type'] = 'ubuntu'
192@@ -78,6 +79,7 @@
193 'android': Target.android_deployment_data,
194 'oe': Target.oe_deployment_data,
195 'ubuntu': Target.ubuntu_deployment_data,
196+ 'uefi': Target.uefi_deployment_data,
197 }
198
199 self.master_ip = None
200@@ -92,6 +94,12 @@
201 self._boot_linaro_image()
202 return self.proc
203
204+### UEFI
205+ def uefi_power_on(self):
206+ self._boot_linaro_uefi_image()
207+ return self.proc
208+### UEFI
209+
210 def power_off(self, proc):
211 # we always leave master image devices powered on
212 pass
213@@ -104,6 +112,97 @@
214
215 self._deploy_tarballs(boot_tgz, root_tgz)
216
217+## UEFI ##
218+ def deploy_uefi(self,hwpack,rootfs):
219+ logging.info("[UEFI master.py: deploy_uefi]: %s" % hwpack)
220+ logging.info("[UEFI master.py: deploy_uefi]: %s" % rootfs)
221+ self.boot_master_image()
222+
223+ self._deploy_uefi_tarballs(hwpack,rootfs)
224+
225+
226+
227+ def _deploy_uefi_bootfs(self,session, hwpack, timeout = 1,num_retry = 5):
228+ logging.info("[UEFI master.py: deploy_uefi_bootfs")
229+ session.run('udevadm trigger')
230+ session.run('mkdir -p /mnt/boot')
231+ session.run('mount /dev/disk/by-label/testboot /mnt/boot')
232+ num_retry = 5
233+ while num_retry > 0:
234+ try:
235+ logging.info('Hwpack %s'% hwpack)
236+ session.run('wget --no-check-certificate --no-proxy --connect-timeout=30 -S --progress=dot -e dotbytes=2M %s'
237+ % (hwpack),timeout=-1)
238+ session.run('tar --no-same-owner -xvf boot.tgz -C /mnt/boot/')
239+ session.run('sudo rm -rf boot.tgz')
240+ session.run('sudo umount /mnt/boot/')
241+ return
242+ except (OperationFailed, pexpect.TIMEOUT):
243+ logging.warning(("transfering %s failed. %d retry left."
244+ % (hwpack, num_retry - 1)))
245+
246+ if num_retry > 1:
247+ # send CTRL C in case wget still hasn't exited.
248+ self.proc.sendcontrol("c")
249+ self.proc.sendline(
250+ "echo 'retry left %s time(s)'" % (num_retry - 1))
251+ # And wait a little while.
252+ sleep_time = 60
253+ logging.info("Wait %d second before retry" % sleep_time)
254+ time.sleep(sleep_time)
255+ num_retry = num_retry - 1
256+
257+ raise RuntimeError('Deploying bootfs %s on target failed' % hwpack)
258+
259+ def _deploy_uefi_rootfs(self,session, rootfs, timeout = 1,num_retry = 5):
260+ logging.info("[UEFI master.py: deploy_uefi_rootfs")
261+ session.run('udevadm trigger')
262+ session.run('mkdir -p /mnt/root')
263+ session.run('mount /dev/disk/by-label/testrootfs /mnt/root')
264+ num_retry = 5
265+ while num_retry > 0:
266+ try:
267+ logging.info('Hwpack %s' % rootfs)
268+ session.run('wget --no-check-certificate --no-proxy --connect-timeout=30 -S --progress=dot -e dotbytes=2M %s'
269+ % (rootfs),timeout=-1)
270+ session.run('tar --no-same-owner -xvf root.tgz -C /mnt/root/')
271+ session.run('sudo rm -rf root.tgz')
272+ session.run('sudo umount /mnt/root/')
273+
274+ return
275+ except (OperationFailed, pexpect.TIMEOUT):
276+ logging.warning(("transfering %s failed. %d retry left."
277+ % (rootfs, num_retry - 1)))
278+
279+ if num_retry > 1:
280+ # send CTRL C in case wget still hasn't exited.
281+ self.proc.sendcontrol("c")
282+ self.proc.sendline(
283+ "echo 'retry left %s time(s)'" % (num_retry - 1))
284+ # And wait a little while.
285+ sleep_time = 60
286+ logging.info("Wait %d second before retry" % sleep_time)
287+ time.sleep(sleep_time)
288+ num_retry = num_retry - 1
289+
290+ raise RuntimeError('Deploying bootfs %s on target failed' % rootfs)
291+
292+ def _deploy_uefi_tarballs(self,hwpack,rootfs):
293+ logging.info("[UEFI master.py: _deploy_uefi_tarball]:")
294+ with self._as_master() as master:
295+ self._format_testpartition(master, 'ext3')
296+ try:
297+ self._deploy_uefi_rootfs(master, rootfs)
298+ self._deploy_uefi_bootfs(master, hwpack)
299+ except:
300+ logging.error("Deployment failed")
301+ tb = traceback.format_exc()
302+ self.sio.write(tb)
303+ raise CriticalError("Deployment failed")
304+
305+ self.deployment_data = Target.uefi_deployment_data
306+
307+## UEFI ##
308 def deploy_android(self, boot, system, userdata):
309 self.boot_master_image()
310
311@@ -459,14 +558,30 @@
312 raise Exception("Faile to enter uboot")
313 self.proc.sendline(self.config.interrupt_boot_command)
314
315+
316 def _boot_linaro_image(self):
317 boot_cmds = self.deployment_data['boot_cmds']
318 options = boot_options.as_dict(self)
319 if 'boot_cmds' in options:
320 boot_cmds = options['boot_cmds'].value
321-
322- boot_cmds = getattr(self.config, boot_cmds)
323- self._boot(string_to_list(boot_cmds.encode('ascii')))
324+ loggin.info (self.config)
325+ boot_cmds = getattr(self.config, boot_cmds)
326+ self._boot(string_to_list(boot_cmds.encode('ascii')))
327+
328+### UEFI
329+ def _boot_linaro_uefi_image(self):
330+ self.deployment_data = Target.uefi_deployment_data
331+ boot_cmds = self.deployment_data['boot_cmds']
332+ options = boot_options.as_dict(self)
333+ if 'boot_cmds' in options:
334+ boot_cmds = options['boot_cmds'].value
335+
336+ boot_cmds = getattr(self.config, boot_cmds)
337+ self._boot(string_to_list(boot_cmds.encode('ascii')))
338+
339+
340+### UEFI
341+
342
343 def _boot(self, boot_cmds):
344 try:
345@@ -481,7 +596,6 @@
346 self.proc.expect(self.config.bootloader_prompt, timeout=300)
347 self.proc.sendline(boot_cmds[line])
348
349-
350 target_class = MasterImageTarget
351
352
353
354=== modified file 'lava_dispatcher/device/target.py'
355--- lava_dispatcher/device/target.py 2012-11-15 21:23:20 +0000
356+++ lava_dispatcher/device/target.py 2012-11-30 15:53:29 +0000
357@@ -62,6 +62,9 @@
358 'TESTER_PS1_PATTERN': "linaro-test \[rc=(\d+)\]# ",
359 'TESTER_PS1_INCLUDES_RC': True,
360 }
361+ uefi_deployment_data = {
362+ 'TESTER_PS1_INCLUDES_RC': True,
363+ }
364
365 def __init__(self, context, device_config):
366 self.context = context

Subscribers

People subscribed via source and target branches