Пример #1
0
    def finalize(self):
        """
        Finalize the disk image.

        For example, prepare the image to be bootable by e.g.
        creating and installing a bootloader configuration.
        """
        source_plugin = self.ks.bootloader.source
        disk_name = self.parts[0].disk
        if source_plugin:
            name = "do_install_disk"
            methods = pluginmgr.get_source_plugin_methods(
                source_plugin, {name: None})
            methods["do_install_disk"](self._image, disk_name, self,
                                       self.workdir, self.oe_builddir,
                                       self.bootimg_dir, self.kernel_dir,
                                       self.native_sysroot)

        full_path = self._image.path
        # Generate .bmap
        if self.bmap:
            msger.debug("Generating bmap file for %s" % disk_name)
            exec_native_cmd(
                "bmaptool create %s -o %s.bmap" % (full_path, full_path),
                self.native_sysroot)
        # Compress the image
        if self.compressor:
            msger.debug("Compressing disk %s with %s" %
                        (disk_name, self.compressor))
            exec_cmd("%s %s" % (self.compressor, full_path))
Пример #2
0
    def prepare(self, cr, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir,
                kernel_dir, native_sysroot):
        """
        Prepare content for individual partitions, depending on
        partition command parameters.
        """
        self.sourceparams_dict = {}

        if self.sourceparams:
            self.sourceparams_dict = parse_sourceparams(self.sourceparams)

        if not self.source:
            if not self.size:
                msger.error("The %s partition has a size of zero.  Please "
                            "specify a non-zero --size for that partition." % \
                            self.mountpoint)
            if self.fstype and self.fstype == "swap":
                self.prepare_swap_partition(cr_workdir, oe_builddir,
                                            native_sysroot)
            elif self.fstype:
                rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
                                             self.lineno, self.fstype)
                if os.path.isfile(rootfs):
                    os.remove(rootfs)
                for prefix in ("ext", "btrfs", "vfat", "squashfs"):
                    if self.fstype.startswith(prefix):
                        method = getattr(self,
                                         "prepare_empty_partition_" + prefix)
                        method(rootfs, oe_builddir, native_sysroot)
                        self.source_file = rootfs
                        break
            return

        plugins = pluginmgr.get_source_plugins()

        if self.source not in plugins:
            msger.error("The '%s' --source specified for %s doesn't exist.\n\t"
                        "See 'wic list source-plugins' for a list of available"
                        " --sources.\n\tSee 'wic help source-plugins' for "
                        "details on adding a new source plugin." % \
                        (self.source, self.mountpoint))

        self._source_methods = pluginmgr.get_source_plugin_methods(\
                                   self.source, partition_methods)
        self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
                                                       cr, cr_workdir,
                                                       oe_builddir,
                                                       bootimg_dir,
                                                       kernel_dir,
                                                       native_sysroot)
        self._source_methods["do_stage_partition"](self, self.sourceparams_dict,
                                                   cr, cr_workdir,
                                                   oe_builddir,
                                                   bootimg_dir, kernel_dir,
                                                   native_sysroot)
        self._source_methods["do_prepare_partition"](self, self.sourceparams_dict,
                                                     cr, cr_workdir,
                                                     oe_builddir,
                                                     bootimg_dir, kernel_dir, rootfs_dir,
                                                     native_sysroot)
Пример #3
0
    def finalize(self):
        """
        Finalize the disk image.

        For example, prepare the image to be bootable by e.g.
        creating and installing a bootloader configuration.

        """
        source_plugin = self.get_default_source_plugin()
        if source_plugin:
            self._source_methods = pluginmgr.get_source_plugin_methods(source_plugin, disk_methods)
            for disk_name, disk in self.__image.disks.items():
                self._source_methods["do_install_disk"](disk, disk_name, self,
                                                        self.workdir,
                                                        self.oe_builddir,
                                                        self.bootimg_dir,
                                                        self.kernel_dir,
                                                        self.native_sysroot)
        # Compress the image
        if self.compressor:
            for disk_name, disk in self.__image.disks.items():
                full_path = self._full_path(self.__imgdir, disk_name, "direct")
                msger.debug("Compressing disk %s with %s" % \
                            (disk_name, self.compressor))
                exec_cmd("%s %s" % (self.compressor, full_path))
