Merge lp:~dpigott/lava-dispatcher/add-bootloader-support into lp:lava-dispatcher

Proposed by Dave Pigott
Status: Merged
Merged at revision: 459
Proposed branch: lp:~dpigott/lava-dispatcher/add-bootloader-support
Merge into: lp:lava-dispatcher
Diff against target: 136 lines (+17/-16)
6 files modified
lava_dispatcher/actions/deploy.py (+3/-2)
lava_dispatcher/client/lmc_utils.py (+6/-6)
lava_dispatcher/client/targetdevice.py (+2/-2)
lava_dispatcher/device/fastmodel.py (+2/-2)
lava_dispatcher/device/master.py (+2/-2)
lava_dispatcher/device/qemu.py (+2/-2)
To merge this branch: bzr merge lp:~dpigott/lava-dispatcher/add-bootloader-support
Reviewer Review Type Date Requested Status
Dave Pigott Approve
Review via email: mp+135151@code.launchpad.net

Description of the change

Added in an option to specify a bootloader in the json file. If not specified, it defaults to 'u_boot'

To post a comment you must log in.
Revision history for this message
Fathi Boudra (fboudra) wrote :

It's worth mentioning that 'u_boot' is just a string and can be anything.
You can use linaro-media-create --read-hwpack to get the supported bootloaders and pass a valid string.

Revision history for this message
Fathi Boudra (fboudra) wrote :
Revision history for this message
Dave Pigott (dpigott) wrote :

I know, and I thought long and hard about which was the right way to go. At the end of the day, the solution was much more flexible this way, since you can also get a return such as:

+--------------------------------------+--------------------------------------+
Supported boards | Supported bootloaders
+--------------------------------------+--------------------------------------+
linaro-vexpress | uefi,u_boot
+--------------------------------------+--------------------------------------+

It would not be possible to decide which one to pick.

This way, the person or process creating and submitting jobs is responsible for picking the right one, and if new ones get added, then those just get done as well.

There will probably be some other work to do in the way the lava dispatcher handles things when interrupting boot, but that's not a problem when sd-mux arrives.

Revision history for this message
Dave Pigott (dpigott) wrote :

And actually, since it is indeed a free format string, then if somebody decides to call u_boot "neddy-the-bootloader" we have no way of knowing what sort of bootloader it really is. I guess what I'm advocating is that we should standardise on a naming convention in the hwpacks. Otherwise we are asking for a lot of trouble.

Another key point is that if the dispatcher made a decision about the bootloader, then that goes against someone explicitly trying to specify and test a particular bootloader when we get to that point.

Revision history for this message
Andy Doan (doanac) wrote :

seems okay. In general I'm a little uncomfortable with inserting a function parameter rather than appending it to the list. However, it looks like you grep'd through code and fixed all the references where this was affected.

Revision history for this message
Andy Doan (doanac) wrote :

On 11/20/2012 07:47 AM, Fathi Boudra wrote:
> It's worth mentioning that 'u_boot' is just a string and can be anything.
> You can use linaro-media-create --read-hwpack to get the supported bootloaders and pass a valid string.

Yes, but that should only matter if we are auto-guessing for the user,
right? Can we just get away with requiring users to provide the
bootloader they want in the event its not u-boot?

Revision history for this message
Fathi Boudra (fboudra) wrote :

On 20 November 2012 17:48, Andy Doan wrote:
> On 11/20/2012 07:47 AM, Fathi Boudra wrote:
>>
>> It's worth mentioning that 'u_boot' is just a string and can be anything.
>> You can use linaro-media-create --read-hwpack to get the supported
>> bootloaders and pass a valid string.
>
> Yes, but that should only matter if we are auto-guessing for the user,
> right? Can we just get away with requiring users to provide the bootloader
> they want in the event its not u-boot?

You're already guessing that the default bootloader is U-Boot and its
label is called 'u_boot'.
I don't think you have to guess as the hwpack provides the default
bootloader and also the label.
No interaction with the user here.

Revision history for this message
Fathi Boudra (fboudra) wrote :

On 20 November 2012 16:24, Dave Pigott wrote:
> I know, and I thought long and hard about which was the right way to go. At the end of the day, the solution was much more flexible this way, since you can also get a return such as:
>
> +--------------------------------------+--------------------------------------+
> Supported boards | Supported bootloaders
> +--------------------------------------+--------------------------------------+
> linaro-vexpress | uefi,u_boot
> +--------------------------------------+--------------------------------------+
>
> It would not be possible to decide which one to pick.

According to the output, default bootloader is UEFI and the label is 'uefi'.

Revision history for this message
Dave Pigott (dpigott) wrote :

Yeah, I checked thoroughly, because I prefer to have function parameters in a logical sequence.

Sent from my Aldis Lamp

