def deploy_linaro_kernel(self, kernel, ramdisk, dtb, overlays, rootfs, nfsrootfs, image, bootloader, firmware, bl0, bl1,
                             bl2, bl31, rootfstype, bootloadertype, target_type, qemu_pflash=None):
        # Required
        if kernel is None:
            raise CriticalError("A kernel image is required")
        elif ramdisk is None:
            raise CriticalError("A ramdisk image is required")

        if rootfs is not None or nfsrootfs is not None or firmware is not None:
            logging.warning("This platform only supports ramdisk booting, ignoring other parameters")

        self._ramdisk_boot = True

        self._kernel = download_image(kernel, self.context, self._scratch_dir,
                                      decompress=False)
        self._boot_tags['{KERNEL}'] = os.path.relpath(self._kernel, self._scratch_dir)
        self._initrd = download_image(ramdisk, self.context, self._scratch_dir,
                                      decompress=False)
        if overlays is not None:
            ramdisk_dir = extract_ramdisk(self._initrd, self._scratch_dir,
                                          is_uboot=self._is_uboot_ramdisk(ramdisk))
            for overlay in overlays:
                overlay = download_image(overlay, self.context,
                                         self._scratch_dir,
                                         decompress=False)
                extract_overlay(overlay, ramdisk_dir)
            self._initrd = create_ramdisk(ramdisk_dir, self._scratch_dir)
        self._boot_tags['{RAMDISK}'] = os.path.relpath(self._initrd, self._scratch_dir)

        # Optional
        if dtb is not None:
            self._dtb = download_image(dtb, self.context, self._scratch_dir,
                                       decompress=False)
            self._boot_tags['{DTB}'] = os.path.relpath(self._dtb, self._scratch_dir)

        if bootloader is None:
            if self.config.simulator_uefi_default is None:
                raise CriticalError("UEFI image is required")
            else:
                self._uefi = download_image(self.config.simulator_uefi_default, self.context,
                                            self._scratch_dir, decompress=False)
        else:
            self._uefi = download_image(bootloader, self.context,
                                        self._scratch_dir, decompress=False)

        if bl1 is None:
            if self.config.simulator_bl1_default is None:
                raise CriticalError("BL1 firmware is required")
            else:
                self._bl1 = download_image(self.config.simulator_bl1_default, self.context,
                                           self._scratch_dir, decompress=False)
        else:
            self._bl1 = download_image(bl1, self.context,
                                       self._scratch_dir, decompress=False)

        if bl0 is not None:
            self._bl0 = download_image(bl0, self.context, self._scratch_dir,
                                       decompress=False)
        if bl2 is not None:
            self._bl2 = download_image(bl2, self.context, self._scratch_dir,
                                       decompress=False)
        if bl31 is not None:
            self._bl31 = download_image(bl31, self.context, self._scratch_dir,
                                        decompress=False)

        if self.config.simulator_uefi_vars and self._uefi_vars is None:
            # Create file for flashloader1
            self._uefi_vars = os.path.join(self._scratch_dir, self.config.simulator_uefi_vars)
            touch(self._uefi_vars)

        # Get deployment data
        self.deployment_data = deployment_data.get(target_type)

        if image is not None:
            self._sd_image = download_image(image, self.context, self._scratch_dir,
                                            decompress=False)
        else:
            # Booting is not supported without an _sd_image defined
            self._sd_image = self._kernel

        self._default_boot_cmds = 'boot_cmds_ramdisk'