Пример #4
0
    def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir,
                bootimg_dir, kernel_dir, native_sysroot):
        """
        Prepare content for individual partitions, depending on
        partition command parameters.
        """
        if self.sourceparams:
            self.sourceparams_dict = parse_sourceparams(self.sourceparams)

        if not self.source:
            if not self.size:
                msger.error("The %s partition has a size of zero.  Please "
                            "specify a non-zero --size for that partition." % \
                            self.mountpoint)
            if self.fstype and self.fstype == "swap":
                self.prepare_swap_partition(cr_workdir, oe_builddir,
                                            native_sysroot)
                self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype)
            elif self.fstype:
                rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
                                             self.lineno, self.fstype)
                if os.path.isfile(rootfs):
                    os.remove(rootfs)
                for prefix in ("ext", "btrfs", "vfat", "squashfs"):
                    if self.fstype.startswith(prefix):
                        method = getattr(self,
                                         "prepare_empty_partition_" + prefix)
                        method(rootfs, oe_builddir, native_sysroot)
                        self.source_file = rootfs
                        break
            return

        plugins = pluginmgr.get_source_plugins()

        if self.source not in plugins:
            msger.error("The '%s' --source specified for %s doesn't exist.\n\t"
                        "See 'wic list source-plugins' for a list of available"
                        " --sources.\n\tSee 'wic help source-plugins' for "
                        "details on adding a new source plugin." % \
                        (self.source, self.mountpoint))

        self._source_methods = pluginmgr.get_source_plugin_methods(\
                                   self.source, partition_methods)
        self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
                                                       creator, cr_workdir,
                                                       oe_builddir,
                                                       bootimg_dir,
                                                       kernel_dir,
                                                       native_sysroot)
        self._source_methods["do_stage_partition"](self, self.sourceparams_dict,
                                                   creator, cr_workdir,
                                                   oe_builddir,
                                                   bootimg_dir, kernel_dir,
                                                   native_sysroot)
        self._source_methods["do_prepare_partition"](self, self.sourceparams_dict,
                                                     creator, cr_workdir,
                                                     oe_builddir,
                                                     bootimg_dir, kernel_dir, rootfs_dir,
                                                     native_sysroot)
Пример #5
0
    def prepare(self, cr, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir, kernel_dir, native_sysroot):
        """
        Prepare content for individual partitions, depending on
        partition command parameters.
        """
        self.sourceparams_dict = {}

        if self.sourceparams:
            self.sourceparams_dict = parse_sourceparams(self.sourceparams)

        if not self.source:
            if not self.size:
                msger.error(
                    "The %s partition has a size of zero.  Please specify a non-zero --size for that partition."
                    % self.mountpoint
                )
            if self.fstype and self.fstype == "swap":
                self.prepare_swap_partition(cr_workdir, oe_builddir, native_sysroot)
            elif self.fstype:
                self.prepare_empty_partition(cr_workdir, oe_builddir, native_sysroot)
            return

        plugins = pluginmgr.get_source_plugins()

        if self.source not in plugins:
            msger.error(
                "The '%s' --source specified for %s doesn't exist.\n\tSee 'wic list source-plugins' for a list of available --sources.\n\tSee 'wic help source-plugins' for details on adding a new source plugin."
                % (self.source, self.mountpoint)
            )

        self._source_methods = pluginmgr.get_source_plugin_methods(self.source, partition_methods)
        self._source_methods["do_configure_partition"](
            self, self.sourceparams_dict, cr, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, native_sysroot
        )
        self._source_methods["do_stage_partition"](
            self, self.sourceparams_dict, cr, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, native_sysroot
        )
        self._source_methods["do_prepare_partition"](
            self,
            self.sourceparams_dict,
            cr,
            cr_workdir,
            oe_builddir,
            bootimg_dir,
            kernel_dir,
            rootfs_dir,
            native_sysroot,
        )
