Merge lp:~liuyq0307/lava-dispatcher/test-bootloader into lp:lava-dispatcher

Proposed by Yongqin Liu
Status: Merged
Merged at revision: 473
Proposed branch: lp:~liuyq0307/lava-dispatcher/test-bootloader
Merge into: lp:lava-dispatcher
Diff against target: 212 lines (+114/-11)
4 files modified
lava_dispatcher/client/base.py (+3/-0)
lava_dispatcher/client/master.py (+82/-11)
lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf (+21/-0)
lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf (+8/-0)
To merge this branch: bzr merge lp:~liuyq0307/lava-dispatcher/test-bootloader
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+123225@code.launchpad.net

Description of the change

This modification will support to use the boot loader of the test images when we can load the test boot loader from the master boot loader

And by this mechanism, we can resolve the problem of booting omapzoom and aosp panda build in lava

have tested with the panda-stable build from https://android-build.linaro.org/builds/~linaro-android/panda-jb-gcc47-tilt-stable-blob/#build=51

and aosp build from my local on my local lava instance

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

This approach makes me a bit nervous. We are basically chain-loading boot loaders. Its really cool, but I don't know if its safe and worth the additional cost of code maintenence. If we really can't get around boot loaders, maybe we should put some specific u-boot version on some boards in the lab and tag them, so certain builds can use them?

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

W dniu 10.09.2012 19:49, Andy Doan pisze:
> This approach makes me a bit nervous. We are basically chain-loading boot loaders. Its really cool, but I don't know if its safe and worth the additional cost of code maintenence. If we really can't get around boot loaders, maybe we should put some specific u-boot version on some boards in the lab and tag them, so certain builds can use them?

Chain loading bootloaders basically tests something else than the boot
loader booting as the first thing on a given hardware.

I'd say it's interesting but the value is limited. Having said that I'm
not really opposed to it.

PS: Testing my canonical.com account while I get my linaro.net account ready

Thanks
ZK

Revision history for this message
Yongqin Liu (liuyq0307) wrote :

> This approach makes me a bit nervous. We are basically chain-loading boot
> loaders. Its really cool, but I don't know if its safe and worth the
> additional cost of code maintenence.
If possible, can we ask some u-boot experienced guys, if this is ok in theory?
If this is ok, I actually like to use the test boot loader to load the test image.

> If we really can't get around boot
> loaders, maybe we should put some specific u-boot version on some boards in
> the lab and tag them, so certain builds can use them?
This is ok I think, what we need is just two version master images.
one version for aosp-panda and omapzoom-panda builds, and one for others.

Revision history for this message
Loïc Minier (lool) wrote :

On Fri, Sep 07, 2012, Yongqin Liu wrote:
> + if change_test_bootloader_delay and change_test_bootloader_delay == "1":
> + sed_cmd = 'sed -i s/bootdelay=0/bootdelay=9/ /mnt/lava/boot/u-boot.bin'

sed-ing binary files does scare me; other options I can think of:
* unpack + sed + repack boot.scr
* sed uEnv.txt
* configure our bootloaders to use lava.txt or lava.scr file if present

Another angle would be to provide such a set of features in our Linaro
images, wrapped under some firmware management scripts; e.g. a
set-boot-delay script that we'd call from LAVA, but this is a lot of
integration work for a relatively weird use case. We could also patch
u-boot to detect that it's running under LAVA and do something special,
but I don't have a specific idea on what do to there.

--
Loïc Minier

Revision history for this message
Yongqin Liu (liuyq0307) wrote :

On 11 September 2012 20:01, Loïc Minier <email address hidden> wrote:
> On Fri, Sep 07, 2012, Yongqin Liu wrote:
>> + if change_test_bootloader_delay and change_test_bootloader_delay == "1":
>> + sed_cmd = 'sed -i s/bootdelay=0/bootdelay=9/ /mnt/lava/boot/u-boot.bin'
>
> sed-ing binary files does scare me;
yes, this is the ways I don't like too.
I have tried to use preEnv.txt on the same partition of testboot,
but it does not make sense.

> other options I can think of:
> * unpack + sed + repack boot.scr
> * sed uEnv.txt
> * configure our bootloaders to use lava.txt or lava.scr file if present
you mean modify the u-boot source?

> Another angle would be to provide such a set of features in our Linaro
> images, wrapped under some firmware management scripts; e.g. a
> set-boot-delay script that we'd call from LAVA, but this is a lot of
> integration work for a relatively weird use case. We could also patch
> u-boot to detect that it's running under LAVA and do something special,
> but I don't have a specific idea on what do to there.
>
> --
> Loïc Minier
>
> https://code.launchpad.net/~liuyq0307/lava-dispatcher/test-bootloader/+merge/123225
> You are the owner of lp:~liuyq0307/lava-dispatcher/test-bootloader.