Exemple #2
0
    def deploy_linaro_kernel(self, kernel, ramdisk, dtb, overlays, rootfs, nfsrootfs, image, bootloader, firmware, bl0, bl1,
                             bl2, bl31, rootfstype, bootloadertype, target_type, qemu_pflash=None):
        # Required
        if kernel is None:
            raise CriticalError("A kernel image is required")
        elif ramdisk is None:
            raise CriticalError("A ramdisk image is required")

        if rootfs is not None or nfsrootfs is not None or firmware is not None:
            logging.warning("This platform only supports ramdisk booting, ignoring other parameters")

        self._ramdisk_boot = True

        self._kernel = download_image(kernel, self.context, self._scratch_dir,
                                      decompress=False)
        self._boot_tags['{KERNEL}'] = os.path.relpath(self._kernel, self._scratch_dir)
        self._initrd = download_image(ramdisk, self.context, self._scratch_dir,
                                      decompress=False)
        if overlays is not None:
            ramdisk_dir = extract_ramdisk(self._initrd, self._scratch_dir,
                                          is_uboot=self._is_uboot_ramdisk(ramdisk))
            for overlay in overlays:
                overlay = download_image(overlay, self.context,
                                         self._scratch_dir,
                                         decompress=False)
                extract_overlay(overlay, ramdisk_dir)
            self._initrd = create_ramdisk(ramdisk_dir, self._scratch_dir)
        self._boot_tags['{RAMDISK}'] = os.path.relpath(self._initrd, self._scratch_dir)

        # Optional
        if dtb is not None:
            self._dtb = download_image(dtb, self.context, self._scratch_dir,
                                       decompress=False)
            self._boot_tags['{DTB}'] = os.path.relpath(self._dtb, self._scratch_dir)

        if bootloader is None:
            if self.config.simulator_uefi_default is None:
                raise CriticalError("UEFI image is required")
            else:
                self._uefi = download_image(self.config.simulator_uefi_default, self.context,
                                            self._scratch_dir, decompress=False)
        else:
            self._uefi = download_image(bootloader, self.context,
                                        self._scratch_dir, decompress=False)

        if bl1 is None:
            if self.config.simulator_bl1_default is None:
                raise CriticalError("BL1 firmware is required")
            else:
                self._bl1 = download_image(self.config.simulator_bl1_default, self.context,
                                           self._scratch_dir, decompress=False)
        else:
            self._bl1 = download_image(bl1, self.context,
                                       self._scratch_dir, decompress=False)

        if bl0 is not None:
            self._bl0 = download_image(bl0, self.context, self._scratch_dir,
                                       decompress=False)
        if bl2 is not None:
            self._bl2 = download_image(bl2, self.context, self._scratch_dir,
                                       decompress=False)
        if bl31 is not None:
            self._bl31 = download_image(bl31, self.context, self._scratch_dir,
                                        decompress=False)

        if self.config.simulator_uefi_vars and self._uefi_vars is None:
            # Create file for flashloader1
            self._uefi_vars = os.path.join(self._scratch_dir, self.config.simulator_uefi_vars)
            touch(self._uefi_vars)

        # Get deployment data
        self.deployment_data = deployment_data.get(target_type)

        if image is not None:
            self._sd_image = download_image(image, self.context, self._scratch_dir,
                                            decompress=True)
        else:
            # Booting is not supported without an _sd_image defined
            self._sd_image = self._kernel

        self._default_boot_cmds = 'boot_cmds_ramdisk'
    def _copy_needed_files_from_directory(self, subdir):
        odir = os.path.dirname(self._sd_image)
        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,
                                                    self.config.simulator_axf_files)
        elif self._bootloadertype == 'uefi':
            # Extract the uefi binary from the image
            if self.config.simulator_uefi_files and self._uefi is None:
                self._uefi = \
                    self._copy_first_find_from_list(subdir, odir,
                                                    self.config.simulator_uefi_files)
                if self.config.simulator_uefi_vars and self._uefi_vars is None:
                    # Create file for flashloader1
                    self._uefi_vars = os.path.join(odir, self.config.simulator_uefi_vars)
                    touch(self._uefi_vars)

        # These are common to both AXF and UEFI
        # Extract the kernel from the image
        if self.config.simulator_kernel_files and self._kernel is None:
            self._kernel = \
                self._copy_first_find_from_list(subdir, odir,
                                                self.config.simulator_kernel_files,
                                                self.config.simulator_kernel)
        # Extract the initrd from the image
        if self.config.simulator_initrd_files and self._initrd is None:
            self._initrd = \
                self._copy_first_find_from_list(subdir, odir,
                                                self.config.simulator_initrd_files,
                                                self.config.simulator_initrd)
        # Extract the dtb from the image
        if self.config.simulator_dtb_files and self._dtb is None:
            self._dtb = \
                self._copy_first_find_from_list(subdir, odir,
                                                self.config.simulator_dtb_files,
                                                self.config.simulator_dtb)

            # workaround for renamed device tree blobs
            # see https://bugs.launchpad.net/linaro-oe/+bug/1255527
            dest_dtb = os.path.join(odir, 'fdt.dtb')
            if self._dtb and not os.path.exists(dest_dtb):
                os.symlink(self._dtb, dest_dtb)

        # Extract the first secure flashloader binary from the image
        if self.config.simulator_bl1_files and self._bl1 is None:
            self._bl1 = \
                self._copy_first_find_from_list(subdir, odir,
                                                self.config.simulator_bl1_files,
                                                self.config.simulator_bl1)
        # Extract the second secure flashloader binary from the image
        if self.config.simulator_bl2_files and self._bl2 is None:
            self._bl2 = \
                self._copy_first_find_from_list(subdir, odir,
                                                self.config.simulator_bl2_files,
                                                self.config.simulator_bl2)
        # Extract the second secure flashloader binary from the image
        if self.config.simulator_bl31_files and self._bl31 is None:
            self._bl31 = \
                self._copy_first_find_from_list(subdir, odir,
                                                self.config.simulator_bl31_files,
                                                self.config.simulator_bl31)