Пример #6
0
    def finalize(self):
        """
        Finalize the disk image.

        For example, prepare the image to be bootable by e.g.
        creating and installing a bootloader configuration.

        """
        source_plugin = self.get_default_source_plugin()
        if source_plugin:
            self._source_methods = pluginmgr.get_source_plugin_methods(
                source_plugin, disk_methods)
            for disk_name, disk in self.__image.disks.items():
                self._source_methods["do_install_disk"](
                    disk, disk_name, self, self.workdir, self.oe_builddir,
                    self.bootimg_dir, self.kernel_dir, self.native_sysroot)
Пример #7
0
    def finalize(self):
        """
        Finalize the disk image.

        For example, prepare the image to be bootable by e.g.
        creating and installing a bootloader configuration.

        """
        source_plugin = self.get_default_source_plugin()
        if source_plugin:
            self._source_methods = pluginmgr.get_source_plugin_methods(source_plugin, disk_methods)
            for disk_name, disk in self.__image.disks.items():
                self._source_methods["do_install_disk"](disk, disk_name, self,
                                                        self.workdir,
                                                        self.oe_builddir,
                                                        self.bootimg_dir,
                                                        self.kernel_dir,
                                                        self.native_sysroot)
Пример #8
0
    def prepare(self, cr, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir,
                kernel_dir, native_sysroot):
        """
        Prepare content for individual partitions, depending on
        partition command parameters.
        """
        self.sourceparams_dict = {}

        if self.sourceparams:
            self.sourceparams_dict = parse_sourceparams(self.sourceparams)

        if not self.source:
            if not self.size:
                msger.error("The %s partition has a size of zero.  Please specify a non-zero --size for that partition." % self.mountpoint)
            if self.fstype and self.fstype == "swap":
                self.prepare_swap_partition(cr_workdir, oe_builddir,
                                            native_sysroot)
            elif self.fstype:
                self.prepare_empty_partition(cr_workdir, oe_builddir,
                                             native_sysroot)
            return

        plugins = pluginmgr.get_source_plugins()

        if self.source not in plugins:
            msger.error("The '%s' --source specified for %s doesn't exist.\n\tSee 'wic list source-plugins' for a list of available --sources.\n\tSee 'wic help source-plugins' for details on adding a new source plugin." % (self.source, self.mountpoint))

        self._source_methods = pluginmgr.get_source_plugin_methods(self.source, partition_methods)
        self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
                                                       cr, cr_workdir,
                                                       oe_builddir,
                                                       bootimg_dir,
                                                       kernel_dir,
                                                       native_sysroot)
        self._source_methods["do_stage_partition"](self, self.sourceparams_dict,
                                                   cr, cr_workdir,
                                                   oe_builddir,
                                                   bootimg_dir, kernel_dir,
                                                   native_sysroot)
        self._source_methods["do_prepare_partition"](self, self.sourceparams_dict,
                                                     cr, cr_workdir,
                                                     oe_builddir,
                                                     bootimg_dir, kernel_dir, rootfs_dir,
                                                     native_sysroot)