On 20 Nov 2012, at 15:46, Andy Doan <email address hidden> wrote:

> seems okay. In general I'm a little uncomfortable with inserting a function parameter rather than appending it to the list. However, it looks like you grep'd through code and fixed all the references where this was affected.
> --
> https://code.launchpad.net/~dpigott/lava-dispatcher/add-bootloader-support/+merge/135151
> You are the owner of lp:~dpigott/lava-dispatcher/add-bootloader-support.

Revision history for this message
Dave Pigott (dpigott) wrote :

Ok. So what you're saying is that to support this, we need to accept a selection in the JSON file, and then use the read-hwpack option to determine if it's valid. If nothing is specified we use the first in the list for the matching device type.

That's probably enough to push it into backlog, to be honest. If my change is unsupportable, then let's just throw it away,

On 20 Nov 2012, at 16:01, Fathi Boudra <email address hidden> wrote:

> On 20 November 2012 17:48, Andy Doan wrote:
>> On 11/20/2012 07:47 AM, Fathi Boudra wrote:
>>>
>>> It's worth mentioning that 'u_boot' is just a string and can be anything.
>>> You can use linaro-media-create --read-hwpack to get the supported
>>> bootloaders and pass a valid string.
>>
>> Yes, but that should only matter if we are auto-guessing for the user,
>> right? Can we just get away with requiring users to provide the bootloader
>> they want in the event its not u-boot?
>
> You're already guessing that the default bootloader is U-Boot and its
> label is called 'u_boot'.
> I don't think you have to guess as the hwpack provides the default
> bootloader and also the label.
> No interaction with the user here.
>
> --
> https://code.launchpad.net/~dpigott/lava-dispatcher/add-bootloader-support/+merge/135151
> You are the owner of lp:~dpigott/lava-dispatcher/add-bootloader-support.

Revision history for this message
Andy Doan (doanac) wrote :

On 11/20/2012 10:58 AM, Dave Pigott wrote:
> Ok. So what you're saying is that to support this, we need to accept a selection in the JSON file, and then use the read-hwpack option to determine if it's valid. If nothing is specified we use the first in the list for the matching device type.
>
> That's probably enough to push it into backlog, to be honest. If my change is unsupportable, then let's just throw it away,

Fathi and I discussed on IRC. I think what you have now is good. I don't
think we need to do validation of the bootloader parameter. we'll put
the responsibility on the user for now. In the, likely near, future we
can do Fathi's suggesion and validated (or automatically choose) based
on this l-m-c command.

Revision history for this message
Dave Pigott (dpigott) wrote :

On 20 Nov 2012, at 17:05, Andy Doan <email address hidden> wrote:

> On 11/20/2012 10:58 AM, Dave Pigott wrote:
>> Ok. So what you're saying is that to support this, we need to accept a selection in the JSON file, and then use the read-hwpack option to determine if it's valid. If nothing is specified we use the first in the list for the matching device type.
>>
>> That's probably enough to push it into backlog, to be honest. If my change is unsupportable, then let's just throw it away,
>
> Fathi and I discussed on IRC. I think what you have now is good. I don't think we need to do validation of the bootloader parameter. we'll put the responsibility on the user for now. In the, likely near, future we can do Fathi's suggesion and validated (or automatically choose) based on this l-m-c command.

Cool.

Revision history for this message
Dave Pigott (dpigott) wrote :

On 20 Nov 2012, at 17:07, Andy Doan <email address hidden> wrote:

> On 11/20/2012 10:58 AM, Dave Pigott wrote:
>> Ok. So what you're saying is that to support this, we need to accept a selection in the JSON file, and then use the read-hwpack option to determine if it's valid. If nothing is specified we use the first in the list for the matching device type.
>>
>> That's probably enough to push it into backlog, to be honest. If my change is unsupportable, then let's just throw it away,
>
> Fathi and I discussed on IRC. I think what you have now is good. I don't
> think we need to do validation of the bootloader parameter. we'll put
> the responsibility on the user for now. In the, likely near, future we
> Efaucan do Fathi's suggesion and validated (or automatically choose) based
> on this l-m-c command.
>

Actually, the sensible behaviour is for l-m-c to, by default, use the default boot loader if none is specified, since they have to inspect the hwpack anyway. Then they'll immediately fail if the requested one doesn't exist.

Revision history for this message
Andy Doan (doanac) wrote :

On 11/20/2012 11:16 AM, Dave Pigott wrote:
> Actually, the sensible behaviour is for l-m-c to, by default, use the default boot loader if none is specified, since they have to inspect the hwpack anyway. Then they'll immediately fail if the requested one doesn't exist.

yeah, that's what I was trying to say. sorry I wasn't clear.

