Exemple #1
0
def wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir,
               native_sysroot, scripts_path, image_output_dir, debug,
               properties_file, properties=None):
    """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
    properties_file - use values from this file if nonempty i.e no prompting
    properties - use values from this string if nonempty i.e no prompting

    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)

    direct_args = list()
    direct_args.insert(0, oe_builddir)
    direct_args.insert(0, image_output_dir)
    direct_args.insert(0, wks_file)
    direct_args.insert(0, rootfs_dir)
    direct_args.insert(0, bootimg_dir)
    direct_args.insert(0, kernel_dir)
    direct_args.insert(0, native_sysroot)
    direct_args.insert(0, "direct")

    if debug:
        msger.set_loglevel('debug')

    cr = creator.Creator()

    cr.main(direct_args)

    print "\nThe image(s) were created using OE kickstart file:\n  %s" % wks_file
Exemple #2
0
def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, native_sysroot,
               scripts_path, image_output_dir, compressor, bmap, debug):
    """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
    compressor - compressor utility to compress the image
    bmap - enable generation of .bmap

    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 debug:
        msger.set_loglevel('debug')

    crobj = creator.Creator()

    cmdline = [
        "direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir,
        wks_file, image_output_dir, oe_builddir, compressor or ""
    ]
    if bmap:
        cmdline.append('--bmap')

    crobj.main(cmdline)

    print("\nThe image(s) were created using OE kickstart file:\n  %s" %
          wks_file)