Пример #9
0
    def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir,
                bootimg_dir, kernel_dir, native_sysroot):
        """
        Prepare content for individual partitions, depending on
        partition command parameters.
        """
        if self.sourceparams:
            self.sourceparams_dict = parse_sourceparams(self.sourceparams)

        if not self.source:
            if not self.size and not self.fixed_size:
                msger.error("The %s partition has a size of zero. Please "
                            "specify a non-zero --size/--fixed-size for that partition." % \
                            self.mountpoint)
            if self.fstype and self.fstype == "swap":
                self.prepare_swap_partition(cr_workdir, oe_builddir,
                                            native_sysroot)
                self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype)
            elif self.fstype:
                rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
                                             self.lineno, self.fstype)
                if os.path.isfile(rootfs):
                    os.remove(rootfs)
                for prefix in ("ext", "btrfs", "vfat", "squashfs"):
                    if self.fstype.startswith(prefix):
                        method = getattr(self,
                                         "prepare_empty_partition_" + prefix)
                        method(rootfs, oe_builddir, native_sysroot)
                        self.source_file = rootfs
                        break
            return

        plugins = pluginmgr.get_source_plugins()

        if self.source not in plugins:
            msger.error("The '%s' --source specified for %s doesn't exist.\n\t"
                        "See 'wic list source-plugins' for a list of available"
                        " --sources.\n\tSee 'wic help source-plugins' for "
                        "details on adding a new source plugin." % \
                        (self.source, self.mountpoint))

        self._source_methods = pluginmgr.get_source_plugin_methods(\
                                   self.source, partition_methods)
        self._source_methods["do_configure_partition"](
            self, self.sourceparams_dict, creator, cr_workdir, oe_builddir,
            bootimg_dir, kernel_dir, native_sysroot)
        self._source_methods["do_stage_partition"](self,
                                                   self.sourceparams_dict,
                                                   creator, cr_workdir,
                                                   oe_builddir, bootimg_dir,
                                                   kernel_dir, native_sysroot)
        self._source_methods["do_prepare_partition"](
            self, self.sourceparams_dict, creator, cr_workdir, oe_builddir,
            bootimg_dir, kernel_dir, rootfs_dir, native_sysroot)

        # further processing required Partition.size to be an integer, make
        # sure that it is one
        if type(self.size) is not int:
            msger.error("Partition %s internal size is not an integer. " \
                          "This a bug in source plugin %s and needs to be fixed." \
                          % (self.mountpoint, self.source))

        if self.fixed_size and self.size > self.fixed_size:
            msger.error("File system image of partition %s is larger (%d kB) than its"\
                        "allowed size %d kB" % (self.mountpoint,
                                                self.size, self.fixed_size))
Пример #10
0
    def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir,
                bootimg_dir, kernel_dir, native_sysroot):
        """
        Prepare content for individual partitions, depending on
        partition command parameters.
        """
        if self.sourceparams:
            self.sourceparams_dict = parse_sourceparams(self.sourceparams)

        if not self.source:
            if not self.size and not self.fixed_size:
                msger.error("The %s partition has a size of zero. Please "
                            "specify a non-zero --size/--fixed-size for that partition." % \
                            self.mountpoint)
            if self.fstype and self.fstype == "swap":
                self.prepare_swap_partition(cr_workdir, oe_builddir,
                                            native_sysroot)
                self.source_file = "%s/fs.%s" % (cr_workdir, self.fstype)
            elif self.fstype:
                rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
                                             self.lineno, self.fstype)
                if os.path.isfile(rootfs):
                    os.remove(rootfs)
                for prefix in ("ext", "btrfs", "vfat", "squashfs"):
                    if self.fstype.startswith(prefix):
                        method = getattr(self,
                                         "prepare_empty_partition_" + prefix)
                        method(rootfs, oe_builddir, native_sysroot)
                        self.source_file = rootfs
                        break
            return

        plugins = pluginmgr.get_source_plugins()

        if self.source not in plugins:
            msger.error("The '%s' --source specified for %s doesn't exist.\n\t"
                        "See 'wic list source-plugins' for a list of available"
                        " --sources.\n\tSee 'wic help source-plugins' for "
                        "details on adding a new source plugin." % \
                        (self.source, self.mountpoint))

        self._source_methods = pluginmgr.get_source_plugin_methods(\
                                   self.source, partition_methods)
        self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
                                                       creator, cr_workdir,
                                                       oe_builddir,
                                                       bootimg_dir,
                                                       kernel_dir,
                                                       native_sysroot)
        self._source_methods["do_stage_partition"](self, self.sourceparams_dict,
                                                   creator, cr_workdir,
                                                   oe_builddir,
                                                   bootimg_dir, kernel_dir,
                                                   native_sysroot)
        self._source_methods["do_prepare_partition"](self, self.sourceparams_dict,
                                                     creator, cr_workdir,
                                                     oe_builddir,
                                                     bootimg_dir, kernel_dir, rootfs_dir,
                                                     native_sysroot)

        # further processing required Partition.size to be an integer, make
        # sure that it is one
        if type(self.size) is not int:
            msger.error("Partition %s internal size is not an integer. " \
                          "This a bug in source plugin %s and needs to be fixed." \
                          % (self.mountpoint, self.source))

        if self.fixed_size and self.size > self.fixed_size:
            msger.error("File system image of partition %s is larger (%d kB) than its"\
                        "allowed size %d kB" % (self.mountpoint,
                                                self.size, self.fixed_size))