Exemplo n.º 1
0
 def __create_iso_install_kernel_and_initrd(self):
     boot_path = self.media_dir + '/boot/x86_64/loader'
     Path.create(boot_path)
     kernel = Kernel(self.boot_image_task.boot_root_directory)
     if kernel.get_kernel():
         kernel.copy_kernel(boot_path, '/linux')
     else:
         raise KiwiInstallBootImageError(
             'No kernel in boot image tree %s found' %
             self.boot_image_task.boot_root_directory
         )
     if self.machine and self.machine.get_domain() == 'dom0':
         if kernel.get_xen_hypervisor():
             kernel.copy_xen_hypervisor(boot_path, '/xen.gz')
         else:
             raise KiwiInstallBootImageError(
                 'No hypervisor in boot image tree %s found' %
                 self.boot_image_task.boot_root_directory
             )
     self.boot_image_task.create_initrd(self.mbrid)
     Command.run(
         [
             'mv', self.boot_image_task.initrd_filename,
             boot_path + '/initrd'
         ]
     )
Exemplo n.º 2
0
 def __create_live_iso_kernel_and_initrd(self):
     boot_path = self.media_dir + '/boot/x86_64/loader'
     Path.create(boot_path)
     kernel = Kernel(self.boot_image_task.boot_root_directory)
     if kernel.get_kernel():
         kernel.copy_kernel(boot_path, '/linux')
     else:
         raise KiwiLiveBootImageError(
             'No kernel in boot image tree %s found' %
             self.boot_image_task.boot_root_directory
         )
     if self.machine and self.machine.get_domain() == 'dom0':
         if kernel.get_xen_hypervisor():
             kernel.copy_xen_hypervisor(boot_path, '/xen.gz')
         else:
             raise KiwiLiveBootImageError(
                 'No hypervisor in boot image tree %s found' %
                 self.boot_image_task.boot_root_directory
             )
     self.boot_image_task.create_initrd(self.mbrid)
     Command.run(
         [
             'mv', self.boot_image_task.initrd_filename,
             boot_path + '/initrd'
         ]
     )
Exemplo n.º 3
0
 def __copy_first_boot_files_to_system_image(self):
     log.info('Copy boot files to system image')
     kernel = Kernel(self.boot_image_task.boot_root_directory)
     if kernel.get_kernel():
         log.info('--> boot image kernel as first boot linux.vmx')
         kernel.copy_kernel(
             self.root_dir, '/boot/linux.vmx'
         )
     else:
         raise KiwiDiskBootImageError(
             'No kernel in boot image tree %s found' %
             self.boot_image_task.boot_root_directory
         )
     if self.machine and self.machine.get_domain() == 'dom0':
         if kernel.get_xen_hypervisor():
             log.info('--> boot image Xen hypervisor as xen.gz')
             kernel.copy_xen_hypervisor(
                 self.root_dir, '/boot/xen.gz'
             )
         else:
             raise KiwiDiskBootImageError(
                 'No hypervisor in boot image tree %s found' %
                 self.boot_image_task.boot_root_directory
             )
     log.info('--> initrd archive as first boot initrd.vmx')
     Command.run(
         [
             'mv', self.boot_image_task.initrd_filename,
             self.root_dir + '/boot/initrd.vmx'
         ]
     )
Exemplo n.º 4
0
 def __create_pxe_install_kernel_and_initrd(self):
     kernel = Kernel(self.boot_image_task.boot_root_directory)
     if kernel.get_kernel():
         kernel.copy_kernel(self.pxe_dir, "/pxeboot.kernel")
     else:
         raise KiwiInstallBootImageError(
             "No kernel in boot image tree %s found" % self.boot_image_task.boot_root_directory
         )
     if self.machine and self.machine.get_domain() == "dom0":
         if kernel.get_xen_hypervisor():
             kernel.copy_xen_hypervisor(self.pxe_dir, "/pxeboot.xen.gz")
         else:
             raise KiwiInstallBootImageError(
                 "No hypervisor in boot image tree %s found" % self.boot_image_task.boot_root_directory
             )
     self.boot_image_task.create_initrd(self.mbrid)
     Command.run(["mv", self.boot_image_task.initrd_filename, self.pxe_dir + "/pxeboot.initrd.xz"])
Exemplo n.º 5
0
 def __create_iso_install_kernel_and_initrd(self):
     boot_path = self.media_dir + "/boot/x86_64/loader"
     Path.create(boot_path)
     kernel = Kernel(self.boot_image_task.boot_root_directory)
     if kernel.get_kernel():
         kernel.copy_kernel(boot_path, "/linux")
     else:
         raise KiwiInstallBootImageError(
             "No kernel in boot image tree %s found" % self.boot_image_task.boot_root_directory
         )
     if self.machine and self.machine.get_domain() == "dom0":
         if kernel.get_xen_hypervisor():
             kernel.copy_xen_hypervisor(boot_path, "/xen.gz")
         else:
             raise KiwiInstallBootImageError(
                 "No hypervisor in boot image tree %s found" % self.boot_image_task.boot_root_directory
             )
     self.boot_image_task.create_initrd(self.mbrid)
     Command.run(["mv", self.boot_image_task.initrd_filename, boot_path + "/initrd"])
