diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 666: Improve bootloader handling support in image deployment

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

Commit Message

Antonio Terceiro Sept. 4, 2013, 7:53 p.m. UTC
Merge authors:
  Antonio Terceiro (terceiro)
Related merge proposals:
  https://code.launchpad.net/~terceiro/lava-dispatcher/bootloadertype/+merge/183291
  proposed by: Antonio Terceiro (terceiro)
  review: Approve - Tyler Baker (tyler-baker)
------------------------------------------------------------
revno: 666 [merge]
committer: Antonio Terceiro <antonio.terceiro@linaro.org>
branch nick: trunk
timestamp: Wed 2013-09-04 16:19:19 -0300
message:
  Improve bootloader handling support in image deployment
  
  This patch makes two changes:
  
  - first, it addds a bootloadertype argument to the deploy_linaro_prebuilt
    action, which makes it possible to specify which bootloader is present in the
    image. This makes it possible for example to interact with uefi when using a
    prebuilt image, what previosly was only possible with hwpack+rootfs (for
    prebuilt image u-boot was always assumed)
  
  - second, the "bootloader" argument is being renamed to "bootloadertype", which
    is what it actually means.  The `bootloader` device uses a "bootloader"
    argument that actually means the bootloader, i.e. you are supposed to pass
    the URL of a bootloader binary to it.
modified:
  lava_dispatcher/actions/deploy.py
  lava_dispatcher/client/targetdevice.py
  lava_dispatcher/device/bootloader.py
  lava_dispatcher/device/fastmodel.py
  lava_dispatcher/device/ipmi_pxe.py
  lava_dispatcher/device/master.py
  lava_dispatcher/device/qemu.py
  lava_dispatcher/device/sdmux.py
  lava_dispatcher/device/target.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

=== modified file 'lava_dispatcher/actions/deploy.py'
--- lava_dispatcher/actions/deploy.py	2013-08-28 14:55:50 +0000
+++ lava_dispatcher/actions/deploy.py	2013-08-30 22:15:05 +0000
@@ -54,7 +54,7 @@ 
             'rootfs': {'type': 'string', 'optional': True},
             'image': {'type': 'string', 'optional': True},
             'rootfstype': {'type': 'string', 'optional': True},
-            'bootloader': {'type': 'string', 'optional': True, 'default': 'u_boot'},
+            'bootloadertype': {'type': 'string', 'optional': True, 'default': 'u_boot'},
             'role': {'type': 'string', 'optional': True},
         },
         'additionalProperties': False,
@@ -71,9 +71,9 @@ 
         elif 'image' not in parameters:
             raise ValueError('must specify image if not specifying a hwpack')
 
-    def run(self, hwpack=None, rootfs=None, image=None, rootfstype='ext3', bootloader='u_boot'):
+    def run(self, hwpack=None, rootfs=None, image=None, rootfstype='ext3', bootloadertype='u_boot'):
         self.client.deploy_linaro(
-            hwpack=hwpack, rootfs=rootfs, image=image, rootfstype=rootfstype, bootloader=bootloader)
+            hwpack=hwpack, rootfs=rootfs, image=image, rootfstype=rootfstype, bootloadertype=bootloadertype)
 
 
 class cmd_deploy_linaro_android_image(BaseAction):

=== modified file 'lava_dispatcher/client/targetdevice.py'
--- lava_dispatcher/client/targetdevice.py	2013-08-28 14:55:50 +0000
+++ lava_dispatcher/client/targetdevice.py	2013-08-30 22:15:05 +0000
@@ -50,7 +50,7 @@ 
         self.target_device.deploy_android(boot, system, data)
 
     def deploy_linaro(self, hwpack=None, rootfs=None, image=None,
-                      rootfstype='ext3', bootloader='u_boot'):
+                      rootfstype='ext3', bootloadertype='u_boot'):
         if image is None:
             if hwpack is None or rootfs is None:
                 raise CriticalError(
@@ -60,9 +60,9 @@ 
                 "cannot specify hwpack or rootfs when specifying image")
 
         if image is None:
-            self.target_device.deploy_linaro(hwpack, rootfs, bootloader)
+            self.target_device.deploy_linaro(hwpack, rootfs, bootloadertype)
         else:
