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
=== 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 @@
70 finally:70 finally:
71 self.context.test_data.add_result("boot_image", status)71 self.context.test_data.add_result("boot_image", status)
7272
73### UEFI
74
75class cmd_boot_linaro_uefi_image(BaseAction):
76 """ Call client code to boot to the master image
77 """
78
79 parameters_schema = _boot_schema
80
81 def run(self,options=[]):
82 client = self.client
83 client.target_device.boot_options = options
84 status = 'pass'
85 try:
86 client.boot_linaro_uefi_image()
87 except:
88 logging.exception("boot_linaro_image failed")
89 status = 'fail'
90 raise CriticalError("Failed to boot uefi test image.")
91 finally:
92 self.context.test_data.add_result("boot_uefi_image",status)
93
94### UEFI
7395
74class cmd_boot_master_image(BaseAction):96class cmd_boot_master_image(BaseAction):
75 """ Call client code to boot to the master image97 """ Call client code to boot to the master image
7698
=== 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 @@
91 def run(self, boot, system, data, rootfstype='ext4'):91 def run(self, boot, system, data, rootfstype='ext4'):
92 self.client.deploy_linaro_android(boot, system, data, rootfstype)92 self.client.deploy_linaro_android(boot, system, data, rootfstype)
9393
94## UEFI ##
95class cmd_deploy_linaro_uefi_image(BaseAction):
96 parameters_schema = {
97 'type': 'object',
98 'properties' : {
99 'hwpack': {'type':'string','optional': True},
100 'rootfs' : {'type':'string','optional': True},
101 },
102 'additionalProperties': False,
103 }
104
105 def run(self, hwpack, rootfs):
106 self.client.deploy_linaro_uefi(hwpack,rootfs)
107## UEFI ##
94108
95class cmd_dummy_deploy(BaseAction):109class cmd_dummy_deploy(BaseAction):
96110
97111
=== 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 @@
402 self.setup_proxy(TESTER_PS1_PATTERN)402 self.setup_proxy(TESTER_PS1_PATTERN)
403 logging.info("System is in test image now")403 logging.info("System is in test image now")
404404
405### UEFI
406 def boot_linaro_uefi_image(self):
407 """
408 Reboot the system to the uefi test image
409 """
410 logging.info("Boot the uefi test image")
411
412 self._boot_linaro_uefi_image()
413
414 wait_for_prompt(self.proc,'/bin/sh', timeout=300)
415 logging.info("System is in test image now")
416
417### UEFI
418
405 def get_www_scratch_dir(self):419 def get_www_scratch_dir(self):
406 """ returns a temporary directory available for downloads that gets420 """ returns a temporary directory available for downloads that gets
407 deleted when the process exits """421 deleted when the process exits """
408422
=== modified file 'lava_dispatcher/client/targetdevice.py'
--- lava_dispatcher/client/targetdevice.py 2012-11-21 22:07:45 +0000
+++ lava_dispatcher/client/targetdevice.py 2012-11-30 15:53:29 +0000
@@ -50,6 +50,10 @@
50 def deploy_linaro_android(self, boot, system, data, rootfstype='ext4'):50 def deploy_linaro_android(self, boot, system, data, rootfstype='ext4'):
51 self.target_device.deploy_android(boot, system, data)51 self.target_device.deploy_android(boot, system, data)
5252
53## UEFI ##
54 def deploy_linaro_uefi(self,hwpack,rootfs):
55 self.target_device.deploy_uefi(hwpack,rootfs)
56## UEFI ##
53 def deploy_linaro(self, hwpack=None, rootfs=None, image=None,57 def deploy_linaro(self, hwpack=None, rootfs=None, image=None,
54 rootfstype='ext3', bootloader='u_boot'):58 rootfstype='ext3', bootloader='u_boot'):
55 if image is None:59 if image is None:
@@ -68,6 +72,11 @@
68 def _boot_linaro_image(self):72 def _boot_linaro_image(self):
69 self.proc = self.target_device.power_on()73 self.proc = self.target_device.power_on()
7074
75### UEFI
76 def _boot_linaro_uefi_image(self):
77 self.proc = self.target_device.uefi_power_on()
78
79### UEFI
71 def _boot_linaro_android_image(self):80 def _boot_linaro_android_image(self):
72 """Booting android or ubuntu style images don't differ much"""81 """Booting android or ubuntu style images don't differ much"""
7382
7483
=== modified file 'lava_dispatcher/config.py'
--- lava_dispatcher/config.py 2012-11-30 01:54:29 +0000
+++ lava_dispatcher/config.py 2012-11-30 15:53:29 +0000
@@ -73,6 +73,7 @@
73 simulator_version_command = schema.StringOption()73 simulator_version_command = schema.StringOption()
74 simulator_command = schema.StringOption()74 simulator_command = schema.StringOption()
75 simulator_axf_files = schema.ListOption()75 simulator_axf_files = schema.ListOption()
76 boot_cmds_uefi = schema.StringOption(fatal=True) ### UEFI
7677
77class OptionDescriptor(object):78class OptionDescriptor(object):
78 def __init__(self, name):79 def __init__(self, name):
7980
=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 2012-11-30 01:54:29 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 2012-11-30 15:53:29 +0000
@@ -34,6 +34,11 @@
34# XXX should be called # boot_oe_test_image_commands ?34# XXX should be called # boot_oe_test_image_commands ?
35boot_cmds_oe =35boot_cmds_oe =
3636
37
38### UEFI
39boot_cmds_uefi =
40### UEFI
41
37# The device type. Settings in device-types/${DEVICE_TYPE}.conf42# The device type. Settings in device-types/${DEVICE_TYPE}.conf
38# override settings in this file, but are overridden by the43# override settings in this file, but are overridden by the
39# devices/${DEVICE}.conf file.44# devices/${DEVICE}.conf file.
4045
=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/origen.conf'
--- lava_dispatcher/default-config/lava-dispatcher/device-types/origen.conf 2012-06-29 08:42:13 +0000
+++ lava_dispatcher/default-config/lava-dispatcher/device-types/origen.conf 2012-11-30 15:53:29 +0000
@@ -24,6 +24,11 @@
24 setenv bootargs "'console=ttySAC2,115200n8 rootwait ro init=/init androidboot.console=ttySAC2'",24 setenv bootargs "'console=ttySAC2,115200n8 rootwait ro init=/init androidboot.console=ttySAC2'",
25 boot25 boot
2626
27
28boot_cmds_uefi = mmc init,
29 fatload mmc 0:5 0x43e00000 ORIGENBOARD_EFI.fd,
30 go 0x43e00000
31
27bootloader_prompt = #32bootloader_prompt = #
2833
29lmc_dev_arg = origen34lmc_dev_arg = origen
3035
=== modified file 'lava_dispatcher/device/fastmodel.py'
--- lava_dispatcher/device/fastmodel.py 2012-11-22 02:14:51 +0000
+++ lava_dispatcher/device/fastmodel.py 2012-11-30 15:53:29 +0000
@@ -97,6 +97,7 @@
97 if not self._axf:97 if not self._axf:
98 raise RuntimeError('No AXF found, %r' % os.listdir(subdir))98 raise RuntimeError('No AXF found, %r' % os.listdir(subdir))
9999
100
100 def deploy_android(self, boot, system, data):101 def deploy_android(self, boot, system, data):
101 logging.info("Deploying Android on %s" % self.config.hostname)102 logging.info("Deploying Android on %s" % self.config.hostname)
102103
@@ -114,6 +115,13 @@
114115
115 self._customize_android()116 self._customize_android()
116117
118## UEFI ##
119 def deploy_uefi(self,bootfs,rootfs):
120 logging.info("[UEFI fast_model.py: deploy_uefi]: %s" % self.bootfs)
121 logging.info("[UEFI fast_model.py: deploy_uefi]: %s" % self.rootfs)
122
123## UEFI ##
124
117 def deploy_linaro(self, hwpack=None, rootfs=None, bootloader='u_boot'):125 def deploy_linaro(self, hwpack=None, rootfs=None, bootloader='u_boot'):
118 hwpack = download_image(hwpack, self.context, decompress=False)126 hwpack = download_image(hwpack, self.context, decompress=False)
119 rootfs = download_image(rootfs, self.context, decompress=False)127 rootfs = download_image(rootfs, self.context, decompress=False)
120128
=== modified file 'lava_dispatcher/device/master.py'
--- lava_dispatcher/device/master.py 2012-11-30 01:57:34 +0000
+++ lava_dispatcher/device/master.py 2012-11-30 15:53:29 +0000
@@ -70,6 +70,7 @@
70 Target.android_deployment_data['boot_cmds'] = 'boot_cmds_android'70 Target.android_deployment_data['boot_cmds'] = 'boot_cmds_android'
71 Target.ubuntu_deployment_data['boot_cmds'] = 'boot_cmds'71 Target.ubuntu_deployment_data['boot_cmds'] = 'boot_cmds'
72 Target.oe_deployment_data['boot_cmds'] = 'boot_cmds_oe'72 Target.oe_deployment_data['boot_cmds'] = 'boot_cmds_oe'
73 Target.uefi_deployment_data['boot_cmds'] = 'boot_cmds_uefi'
7374
74 # used for tarballcache logic to get proper boot_cmds75 # used for tarballcache logic to get proper boot_cmds
75 Target.ubuntu_deployment_data['data_type'] = 'ubuntu'76 Target.ubuntu_deployment_data['data_type'] = 'ubuntu'
@@ -78,6 +79,7 @@
78 'android': Target.android_deployment_data,79 'android': Target.android_deployment_data,
79 'oe': Target.oe_deployment_data,80 'oe': Target.oe_deployment_data,
80 'ubuntu': Target.ubuntu_deployment_data,81 'ubuntu': Target.ubuntu_deployment_data,
82 'uefi': Target.uefi_deployment_data,
81 }83 }
8284
83 self.master_ip = None85 self.master_ip = None
@@ -92,6 +94,12 @@
92 self._boot_linaro_image()94 self._boot_linaro_image()
93 return self.proc95 return self.proc
9496
97### UEFI
98 def uefi_power_on(self):
99 self._boot_linaro_uefi_image()
100 return self.proc
101### UEFI
102
95 def power_off(self, proc):103 def power_off(self, proc):
96 # we always leave master image devices powered on104 # we always leave master image devices powered on
97 pass105 pass
@@ -104,6 +112,97 @@
104112
105 self._deploy_tarballs(boot_tgz, root_tgz)113 self._deploy_tarballs(boot_tgz, root_tgz)
106114
115## UEFI ##
116 def deploy_uefi(self,hwpack,rootfs):
117 logging.info("[UEFI master.py: deploy_uefi]: %s" % hwpack)
118 logging.info("[UEFI master.py: deploy_uefi]: %s" % rootfs)
119 self.boot_master_image()
120
121 self._deploy_uefi_tarballs(hwpack,rootfs)
122
123
124
125 def _deploy_uefi_bootfs(self,session, hwpack, timeout = 1,num_retry = 5):
126 logging.info("[UEFI master.py: deploy_uefi_bootfs")
127 session.run('udevadm trigger')
128 session.run('mkdir -p /mnt/boot')
129 session.run('mount /dev/disk/by-label/testboot /mnt/boot')
130 num_retry = 5
131 while num_retry > 0:
132 try:
133 logging.info('Hwpack %s'% hwpack)
134 session.run('wget --no-check-certificate --no-proxy --connect-timeout=30 -S --progress=dot -e dotbytes=2M %s'
135 % (hwpack),timeout=-1)
136 session.run('tar --no-same-owner -xvf boot.tgz -C /mnt/boot/')
137 session.run('sudo rm -rf boot.tgz')
138 session.run('sudo umount /mnt/boot/')
139 return
140 except (OperationFailed, pexpect.TIMEOUT):
141 logging.warning(("transfering %s failed. %d retry left."
142 % (hwpack, num_retry - 1)))
143
144 if num_retry > 1:
145 # send CTRL C in case wget still hasn't exited.
146 self.proc.sendcontrol("c")
147 self.proc.sendline(
148 "echo 'retry left %s time(s)'" % (num_retry - 1))
149 # And wait a little while.
150 sleep_time = 60
151 logging.info("Wait %d second before retry" % sleep_time)
152 time.sleep(sleep_time)
153 num_retry = num_retry - 1
154
155 raise RuntimeError('Deploying bootfs %s on target failed' % hwpack)
156
157 def _deploy_uefi_rootfs(self,session, rootfs, timeout = 1,num_retry = 5):
158 logging.info("[UEFI master.py: deploy_uefi_rootfs")
159 session.run('udevadm trigger')
160 session.run('mkdir -p /mnt/root')
161 session.run('mount /dev/disk/by-label/testrootfs /mnt/root')
162 num_retry = 5
163 while num_retry > 0:
164 try:
165 logging.info('Hwpack %s' % rootfs)
166 session.run('wget --no-check-certificate --no-proxy --connect-timeout=30 -S --progress=dot -e dotbytes=2M %s'
167 % (rootfs),timeout=-1)
168 session.run('tar --no-same-owner -xvf root.tgz -C /mnt/root/')
169 session.run('sudo rm -rf root.tgz')
170 session.run('sudo umount /mnt/root/')
171
172 return
173 except (OperationFailed, pexpect.TIMEOUT):
174 logging.warning(("transfering %s failed. %d retry left."
175 % (rootfs, num_retry - 1)))
176
177 if num_retry > 1:
178 # send CTRL C in case wget still hasn't exited.
179 self.proc.sendcontrol("c")
180 self.proc.sendline(
181 "echo 'retry left %s time(s)'" % (num_retry - 1))
182 # And wait a little while.
183 sleep_time = 60
184 logging.info("Wait %d second before retry" % sleep_time)
185 time.sleep(sleep_time)
186 num_retry = num_retry - 1
187
188 raise RuntimeError('Deploying bootfs %s on target failed' % rootfs)
189
190 def _deploy_uefi_tarballs(self,hwpack,rootfs):
191 logging.info("[UEFI master.py: _deploy_uefi_tarball]:")
192 with self._as_master() as master:
193 self._format_testpartition(master, 'ext3')
194 try:
195 self._deploy_uefi_rootfs(master, rootfs)
196 self._deploy_uefi_bootfs(master, hwpack)
197 except:
198 logging.error("Deployment failed")
199 tb = traceback.format_exc()
200 self.sio.write(tb)
201 raise CriticalError("Deployment failed")
202
203 self.deployment_data = Target.uefi_deployment_data
204
205## UEFI ##
107 def deploy_android(self, boot, system, userdata):206 def deploy_android(self, boot, system, userdata):
108 self.boot_master_image()207 self.boot_master_image()
109208
@@ -459,14 +558,30 @@
459 raise Exception("Faile to enter uboot")558 raise Exception("Faile to enter uboot")
460 self.proc.sendline(self.config.interrupt_boot_command)559 self.proc.sendline(self.config.interrupt_boot_command)
461560
561
462 def _boot_linaro_image(self):562 def _boot_linaro_image(self):
463 boot_cmds = self.deployment_data['boot_cmds']563 boot_cmds = self.deployment_data['boot_cmds']
464 options = boot_options.as_dict(self)564 options = boot_options.as_dict(self)
465 if 'boot_cmds' in options:565 if 'boot_cmds' in options:
466 boot_cmds = options['boot_cmds'].value566 boot_cmds = options['boot_cmds'].value
467567 loggin.info (self.config)
468 boot_cmds = getattr(self.config, boot_cmds)568 boot_cmds = getattr(self.config, boot_cmds)
469 self._boot(string_to_list(boot_cmds.encode('ascii')))569 self._boot(string_to_list(boot_cmds.encode('ascii')))
570
571### UEFI
572 def _boot_linaro_uefi_image(self):
573 self.deployment_data = Target.uefi_deployment_data
574 boot_cmds = self.deployment_data['boot_cmds']
575 options = boot_options.as_dict(self)
576 if 'boot_cmds' in options:
577 boot_cmds = options['boot_cmds'].value
578
579 boot_cmds = getattr(self.config, boot_cmds)
580 self._boot(string_to_list(boot_cmds.encode('ascii')))
581
582
583### UEFI
584
470585
471 def _boot(self, boot_cmds):586 def _boot(self, boot_cmds):
472 try:587 try:
@@ -481,7 +596,6 @@
481 self.proc.expect(self.config.bootloader_prompt, timeout=300)596 self.proc.expect(self.config.bootloader_prompt, timeout=300)
482 self.proc.sendline(boot_cmds[line])597 self.proc.sendline(boot_cmds[line])
483598
484
485target_class = MasterImageTarget599target_class = MasterImageTarget
486600
487601
488602
=== modified file 'lava_dispatcher/device/target.py'
--- lava_dispatcher/device/target.py 2012-11-15 21:23:20 +0000
+++ lava_dispatcher/device/target.py 2012-11-30 15:53:29 +0000
@@ -62,6 +62,9 @@
62 'TESTER_PS1_PATTERN': "linaro-test \[rc=(\d+)\]# ",62 'TESTER_PS1_PATTERN': "linaro-test \[rc=(\d+)\]# ",
63 'TESTER_PS1_INCLUDES_RC': True,63 'TESTER_PS1_INCLUDES_RC': True,
64 }64 }
65 uefi_deployment_data = {
66 'TESTER_PS1_INCLUDES_RC': True,
67 }
6568
66 def __init__(self, context, device_config):69 def __init__(self, context, device_config):
67 self.context = context70 self.context = context

Subscribers

People subscribed via source and target branches