Exemplo n.º 6
0
 def __create_pxe_install_kernel_and_initrd(self):
     kernel = Kernel(self.boot_image_task.boot_root_directory)
     if kernel.get_kernel():
         kernel.copy_kernel(self.pxe_dir, '/pxeboot.kernel')
     else:
         raise KiwiInstallBootImageError(
             'No kernel in boot image tree %s found' %
             self.boot_image_task.boot_root_directory
         )
     if self.machine and self.machine.get_domain() == 'dom0':
         if kernel.get_xen_hypervisor():
             kernel.copy_xen_hypervisor(self.pxe_dir, '/pxeboot.xen.gz')
         else:
             raise KiwiInstallBootImageError(
                 'No hypervisor in boot image tree %s found' %
                 self.boot_image_task.boot_root_directory
             )
     self.boot_image_task.create_initrd(self.mbrid)
     Command.run(
         [
             'mv', self.boot_image_task.initrd_filename,
             self.pxe_dir + '/pxeboot.initrd.xz'
         ]
     )
Exemplo n.º 7
0
    def create(self):
        log.info('Creating PXE root filesystem image')
        self.filesystem.create()
        self.image = self.filesystem.filename
        if self.compressed:
            log.info('xz compressing root filesystem image')
            compress = Compress(self.image)
            compress.xz()
            self.image = compress.compressed_filename

        log.info('Creating PXE root filesystem MD5 checksum')
        self.filesystem_checksum = self.filesystem.filename + '.md5'
        checksum = Checksum(self.image)
        checksum.md5(self.filesystem_checksum)

        # prepare boot(initrd) root system
        log.info('Creating PXE boot image')
        self.boot_image_task.prepare()

        # export modprobe configuration to boot image
        self.system_setup.export_modprobe_setup(
            self.boot_image_task.boot_root_directory
        )

        # extract kernel from boot(initrd) root system
        kernel = Kernel(self.boot_image_task.boot_root_directory)
        kernel_data = kernel.get_kernel()
        if kernel_data:
            self.kernel_filename = ''.join(
                [self.image_name, '-', kernel_data.version, '.kernel']
            )
            kernel.copy_kernel(
                self.target_dir, self.kernel_filename
            )
        else:
            raise KiwiPxeBootImageError(
                'No kernel in boot image tree %s found' %
                self.boot_image_task.boot_root_directory
            )

        # extract hypervisor from boot(initrd) root system
        if self.machine and self.machine.get_domain() == 'dom0':
            kernel_data = kernel.get_xen_hypervisor()
            if kernel_data:
                self.hypervisor_filename = ''.join(
                    [self.image_name, '-', kernel_data.name]
                )
                kernel.copy_xen_hypervisor(
                    self.target_dir, self.hypervisor_filename
                )
                self.result.add(
                    'xen_hypervisor', self.hypervisor_filename
                )
            else:
                raise KiwiPxeBootImageError(
                    'No hypervisor in boot image tree %s found' %
                    self.boot_image_task.boot_root_directory
                )

        # create initrd for pxe boot
        self.boot_image_task.create_initrd()
        self.result.add(
            'kernel', self.kernel_filename
        )
        self.result.add(
            'initrd', self.boot_image_task.initrd_filename
        )
        self.result.add(
            'filesystem_image', self.image
        )
        self.result.add(
            'filesystem_md5', self.filesystem_checksum
        )

        if self.pxedeploy:
            log.warning(
                'Creation of client config file from pxedeploy not implemented'
            )

        return self.result
Exemplo n.º 8
0
    def create(self):
        log.info('Creating PXE root filesystem image')
        self.filesystem.create()
        self.image = self.filesystem.filename
        if self.compressed:
            log.info('xz compressing root filesystem image')
            compress = Compress(self.image)
            compress.xz()
            self.image = compress.compressed_filename

        log.info('Creating PXE root filesystem MD5 checksum')
        self.filesystem_checksum = self.filesystem.filename + '.md5'
        checksum = Checksum(self.image)
        checksum.md5(self.filesystem_checksum)

        # prepare boot(initrd) root system
        log.info('Creating PXE boot image')
        self.boot_image_task.prepare()

        # export modprobe configuration to boot image
        self.system_setup.export_modprobe_setup(
            self.boot_image_task.boot_root_directory)

        # extract kernel from boot(initrd) root system
        kernel = Kernel(self.boot_image_task.boot_root_directory)
        kernel_data = kernel.get_kernel()
        if kernel_data:
            self.kernel_filename = ''.join(
                [self.image_name, '-', kernel_data.version, '.kernel'])
            kernel.copy_kernel(self.target_dir, self.kernel_filename)
        else:
            raise KiwiPxeBootImageError(
                'No kernel in boot image tree %s found' %
                self.boot_image_task.boot_root_directory)

        # extract hypervisor from boot(initrd) root system
        if self.machine and self.machine.get_domain() == 'dom0':
            kernel_data = kernel.get_xen_hypervisor()
            if kernel_data:
                self.hypervisor_filename = ''.join(
                    [self.image_name, '-', kernel_data.name])
                kernel.copy_xen_hypervisor(self.target_dir,
                                           self.hypervisor_filename)
                self.result.add('xen_hypervisor', self.hypervisor_filename)
            else:
                raise KiwiPxeBootImageError(
                    'No hypervisor in boot image tree %s found' %
                    self.boot_image_task.boot_root_directory)

        # create initrd for pxe boot
        self.boot_image_task.create_initrd()
        self.result.add('kernel', self.kernel_filename)
        self.result.add('initrd', self.boot_image_task.initrd_filename)
        self.result.add('filesystem_image', self.image)
        self.result.add('filesystem_md5', self.filesystem_checksum)

        if self.pxedeploy:
            log.warning(
                'Creation of client config file from pxedeploy not implemented'
            )

        return self.result