-            self.target_device.deploy_linaro_prebuilt(image)
+            self.target_device.deploy_linaro_prebuilt(image, bootloadertype)
 
     def deploy_linaro_kernel(self, kernel, ramdisk=None, dtb=None, rootfs=None, 
                              bootloader=None, firmware=None, rootfstype='ext4', 

=== modified file 'lava_dispatcher/device/bootloader.py'
--- lava_dispatcher/device/bootloader.py	2013-08-28 14:55:50 +0000
+++ lava_dispatcher/device/bootloader.py	2013-08-30 22:15:05 +0000
@@ -113,13 +113,13 @@ 
             raise CriticalError("U-Boot is the only supported bootloader \
                                 at this time")
 
-    def deploy_linaro(self, hwpack, rfs, bootloader):
+    def deploy_linaro(self, hwpack, rfs, bootloadertype):
         self._uboot_boot = False
-        super(BootloaderTarget, self).deploy_linaro(hwpack, rfs, bootloader)
+        super(BootloaderTarget, self).deploy_linaro(hwpack, rfs, bootloadertype)
 
-    def deploy_linaro_prebuilt(self, image):
+    def deploy_linaro_prebuilt(self, image, bootloadertype):
         self._uboot_boot = False
-        super(BootloaderTarget, self).deploy_linaro_prebuilt(image)
+        super(BootloaderTarget, self).deploy_linaro_prebuilt(image, bootloadertype)
 
     def _inject_boot_cmds(self):
         if self._is_job_defined_boot_cmds(self.config.boot_cmds):

=== modified file 'lava_dispatcher/device/fastmodel.py'
--- lava_dispatcher/device/fastmodel.py	2013-08-28 14:55:50 +0000
+++ lava_dispatcher/device/fastmodel.py	2013-08-30 22:15:05 +0000
@@ -68,7 +68,7 @@ 
         self._dtb = None
         self._initrd = None
         self._uefi = None
-        self._bootloader = 'u_boot'
+        self._bootloadertype = 'u_boot'
 
     def _customize_android(self):
         with image_partition_mounted(self._sd_image, self.DATA_PARTITION) as d:
@@ -103,7 +103,7 @@ 
 
     def _copy_needed_files_from_directory(self, subdir):
         odir = os.path.dirname(self._sd_image)
-        if self._bootloader == 'u_boot':
+        if self._bootloadertype == 'u_boot':
             # Extract the bootwrapper from the image
             if self.config.simulator_axf_files and self._axf is None:
                 self._axf = self._copy_first_find_from_list(subdir, odir,
@@ -120,14 +120,14 @@ 
             if self.config.simulator_dtb and self._dtb is None:
                 self._dtb = self._find_and_copy(
                     subdir, odir, self.config.simulator_dtb)
-        elif self._bootloader == 'uefi':
+        elif self._bootloadertype == 'uefi':
             # Extract the uefi binary from the image
             if self.config.simulator_uefi and self._uefi is None:
                 self._uefi = self._find_and_copy(
                     subdir, odir, self.config.simulator_uefi)
 
     def _check_needed_files(self):
-        if self._bootloader == 'u_boot':
+        if self._bootloadertype == 'u_boot':
             # AXF is needed when we are not using UEFI
             if self._axf is None and self.config.simulator_axf_files:
                 raise RuntimeError('No AXF found, %r' %
@@ -144,7 +144,7 @@ 
             if self._dtb is None and self.config.simulator_dtb:
                 raise RuntimeError('No DTB found, %r' %
                                    self.config.simulator_dtb)
-        elif self._bootloader == 'uefi':
+        elif self._bootloadertype == 'uefi':
             # UEFI binary is needed when specified
             if self._uefi is None and self.config.simulator_uefi:
                 raise RuntimeError('No UEFI binary found, %r' %
@@ -167,14 +167,14 @@ 
 
         self._customize_android()
 
-    def deploy_linaro(self, hwpack=None, rootfs=None, bootloader='u_boot'):
+    def deploy_linaro(self, hwpack=None, rootfs=None, bootloadertype='u_boot'):
         hwpack = download_image(hwpack, self.context, decompress=False)
         rootfs = download_image(rootfs, self.context, decompress=False)
         odir = os.path.dirname(rootfs)
 
-        self._bootloader = bootloader
+        self._bootloadertype = bootloadertype
 
-        generate_fastmodel_image(self.context, hwpack, rootfs, odir, bootloader)
+        generate_fastmodel_image(self.context, hwpack, rootfs, odir, bootloadertype)
         self._sd_image = '%s/sd.img' % odir
 
         self._copy_needed_files_from_directory(odir)
@@ -183,8 +183,9 @@ 
 
         self._customize_linux(self._sd_image)
 
-    def deploy_linaro_prebuilt(self, image):
+    def deploy_linaro_prebuilt(self, image, bootloadertype):
         self._sd_image = download_image(image, self.context)
+        self._bootloadertype = bootloadertype
 
         self._copy_needed_files_from_partition(self.config.boot_part, 'rtsm')
         self._copy_needed_files_from_partition(self.config.root_part, 'boot')

=== modified file 'lava_dispatcher/device/ipmi_pxe.py'
--- lava_dispatcher/device/ipmi_pxe.py	2013-07-16 16:06:42 +0000
+++ lava_dispatcher/device/ipmi_pxe.py	2013-08-30 22:15:05 +0000
@@ -73,13 +73,13 @@ 
     def power_off(self, proc):
         pass
 
-    def deploy_linaro(self, hwpack, rfs, bootloader):
-        image_file = generate_image(self, hwpack, rfs, self.scratch_dir, bootloader,
+    def deploy_linaro(self, hwpack, rfs, bootloadertype):
+        image_file = generate_image(self, hwpack, rfs, self.scratch_dir, bootloadertype,
                                     extra_boot_args='1', image_size='1G')
         self._customize_linux(image_file)
         self._deploy_image(image_file, '/dev/sda')
 
-    def deploy_linaro_prebuilt(self, image):
+    def deploy_linaro_prebuilt(self, image, bootloadertype):
         image_file = download_image(image, self.context, self.scratch_dir)
         self._customize_linux(image_file)
         self._deploy_image(image_file, '/dev/sda')

=== modified file 'lava_dispatcher/device/master.py'
--- lava_dispatcher/device/master.py	2013-09-03 22:17:25 +0000
+++ lava_dispatcher/device/master.py	2013-09-04 19:19:19 +0000
@@ -106,10 +106,10 @@ 
         if self.config.power_off_cmd:
             self.context.run_command(self.config.power_off_cmd)
 
-    def deploy_linaro(self, hwpack, rfs, bootloader):
+    def deploy_linaro(self, hwpack, rfs, bootloadertype):
         self.boot_master_image()
 
-        image_file = generate_image(self, hwpack, rfs, self.scratch_dir, bootloader)
+        image_file = generate_image(self, hwpack, rfs, self.scratch_dir, bootloadertype)
         (boot_tgz, root_tgz, data) = self._generate_tarballs(image_file)
 
         self._read_boot_cmds(boot_tgz=boot_tgz)
@@ -149,7 +149,7 @@ 
         _deploy_linaro_android_system(master, system_url)
         _deploy_linaro_android_data(master, data_url)
 
-    def deploy_linaro_prebuilt(self, image):
+    def deploy_linaro_prebuilt(self, image, bootloadertype):
         self.boot_master_image()
 
         if self.context.job_data.get('health_check', False):

=== modified file 'lava_dispatcher/device/qemu.py'
--- lava_dispatcher/device/qemu.py	2013-08-28 14:55:50 +0000
+++ lava_dispatcher/device/qemu.py	2013-08-30 22:15:05 +0000
@@ -78,14 +78,14 @@ 
         else:
             raise CriticalError("No kernel images to boot")
 
-    def deploy_linaro(self, hwpack=None, rootfs=None, bootloader='u_boot'):
+    def deploy_linaro(self, hwpack=None, rootfs=None, bootloadertype='u_boot'):
         odir = self.scratch_dir
-        self._sd_image = generate_image(self, hwpack, rootfs, odir, bootloader)
+        self._sd_image = generate_image(self, hwpack, rootfs, odir, bootloadertype)
         self._customize_linux(self._sd_image)
         self.append_qemu_options(self.config.qemu_options.format(
             DISK_IMAGE=self._sd_image))
 
-    def deploy_linaro_prebuilt(self, image):
+    def deploy_linaro_prebuilt(self, image, bootloadertype='u_boot'):
         self._sd_image = download_image(image, self.context)
         self._customize_linux(self._sd_image)
         self.append_qemu_options(self.config.qemu_options.format(

=== modified file 'lava_dispatcher/device/sdmux.py'
--- lava_dispatcher/device/sdmux.py	2013-07-16 16:04:07 +0000
+++ lava_dispatcher/device/sdmux.py	2013-08-30 22:15:05 +0000
@@ -88,12 +88,12 @@ 
         if config.pre_connect_command:
             self.context.run_command(config.pre_connect_command)
 
-    def deploy_linaro(self, hwpack=None, rootfs=None, bootloader=None):
+    def deploy_linaro(self, hwpack=None, rootfs=None, bootloadertype=None):
         img = generate_image(self, hwpack, rootfs, self.scratch_dir)
         self._customize_linux(img)
         self._write_image(img)
 
-    def deploy_linaro_prebuilt(self, image):
+    def deploy_linaro_prebuilt(self, image, bootloadertype=None):
         img = download_image(image, self.context)
         self._customize_linux(img)
         self._write_image(img)

=== modified file 'lava_dispatcher/device/target.py'
--- lava_dispatcher/device/target.py	2013-08-28 14:55:50 +0000
+++ lava_dispatcher/device/target.py	2013-08-30 22:15:05 +0000
@@ -89,13 +89,13 @@ 
         """
         raise NotImplementedError('power_on')
 
-    def deploy_linaro(self, hwpack, rfs, bootloader):
+    def deploy_linaro(self, hwpack, rfs, bootloadertype):
         raise NotImplementedError('deploy_image')
 
     def deploy_android(self, boot, system, userdata):
         raise NotImplementedError('deploy_android_image')
 
-    def deploy_linaro_prebuilt(self, image):
+    def deploy_linaro_prebuilt(self, image, bootloadertype):
         raise NotImplementedError('deploy_linaro_prebuilt')
 
     def power_off(self, proc):