def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, native_sysroot,
               scripts_path, options):
    """
    Create image

    wks_file - user-defined OE kickstart file
    rootfs_dir - absolute path to the build's /rootfs dir
    bootimg_dir - absolute path to the build's boot artifacts directory
    kernel_dir - absolute path to the build's kernel directory
    native_sysroot - absolute path to the build's native sysroots dir
    scripts_path - absolute path to /scripts dir
    image_output_dir - dirname to create for image
    options - wic command line options (debug, bmap, etc)

    Normally, the values for the build artifacts values are determined
    by 'wic -e' from the output of the 'bitbake -e' command given an
    image name e.g. 'core-image-minimal' and a given machine set in
    local.conf.  If that's the case, the variables get the following
    values from the output of 'bitbake -e':

    rootfs_dir:        IMAGE_ROOTFS
    kernel_dir:        DEPLOY_DIR_IMAGE
    native_sysroot:    STAGING_DIR_NATIVE

    In the above case, bootimg_dir remains unset and the
    plugin-specific image creation code is responsible for finding the
    bootimg artifacts.

    In the case where the values are passed in explicitly i.e 'wic -e'
    is not used but rather the individual 'wic' options are used to
    explicitly specify these values.
    """
    try:
        oe_builddir = os.environ["BUILDDIR"]
    except KeyError:
        print(
            "BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)"
        )
        sys.exit(1)

    if options.debug:
        msger.set_loglevel('debug')

    if not os.path.exists(options.outdir):
        os.makedirs(options.outdir)

    pname = 'direct'
    plugin_class = pluginmgr.get_plugins('imager').get(pname)
    if not plugin_class:
        msger.error('Unknown plugin: %s' % pname)

    plugin = plugin_class(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
                          native_sysroot, scripts_path, oe_builddir, options)

    plugin.do_create()

    print("\nThe image(s) were created using OE kickstart file:\n  %s" %
          wks_file)
Exemple #2
0
    def __init__(self, *args, **kwargs):
        self._subcmds = {}

        # get cmds from pluginmgr
        # mix-in do_subcmd interface
        for subcmd, klass in pluginmgr.get_plugins('imager').items():
            if not hasattr(klass, 'do_create'):
                msger.warning("Unsupported subcmd: %s" % subcmd)
                continue

            func = getattr(klass, 'do_create')
            self._subcmds[subcmd] = func
Exemple #3
0
    def __init__(self, *args, **kwargs):
        self._subcmds = {}

        # get cmds from pluginmgr
        # mix-in do_subcmd interface
        for subcmd, klass in pluginmgr.get_plugins('imager').iteritems():
            if not hasattr(klass, 'do_create'):
                msger.warning("Unsupported subcmd: %s" % subcmd)
                continue

            func = getattr(klass, 'do_create')
            self._subcmds[subcmd] = func
    def __init__(self, *args, **kwargs):
        cmdln.Cmdln.__init__(self, *args, **kwargs)
        self._subcmds = []

        # get cmds from pluginmgr
        # mix-in do_subcmd interface
        for subcmd, klass in pluginmgr.get_plugins('imager').iteritems():
            if not hasattr(klass, 'do_create'):
                msger.warning("Unsupported subcmd: %s" % subcmd)
                continue

            func = getattr(klass, 'do_create')
            setattr(self.__class__, "do_"+subcmd, func)
            self._subcmds.append(subcmd)
Exemple #5
0
    def __init__(self, *args, **kwargs):
        cmdln.Cmdln.__init__(self, *args, **kwargs)
        self._subcmds = []

        # get cmds from pluginmgr
        # mix-in do_subcmd interface
        for subcmd, klass in pluginmgr.get_plugins('imager').iteritems():
            if not hasattr(klass, 'do_create'):
                msger.warning("Unsupported subcmd: %s" % subcmd)
                continue

            func = getattr(klass, 'do_create')
            setattr(self.__class__, "do_" + subcmd, func)
            self._subcmds.append(subcmd)
Exemple #6
0
def get_wic_plugins_help():
    """
    Combine wic_plugins_help with the help for every known
    source plugin.
    """
    result = wic_plugins_help
    for plugin_type in PLUGIN_TYPES:
        result += '\n\n%s PLUGINS\n\n' % plugin_type.upper()
        for name, plugin in pluginmgr.get_plugins(plugin_type).iteritems():
            result += "\n %s plugin:\n" % name
            if plugin.__doc__:
                result += plugin.__doc__
            else:
                result += "\n    %s is missing docstring\n" % plugin
    return result
Exemple #7
0
def get_wic_plugins_help():
    """
    Combine wic_plugins_help with the help for every known
    source plugin.
    """
    result = wic_plugins_help
    for plugin_type in PLUGIN_TYPES:
        result += '\n\n%s PLUGINS\n\n' % plugin_type.upper()
        for name, plugin in pluginmgr.get_plugins(plugin_type).iteritems():
            result += "\n %s plugin:\n" % name
            if plugin.__doc__:
                result += plugin.__doc__
            else:
                result += "\n    %s is missing docstring\n" % plugin
    return result