Exemple #4
0
    def _copy_needed_files_from_directory(self, subdir):
        odir = os.path.dirname(self._sd_image)
        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,
                                                    self.config.simulator_axf_files)
        elif self._bootloadertype == 'uefi':
            # Extract the uefi binary from the image
            if self.config.simulator_uefi_files and self._uefi is None:
                self._uefi = \
                    self._copy_first_find_from_list(subdir, odir,
                                                    self.config.simulator_uefi_files)
                if self.config.simulator_uefi_vars and self._uefi_vars is None:
                    # Create file for flashloader1
                    self._uefi_vars = os.path.join(odir, self.config.simulator_uefi_vars)
                    touch(self._uefi_vars)

        # These are common to both AXF and UEFI
        # Extract the kernel from the image
        if self.config.simulator_kernel_files and self._kernel is None:
            self._kernel = \
                self._copy_first_find_from_list(subdir, odir,
                                                self.config.simulator_kernel_files,
                                                self.config.simulator_kernel)
        # Extract the initrd from the image
        if self.config.simulator_initrd_files and self._initrd is None:
            self._initrd = \
                self._copy_first_find_from_list(subdir, odir,
                                                self.config.simulator_initrd_files,
                                                self.config.simulator_initrd)
        # Extract the dtb from the image
        if self.config.simulator_dtb_files and self._dtb is None:
            self._dtb = \
                self._copy_first_find_from_list(subdir, odir,
                                                self.config.simulator_dtb_files,
                                                self.config.simulator_dtb)

            # workaround for renamed device tree blobs
            # see https://bugs.launchpad.net/linaro-oe/+bug/1255527
            dest_dtb = os.path.join(odir, 'fdt.dtb')
            if self._dtb and not os.path.exists(dest_dtb):
                os.symlink(self._dtb, dest_dtb)

        # Extract the first secure flashloader binary from the image
        if self.config.simulator_bl1_files and self._bl1 is None:
            self._bl1 = \
                self._copy_first_find_from_list(subdir, odir,
                                                self.config.simulator_bl1_files,
                                                self.config.simulator_bl1)
        # Extract the second secure flashloader binary from the image
        if self.config.simulator_bl2_files and self._bl2 is None:
            self._bl2 = \
                self._copy_first_find_from_list(subdir, odir,
                                                self.config.simulator_bl2_files,
                                                self.config.simulator_bl2)
        # Extract the second secure flashloader binary from the image
        if self.config.simulator_bl31_files and self._bl31 is None:
            self._bl31 = \
                self._copy_first_find_from_list(subdir, odir,
                                                self.config.simulator_bl31_files,
                                                self.config.simulator_bl31)