def _setup_nfs(self, nfsrootfs, tmpdir):
     lava_nfsrootfs = utils.mkdtemp(basedir=tmpdir)
     utils.extract_rootfs(nfsrootfs, lava_nfsrootfs)
     return lava_nfsrootfs
Ejemplo n.º 2
0
    def deploy_linaro_kernel(self, kernel, ramdisk, dtb, modules, rootfs, nfsrootfs,
                             bootloader, firmware, bl1, bl2, bl31, rootfstype,
                             bootloadertype, target_type, scratch_dir):
        kernel_url = kernel
        # At a minimum we must have a kernel
        if kernel is None:
            raise CriticalError("No kernel image to boot")
        # Set the server IP (Dispatcher)
        self._boot_tags['{SERVER_IP}'] = self.context.config.lava_server_ip
        # Get the JTAG command fragments
        stmc_command = ' '.join([self.config.jtag_stmc_boot_script,
                                 self.config.jtag_stmc_boot_options])
        # We have been passed kernel image
        kernel = download_image(kernel, self.context,
                                scratch_dir, decompress=False)
        stmc_command = ' '.join([stmc_command,
                                 self.config.jtag_stmc_kernel_command.format(KERNEL=kernel)])
        if ramdisk is not None:
            # We have been passed a ramdisk
            ramdisk = download_image(ramdisk, self.context,
                                     scratch_dir,
                                     decompress=False)
            if modules is not None:
                modules = download_image(modules, self.context,
                                         scratch_dir,
                                         decompress=False)
                ramdisk_dir = extract_ramdisk(ramdisk, scratch_dir,
                                              is_uboot=False)
                extract_modules(modules, ramdisk_dir)
                ramdisk = create_ramdisk(ramdisk_dir, scratch_dir)
            stmc_command = ' '.join([stmc_command,
                                    self.config.jtag_stmc_ramdisk_command.format(RAMDISK=ramdisk)])
        if dtb is not None:
            # We have been passed a device tree blob
            dtb = download_image(dtb, self.context,
                                 scratch_dir, decompress=False)
            stmc_command = ' '.join([stmc_command,
                                    self.config.jtag_stmc_dtb_command.format(DTB=dtb)])
        if nfsrootfs is not None:
            # Extract rootfs into nfsrootfs directory
            nfsrootfs = download_image(nfsrootfs, self.context,
                                       scratch_dir,
                                       decompress=False)
            scratch_dir = mkdtemp(self.context.config.lava_image_tmpdir)
            lava_nfsrootfs = mkdtemp(basedir=scratch_dir)
            extract_rootfs(nfsrootfs, lava_nfsrootfs)
            self._boot_tags['{NFSROOTFS}'] = lava_nfsrootfs
            self._default_boot_cmds = 'boot_cmds_nfs'
            if modules is not None and ramdisk is None:
                modules = download_image(modules, self.context,
                                         scratch_dir,
                                         decompress=False)
                extract_modules(modules, lava_nfsrootfs)

        # Add suffix for boot commands
        self._stmc_command = stmc_command + ' --'

        if self.context.test_data.metadata.get('is_slave', 'false') == 'true':
            logging.info("Booting in the master/slave mode, as *slave*")
            logging.info("Sending the kernel, dtb, nfsrootfs urls")
            self.context.transport.request_send('lava_ms_slave_data',
                                                {'kernel': kernel_url,
                                                 'nfs_rootfs': lava_nfsrootfs,
                                                 'nfs_server_ip': self.context.config.lava_server_ip,
                                                 'stmc_ip': self.config.jtag_stmc_ip})

        return self._boot_tags, self._default_boot_cmds
Ejemplo n.º 3
0
 def _setup_nfs(self, nfsrootfs, tmpdir):
     lava_nfsrootfs = utils.mkdtemp(basedir=tmpdir)
     utils.extract_rootfs(nfsrootfs, lava_nfsrootfs)
     return lava_nfsrootfs