--
Thanks,
Yongqin Liu
---------------------------------------------------------------
#mailing list
<email address hidden>
http://lists.linaro.org/mailman/listinfo/linaro-android
<email address hidden>
http://lists.linaro.org/pipermail/linaro-validation

Revision history for this message
Loïc Minier (lool) wrote :

On Tue, Sep 11, 2012, Yongqin Liu wrote:
> you mean modify the u-boot source?

Yes; maybe this is too intrusive, but I felt it was more elegant and
robust; I list other options though

--
Loïc Minier

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_dispatcher/client/base.py'
2--- lava_dispatcher/client/base.py 2012-08-23 15:33:00 +0000
3+++ lava_dispatcher/client/base.py 2012-09-07 07:34:35 +0000
4@@ -449,6 +449,9 @@
5 """Reboot the system to the test android image."""
6 self._boot_linaro_android_image()
7 self.in_test_shell(timeout=900)
8+ # ensure we are root (AOSP is not root upon initial login)
9+ # and make PS1 changed after run su command
10+ self.proc.sendline('su')
11 self.proc.sendline("export PS1=\"root@linaro: \"")
12 self.proc.expect(self.tester_str, timeout=120)
13 #TODO: set up proxy
14
15=== modified file 'lava_dispatcher/client/master.py'
16--- lava_dispatcher/client/master.py 2012-08-28 04:56:24 +0000
17+++ lava_dispatcher/client/master.py 2012-09-07 07:34:35 +0000
18@@ -24,7 +24,6 @@
19 import os
20 import re
21 import shutil
22-import subprocess
23 import time
24 import traceback
25 import atexit
26@@ -132,8 +131,16 @@
27 session.run('mkdir -p /mnt/boot')
28 session.run('mount /dev/disk/by-label/testboot /mnt/boot')
29 _deploy_tarball_to_board(session, bootfs, '/mnt/boot')
30+
31+ ##make the test uboot to delay 9 seconds
32+ change_test_bootloader_delay = session._client.device_option(
33+ "change_test_bootloader_delay")
34+ if change_test_bootloader_delay and change_test_bootloader_delay == "1":
35+ sed_cmd = 'sed -i s/bootdelay=0/bootdelay=9/ /mnt/lava/boot/u-boot.bin'
36+ session.run(sed_cmd)
37 session.run('umount /mnt/boot')
38
39+
40 def _deploy_linaro_android_testboot(session, boottbz2, pkgbz2=None):
41 logging.info("Deploying test boot filesystem")
42 session.run('umount /dev/disk/by-label/testboot', failok=True)
43@@ -149,6 +156,16 @@
44
45 _recreate_uInitrd(session)
46
47+ ##make the test uboot to delay 9 seconds
48+ change_test_bootloader_delay = session._client.device_option(
49+ "change_test_bootloader_delay")
50+ if change_test_bootloader_delay and change_test_bootloader_delay == "1":
51+ sed_cmd = 'sed -i s/bootdelay=0/bootdelay=9/ /mnt/lava/boot/u-boot.bin'
52+ session.run(sed_cmd)
53+
54+ session.run('umount /mnt/lava/boot')
55+
56+
57 def _update_uInitrd_partitions(session, rc_filename):
58 # Original android sdcard partition layout by l-a-m-c
59 sys_part_org = session._client.device_option("sys_part_android_org")
60@@ -186,14 +203,24 @@
61
62 # The mount partitions have moved from init.rc to init.partitions.rc
63 # For backward compatible with early android build, we updatep both rc files
64- _update_uInitrd_partitions(session, 'init.rc')
65- _update_uInitrd_partitions(session, 'init.partitions.rc')
66+ # For omapzoom and aosp the operation for mounting partitions are
67+ # in init.omap4pandaboard.rc files
68+ possible_partitions_files = string_to_list(
69+ session._client.config.get(
70+ 'possible_partitions_files'))
71+
72+ for f in possible_partitions_files:
73+ if session.is_file_exist(f):
74+ _update_uInitrd_partitions(session, f)
75+ # Will update the PS1 in init.rc in the following
76+ # So will not cat the file here
77+ if f != 'init.rc':
78+ session.run("cat %s" % f, failok=True)
79
80 session.run(
81 'sed -i "/export PATH/a \ \ \ \ export PS1 root@linaro: " init.rc')
82
83 session.run("cat init.rc")
84- session.run("cat init.partitions.rc", failok=True)
85
86 session.run(
87 'cpio -i -t -F ramdisk.cpio | cpio -o -H newc | \
88@@ -852,9 +879,8 @@
89 index = self.proc.expect(
90 ['.+', pexpect.EOF, pexpect.TIMEOUT], timeout=1, lava_no_logging=1)
91
92- def _enter_uboot(self):
93- interrupt_boot_prompt = self.device_option('interrupt_boot_prompt')
94- if self.proc.expect(interrupt_boot_prompt) != 0:
95+ def _enter_uboot(self, interrupt_prompt):
96+ if self.proc.expect(interrupt_prompt) != 0:
97 raise Exception("Faile to enter uboot")
98
99 interrupt_boot_command = self.device_option('interrupt_boot_command')
100@@ -876,17 +902,62 @@
101 def _boot_linaro_android_image(self):
102 self._boot(string_to_list(self.config.get('boot_cmds_android')))
103
104+ def _get_key_value(self, key, default_key, escape=False):
105+ value = self.device_option(key)
106+ if not value:
107+ value = self.device_option(default_key)
108+
109+ if escape:
110+ return re.escape(value)
111+ else:
112+ return value
113+
114+ @property
115+ def master_loader_interrupt_prompt(self):
116+ return self._get_key_value('master_interrupt_boot_prompt',
117+ 'interrupt_boot_prompt')
118+
119+ @property
120+ def test_loader_interrupt_prompt(self):
121+ return self._get_key_value('test_interrupt_boot_prompt',
122+ 'interrupt_boot_prompt')
123+
124+ @property
125+ def master_bootloader_prompt(self):
126+ return self._get_key_value('master_bootloader_prompt',
127+ 'bootloader_prompt',
128+ escape=True)
129+
130+ @property
131+ def test_bootloader_prompt(self):
132+ return self._get_key_value('test_bootloader_prompt',
133+ 'bootloader_prompt',
134+ escape=True)
135+
136+ def _load_test_bootlader(self, cmds):
137+ for line in range(0, len(cmds)):
138+ self.proc.sendline(cmds[0])
139+ self.proc.sendline(cmds[line])
140+ if line < len(cmds) - 1 :
141+ self.proc.expect(self.master_bootloader_prompt, timeout=300)
142+
143 def _boot(self, boot_cmds):
144 try:
145 self.soft_reboot()
146- self._enter_uboot()
147 except:
148 logging.exception("_enter_uboot failed")
149 self.hard_reboot()
150- self._enter_uboot()
151+
152+ ## enter the master boot loader to load the test boot loader
153+ self._enter_uboot(self.master_loader_interrupt_prompt)
154+ load_test_bootloader_cmds = string_to_list(
155+ self.config.get('load_test_bootloader_cmds'))
156+ if load_test_bootloader_cmds:
157+ self._load_test_bootlader(load_test_bootloader_cmds)
158+ self._enter_uboot(self.test_loader_interrupt_prompt)
159+
160 self.proc.sendline(boot_cmds[0])
161- bootloader_prompt = re.escape(self.device_option('bootloader_prompt'))
162 for line in range(1, len(boot_cmds)):
163- self.proc.expect(bootloader_prompt, timeout=300)
164+ self.proc.expect(self.test_bootloader_prompt, timeout=300)
165 self.proc.sendline(boot_cmds[line])
166
167
168=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf'
169--- lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 2012-08-08 22:31:12 +0000
170+++ lava_dispatcher/default-config/lava-dispatcher/device-defaults.conf 2012-09-07 07:34:35 +0000
171@@ -120,3 +120,24 @@
172 git_url_disablesuspend_sh = "http://android.git.linaro.org/gitweb?p=device/linaro/common.git;a=blob_plain;f=disablesuspend.sh;hb=refs/heads/linaro-ics"
173 # how long the disablesuspend script should take to complete
174 #disablesuspend_timeout = 240
175+
176+# the u-boot command for loading the test bootloader from the master boot loader
177+# Will use the u-boot of the master image to load the test image if not specified
178+load_test_bootloader_cmds =
179+
180+# This is used to when extend the bootdelay in u-boot.bin to 9
181+# when it is 0 default
182+change_test_bootloader_delay =
183+
184+# The message to interrupt into the master boot loader
185+master_interrupt_boot_prompt =
186+# The prompt of the master boot loader
187+master_bootloader_prompt =
188+# The message to interrupt into the test boot loader
189+test_interrupt_boot_prompt =
190+# The prompt of the test boot loader
191+test_bootloader_prompt =
192+
193+# the possible partition files need to be modified for android
194+possible_partitions_files = init.partitions.rc,
195+ init.rc
196
197=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf'
198--- lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf 2012-08-24 19:35:21 +0000
199+++ lava_dispatcher/default-config/lava-dispatcher/device-types/panda.conf 2012-09-07 07:34:35 +0000
200@@ -27,4 +27,12 @@
201 vram=48M omapfb.vram=0:24M'",
202 boot
203
204+change_test_bootloader_delay = 1
205+load_test_bootloader_cmds = fatload mmc 0:3 0x80E80000 u-boot.bin,
206+ go 0x80E80000
207+
208 android_binary_drivers = http://192.168.1.21/LAVA_HTTP/android-binaries/panda-drivers.tgz
209+
210+possible_partitions_files = init.partitions.rc,
211+ init.omap4pandaboard.rc,
212+ init.rc

Subscribers

People subscribed via source and target branches