Revision history for this message
Dave Pigott (dpigott) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lava_dispatcher/actions/deploy.py'
--- lava_dispatcher/actions/deploy.py 2012-10-24 01:34:07 +0000
+++ lava_dispatcher/actions/deploy.py 2012-11-20 13:38:19 +0000
@@ -54,6 +54,7 @@
54 'rootfs': {'type': 'string', 'optional': True},54 'rootfs': {'type': 'string', 'optional': True},
55 'image': {'type': 'string', 'optional': True},55 'image': {'type': 'string', 'optional': True},
56 'rootfstype': {'type': 'string', 'optional': True},56 'rootfstype': {'type': 'string', 'optional': True},
57 'bootloader': {'type': 'string', 'optional': True, 'default': 'u_boot'},
57 },58 },
58 'additionalProperties': False,59 'additionalProperties': False,
59 }60 }
@@ -69,9 +70,9 @@
69 elif 'image' not in parameters:70 elif 'image' not in parameters:
70 raise ValueError('must specify image if not specifying a hwpack')71 raise ValueError('must specify image if not specifying a hwpack')
7172
72 def run(self, hwpack=None, rootfs=None, image=None, rootfstype='ext3'):73 def run(self, hwpack=None, rootfs=None, image=None, rootfstype='ext3', bootloader='u_boot'):
73 self.client.deploy_linaro(74 self.client.deploy_linaro(
74 hwpack=hwpack, rootfs=rootfs, image=image, rootfstype=rootfstype)75 hwpack=hwpack, rootfs=rootfs, image=image, rootfstype=rootfstype, bootloader=bootloader)
7576
7677
77class cmd_deploy_linaro_android_image(BaseAction):78class cmd_deploy_linaro_android_image(BaseAction):
7879
=== modified file 'lava_dispatcher/client/lmc_utils.py'
--- lava_dispatcher/client/lmc_utils.py 2012-09-27 21:59:57 +0000
+++ lava_dispatcher/client/lmc_utils.py 2012-11-20 13:38:19 +0000
@@ -15,7 +15,7 @@
15 )15 )
1616
1717
18def generate_image(client, hwpack_url, rootfs_url, outdir, rootfstype=None):18def generate_image(client, hwpack_url, rootfs_url, outdir, bootloader='u_boot', rootfstype=None):
19 """Generate image from a hwpack and rootfs url19 """Generate image from a hwpack and rootfs url
2020
21 :param hwpack_url: url of the Linaro hwpack to download21 :param hwpack_url: url of the Linaro hwpack to download
@@ -43,8 +43,8 @@
43 logging.info("client.device_type = %s" %client.config.device_type)43 logging.info("client.device_type = %s" %client.config.device_type)
4444
45 cmd = ("sudo flock /var/lock/lava-lmc.lck linaro-media-create --hwpack-force-yes --dev %s "45 cmd = ("sudo flock /var/lock/lava-lmc.lck linaro-media-create --hwpack-force-yes --dev %s "
46 "--image-file %s --binary %s --hwpack %s --image-size 3G" %46 "--image-file %s --binary %s --hwpack %s --image-size 3G --bootloader %s" %
47 (client.config.lmc_dev_arg, image_file, rootfs_path, hwpack_path))47 (client.config.lmc_dev_arg, image_file, rootfs_path, hwpack_path, bootloader))
48 if rootfstype is not None:48 if rootfstype is not None:
49 cmd += ' --rootfs ' + rootfstype49 cmd += ' --rootfs ' + rootfstype
50 logging.info("Executing the linaro-media-create command")50 logging.info("Executing the linaro-media-create command")
@@ -53,11 +53,11 @@
53 _run_linaro_media_create(cmd)53 _run_linaro_media_create(cmd)
54 return image_file54 return image_file
5555
56def generate_fastmodel_image(hwpack, rootfs, odir, size="2000M"):56def generate_fastmodel_image(hwpack, rootfs, odir, bootloader='u_boot', size="2000M"):
57 cmd = ("flock /var/lock/lava-lmc.lck sudo linaro-media-create "57 cmd = ("flock /var/lock/lava-lmc.lck sudo linaro-media-create "
58 "--dev fastmodel --output-directory %s --image-size %s "58 "--dev fastmodel --output-directory %s --image-size %s "
59 "--hwpack %s --binary %s --hwpack-force-yes" %59 "--hwpack %s --binary %s --hwpack-force-yes --bootloader %s" %
60 (odir, size, hwpack, rootfs) )60 (odir, size, hwpack, rootfs, bootloader) )
61 logging.info("Generating fastmodel image with: %s" % cmd)61 logging.info("Generating fastmodel image with: %s" % cmd)
62 _run_linaro_media_create(cmd)62 _run_linaro_media_create(cmd)
6363
6464
=== modified file 'lava_dispatcher/client/targetdevice.py'
--- lava_dispatcher/client/targetdevice.py 2012-10-26 06:22:05 +0000
+++ lava_dispatcher/client/targetdevice.py 2012-11-20 13:38:19 +0000
@@ -50,7 +50,7 @@
50 self.target_device.deploy_android(boot, system, data)50 self.target_device.deploy_android(boot, system, data)
5151
52 def deploy_linaro(self, hwpack=None, rootfs=None, image=None,52 def deploy_linaro(self, hwpack=None, rootfs=None, image=None,
53 rootfstype='ext3'):53 rootfstype='ext3', bootloader='u_boot'):
54 if image is None:54 if image is None:
55 if hwpack is None or rootfs is None:55 if hwpack is None or rootfs is None:
56 raise CriticalError(56 raise CriticalError(
@@ -60,7 +60,7 @@
60 "cannot specify hwpack or rootfs when specifying image")60 "cannot specify hwpack or rootfs when specifying image")
6161
62 if image is None:62 if image is None:
63 self.target_device.deploy_linaro(hwpack, rootfs)63 self.target_device.deploy_linaro(hwpack, rootfs, bootloader)
64 else:64 else:
65 self.target_device.deploy_linaro_prebuilt(image)65 self.target_device.deploy_linaro_prebuilt(image)
6666
6767
=== modified file 'lava_dispatcher/device/fastmodel.py'
--- lava_dispatcher/device/fastmodel.py 2012-11-16 00:47:20 +0000
+++ lava_dispatcher/device/fastmodel.py 2012-11-20 13:38:19 +0000
@@ -113,12 +113,12 @@
113113
114 self._customize_android()114 self._customize_android()
115115
116 def deploy_linaro(self, hwpack=None, rootfs=None):116 def deploy_linaro(self, hwpack=None, rootfs=None, bootloader='u_boot'):
117 hwpack = download_image(hwpack, self.context, decompress=False)117 hwpack = download_image(hwpack, self.context, decompress=False)
118 rootfs = download_image(rootfs, self.context, decompress=False)118 rootfs = download_image(rootfs, self.context, decompress=False)
119 odir = os.path.dirname(rootfs)119 odir = os.path.dirname(rootfs)
120120
121 generate_fastmodel_image(hwpack, rootfs, odir)121 generate_fastmodel_image(hwpack, rootfs, odir, bootloader)
122 self._sd_image = '%s/sd.img' % odir122 self._sd_image = '%s/sd.img' % odir
123 self._axf = None123 self._axf = None
124 for f in self.config.simulator_axf_files:124 for f in self.config.simulator_axf_files:
125125
=== modified file 'lava_dispatcher/device/master.py'
--- lava_dispatcher/device/master.py 2012-11-16 00:44:40 +0000
+++ lava_dispatcher/device/master.py 2012-11-20 13:38:19 +0000
@@ -94,10 +94,10 @@
94 # we always leave master image devices powered on94 # we always leave master image devices powered on
95 pass95 pass
9696
97 def deploy_linaro(self, hwpack, rfs):97 def deploy_linaro(self, hwpack, rfs, bootloader):
98 self.boot_master_image()98 self.boot_master_image()
9999
100 image_file = generate_image(self, hwpack, rfs, self.scratch_dir)100 image_file = generate_image(self, hwpack, rfs, self.scratch_dir, bootloader)
101 (boot_tgz, root_tgz, data) = self._generate_tarballs(image_file)101 (boot_tgz, root_tgz, data) = self._generate_tarballs(image_file)
102102
103 self._deploy_tarballs(boot_tgz, root_tgz)103 self._deploy_tarballs(boot_tgz, root_tgz)
104104
=== modified file 'lava_dispatcher/device/qemu.py'
--- lava_dispatcher/device/qemu.py 2012-11-15 21:23:20 +0000
+++ lava_dispatcher/device/qemu.py 2012-11-20 13:38:19 +0000
@@ -46,9 +46,9 @@
46 super(QEMUTarget, self).__init__(context, config)46 super(QEMUTarget, self).__init__(context, config)
47 self._sd_image = None47 self._sd_image = None
4848
49 def deploy_linaro(self, hwpack=None, rootfs=None):49 def deploy_linaro(self, hwpack=None, rootfs=None, bootloader='u_boot'):
50 odir = self.scratch_dir50 odir = self.scratch_dir
51 self._sd_image = generate_image(self, hwpack, rootfs, odir)51 self._sd_image = generate_image(self, hwpack, rootfs, odir, bootloader)
52 self._customize_linux(self._sd_image)52 self._customize_linux(self._sd_image)
5353
54 def deploy_linaro_prebuilt(self, image):54 def deploy_linaro_prebuilt(self, image):

Subscribers

People subscribed via source and target branches