Ejemplo n.º 4
0
    def deploy_linaro_kernel(self, kernel, ramdisk, dtb, overlays, rootfs, nfsrootfs,
                             image, bootloader, firmware, bl0, bl1, bl2, bl31, rootfstype,
                             bootloadertype, target_type, scratch_dir, qemu_pflash=None):
        kernel_url = kernel
        dtb_url = dtb
        # At a minimum we must have a kernel
        if kernel is None:
            raise CriticalError("No kernel image to boot")
        # Set the server IP (Dispatcher)
        self._boot_tags['{SERVER_IP}'] = self.context.config.lava_server_ip
        # Get the JTAG command fragments
        stmc_command = ' '.join([self.config.jtag_stmc_boot_script,
                                 self.config.jtag_stmc_boot_options])
        # We have been passed kernel image
        kernel = download_image(kernel, self.context,
                                scratch_dir, decompress=False)
        stmc_command = ' '.join([stmc_command,
                                 self.config.jtag_stmc_kernel_command.format(KERNEL=kernel)])
        if ramdisk is not None:
            # We have been passed a ramdisk
            ramdisk = download_image(ramdisk, self.context,
                                     scratch_dir,
                                     decompress=False)
            if overlays is not None:
                ramdisk_dir = extract_ramdisk(ramdisk, scratch_dir,
                                              is_uboot=False)
                for overlay in overlays:
                    overlay = download_image(overlay, self.context,
                                             scratch_dir,
                                             decompress=False)
                    extract_overlay(overlay, ramdisk_dir)
                ramdisk = create_ramdisk(ramdisk_dir, scratch_dir)
            stmc_command = ' '.join([stmc_command,
                                    self.config.jtag_stmc_ramdisk_command.format(RAMDISK=ramdisk)])
        if dtb is not None:
            # We have been passed a device tree blob
            dtb = download_image(dtb, self.context,
                                 scratch_dir, decompress=False)
            stmc_command = ' '.join([stmc_command,
                                    self.config.jtag_stmc_dtb_command.format(DTB=dtb)])
        if nfsrootfs is not None:
            # Extract rootfs into nfsrootfs directory
            nfsrootfs = download_image(nfsrootfs, self.context,
                                       scratch_dir,
                                       decompress=False)
            scratch_dir = mkdtemp(self.context.config.lava_image_tmpdir)
            lava_nfsrootfs = mkdtemp(basedir=scratch_dir)
            extract_rootfs(nfsrootfs, lava_nfsrootfs)
            self._boot_tags['{NFSROOTFS}'] = lava_nfsrootfs
            self._default_boot_cmds = 'boot_cmds_nfs'
            if overlays is not None and ramdisk is None:
                for overlay in overlays:
                    overlay = download_image(overlay, self.context,
                                             scratch_dir,
                                             decompress=False)
                extract_overlay(overlay, lava_nfsrootfs)

        # Add suffix for boot commands
        self._stmc_command = stmc_command + ' --'

        if self.context.test_data.metadata.get('is_slave', 'false') == 'true':
            logging.info("Booting in the master/slave mode, as *slave*")
            logging.info("Sending the kernel, dtb, nfsrootfs urls")
            self.context.transport.request_send('lava_ms_slave_data',
                                                {'kernel': kernel_url,
                                                 'dtb': dtb_url if dtb_url else '',
                                                 'nfs_rootfs': lava_nfsrootfs,
                                                 'nfs_server_ip': self.context.config.lava_server_ip,
                                                 'stmc_ip': self.config.jtag_stmc_ip})

        return self._boot_tags, self._default_boot_cmds
Ejemplo n.º 5
0
    def deploy_linaro_kernel(
        self,
        kernel,
        ramdisk,
        dtb,
        overlays,
        rootfs,
        nfsrootfs,
        image,
        bootloader,
        firmware,
        bl0,
        bl1,
        bl2,
        bl31,
        rootfstype,
        bootloadertype,
        target_type,
        scratch_dir,
        qemu_pflash=None,
    ):
        kernel_url = kernel
        dtb_url = dtb
        # At a minimum we must have a kernel
        if kernel is None:
            raise CriticalError("No kernel image to boot")
        # Set the server IP (Dispatcher)
        self._boot_tags["{SERVER_IP}"] = self.context.config.lava_server_ip
        # Get the JTAG command fragments
        stmc_command = " ".join([self.config.jtag_stmc_boot_script, self.config.jtag_stmc_boot_options])
        # We have been passed kernel image
        kernel = download_image(kernel, self.context, scratch_dir, decompress=False)
        stmc_command = " ".join([stmc_command, self.config.jtag_stmc_kernel_command.format(KERNEL=kernel)])
        if ramdisk is not None:
            # We have been passed a ramdisk
            ramdisk = download_image(ramdisk, self.context, scratch_dir, decompress=False)
            if overlays is not None:
                ramdisk_dir = extract_ramdisk(ramdisk, scratch_dir, is_uboot=False)
                for overlay in overlays:
                    overlay = download_image(overlay, self.context, scratch_dir, decompress=False)
                    extract_overlay(overlay, ramdisk_dir)
                ramdisk = create_ramdisk(ramdisk_dir, scratch_dir)
            stmc_command = " ".join([stmc_command, self.config.jtag_stmc_ramdisk_command.format(RAMDISK=ramdisk)])
        if dtb is not None:
            # We have been passed a device tree blob
            dtb = download_image(dtb, self.context, scratch_dir, decompress=False)
            stmc_command = " ".join([stmc_command, self.config.jtag_stmc_dtb_command.format(DTB=dtb)])
        if nfsrootfs is not None:
            # Extract rootfs into nfsrootfs directory
            nfsrootfs = download_image(nfsrootfs, self.context, scratch_dir, decompress=False)
            scratch_dir = mkdtemp(self.context.config.lava_image_tmpdir)
            lava_nfsrootfs = mkdtemp(basedir=scratch_dir)
            extract_rootfs(nfsrootfs, lava_nfsrootfs)
            self._boot_tags["{NFSROOTFS}"] = lava_nfsrootfs
            self._default_boot_cmds = "boot_cmds_nfs"
            if overlays is not None and ramdisk is None:
                for overlay in overlays:
                    overlay = download_image(overlay, self.context, scratch_dir, decompress=False)
                extract_overlay(overlay, lava_nfsrootfs)

        # Add suffix for boot commands
        self._stmc_command = stmc_command + " --"

        if self.context.test_data.metadata.get("is_slave", "false") == "true":
            logging.info("Booting in the master/slave mode, as *slave*")
            logging.info("Sending the kernel, dtb, nfsrootfs urls")
            self.context.transport.request_send(
                "lava_ms_slave_data",
                {
                    "kernel": kernel_url,
                    "dtb": dtb_url if dtb_url else "",
                    "nfs_rootfs": lava_nfsrootfs,
                    "nfs_server_ip": self.context.config.lava_server_ip,
                    "stmc_ip": self.config.jtag_stmc_ip,
                },
            )

        return self._boot_tags, self._default_boot_cmds