<div dir="ltr">Hi Amber,<div><br></div><div>Can you resend that using git-send-email?  Copy/pasting it into a mail client has sent it as HTML, which git-apply can&#39;t read.</div><div><br></div><div>Cheers,</div><div>Ross</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 11 December 2017 at 21:25, Elliot, Amber N <span dir="ltr">&lt;<a href="mailto:amber.n.elliot@intel.com" target="_blank">amber.n.elliot@intel.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>
<div>The wic help output formally consisted of manually created strings mixed with argparse,</div>
<div>which was unformatted and unusable. This fix cleans up the help messages, rewrites help</div>
<div>functionality to use argparse, and adds functionality to show information for</div>
<div>plugins (similar to canned images).</div>
<div><br>
</div>
<div>Fixes [YOCTO #12205]</div>
<div><br>
</div>
<div>Signed-off-by: anelliot &lt;<a href="mailto:amber.n.elliot@intel.com" target="_blank">amber.n.elliot@intel.com</a>&gt;</div>
<div>---</div>
<div> scripts/lib/wic/engine.py |   87 +++-</div>
<div> scripts/lib/wic/help.py   | 1072 +++++-------------------------<wbr>---------------</div>
<div> scripts/wic               |  169 +++----</div>
<div> 3 files changed, 243 insertions(+), 1085 deletions(-)</div>
<div><br>
</div>
<div>diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py</div>
<div>index edcfab3..5d1e1d8 100644</div>
<div>--- a/scripts/lib/wic/engine.py</div>
<div>+++ b/scripts/lib/wic/engine.py</div>
<div>@@ -58,6 +58,8 @@ def verify_build_env():</div>
<div> </div>
<div> CANNED_IMAGE_DIR = &quot;lib/wic/canned-wks&quot; # relative to scripts</div>
<div> SCRIPTS_CANNED_IMAGE_DIR = &quot;scripts/&quot; + CANNED_IMAGE_DIR</div>
<div>+SOURCE_PLUGIN_DIR = &quot;lib/wic/plugins/source&quot;</div>
<div>+SCRIPTS_SOURCE_PLUGIN_DIR = &quot;scripts/&quot; + SOURCE_PLUGIN_DIR</div>
<div> WIC_DIR = &quot;wic&quot;</div>
<div> </div>
<div> def build_canned_image_list(path):</div>
<div>@@ -76,6 +78,23 @@ def build_canned_image_list(path):</div>
<div> </div>
<div>     return canned_wks_layer_dirs</div>
<div> </div>
<div>+def build_source_plugin_list(path)<wbr>:</div>
<div>+    layers_path = get_bitbake_var(&quot;BBLAYERS&quot;)</div>
<div>+    canned_wks_layer_dirs = []</div>
<div>+</div>
<div>+    if layers_path is not None:</div>
<div>+        for layer_path in layers_path.split():</div>
<div>+            for wks_path in (WIC_DIR, SCRIPTS_SOURCE_PLUGIN_DIR):</div>
<div>+                cpath = os.path.join(layer_path, wks_path)</div>
<div>+                if os.path.isdir(cpath):</div>
<div>+                    canned_wks_layer_dirs.append(<wbr>cpath)</div>
<div>+</div>
<div>+    cpath = os.path.join(path, SOURCE_PLUGIN_DIR)</div>
<div>+    canned_wks_layer_dirs.append(<wbr>cpath)</div>
<div>+</div>
<div>+    return canned_wks_layer_dirs</div>
<div>+</div>
<div>+</div>
<div> def find_canned_image(scripts_<wbr>path, wks_file):</div>
<div>     &quot;&quot;&quot;</div>
<div>     Find a .wks file with the given name in the canned files dir.</div>
<div>@@ -95,6 +114,24 @@ def find_canned_image(scripts_<wbr>path, wks_file):</div>
<div>     return None</div>
<div> </div>
<div> </div>
<div>+def find_source_plugin(scripts_<wbr>path, plugin_file):</div>
<div>+    &quot;&quot;&quot;</div>
<div>+    Find a .py file with the given name in the source plugin dir.</div>
<div>+</div>
<div>+    Return False if not found</div>
<div>+    &quot;&quot;&quot;</div>
<div>+    layers_source_plugin_dir = build_source_plugin_list(<wbr>scripts_path)</div>
<div>+</div>
<div>+    for source_plugin_dir in layers_source_plugin_dir:</div>
<div>+        for root, dirs, files in os.walk(source_plugin_dir):</div>
<div>+            for fname in files:</div>
<div>+                if fname.endswith(&quot;~&quot;) or fname.endswith(&quot;#&quot;):</div>
<div>+                    continue</div>
<div>+                if fname.endswith(&quot;.py&quot;) and plugin_file + &quot;.py&quot; == fname:</div>
<div>+                    fullpath = os.path.join(source_plugin_<wbr>dir, fname)</div>
<div>+                    return fullpath</div>
<div>+    return None</div>
<div>+</div>
<div> def list_canned_images(scripts_<wbr>path):</div>
<div>     &quot;&quot;&quot;</div>
<div>     List the .wks files in the canned image dir, minus the extension.</div>
<div>@@ -119,7 +156,7 @@ def list_canned_images(scripts_<wbr>path):</div>
<div>                     print(&quot;  %s\t\t%s&quot; % (basename.ljust(30), desc))</div>
<div> </div>
<div> </div>
<div>-def list_canned_image_help(<wbr>scripts_path, fullpath):</div>
<div>+def list_canned_image_help(<wbr>fullpath):</div>
<div>     &quot;&quot;&quot;</div>
<div>     List the help and params in the specified canned image.</div>
<div>     &quot;&quot;&quot;</div>
<div>@@ -139,6 +176,7 @@ def list_canned_image_help(<wbr>scripts_path, fullpath):</div>
<div>             if idx != -1:</div>
<div>                 print(line[idx + len(&quot;#:&quot;):].rstrip())</div>
<div>             else:</div>
<div>+                print()</div>
<div>                 break</div>
<div> </div>
<div> </div>
<div>@@ -152,6 +190,29 @@ def list_source_plugins():</div>
<div>         print(&quot;  %s&quot; % plugin)</div>
<div> </div>
<div> </div>
<div>+def list_source_plugins_help(<wbr>fullpath):</div>
<div>+    &quot;&quot;&quot;</div>
<div>+    List the help and params in the specified canned image.</div>
<div>+    &quot;&quot;&quot;</div>
<div>+    found = False</div>
<div>+    with open(fullpath) as plugin:</div>
<div>+        for line in plugin:</div>
<div>+            if not found:</div>
<div>+                idx = line.find(&quot;DESCRIPTION&quot;)</div>
<div>+                if idx != -1:</div>
<div>+                    print(line[idx + len(&quot;DESCRIPTION&quot;):].strip())</div>
<div>+                    found = True</div>
<div>+                continue</div>
<div>+            if not line.strip():</div>
<div>+                break</div>
<div>+            idx = line.find(&quot;#&quot;)</div>
<div>+            auth = line.find(&quot;AUTHORS&quot;)</div>
<div>+            if idx != -1 and auth == -1:</div>
<div>+                print(line[idx + len(&quot;#:&quot;):].rstrip())</div>
<div>+            else:</div>
<div>+                break</div>
<div>+</div>
<div>+</div>
<div> def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,</div>
<div>                native_sysroot, options):</div>
<div>     &quot;&quot;&quot;</div>
<div>@@ -204,7 +265,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,</div>
<div>     <a href="http://logger.info" target="_blank">logger.info</a>(&quot;The image(s) were created using OE kickstart file:\n  %s&quot;, wks_file)</div>
<div> </div>
<div> </div>
<div>-def wic_list(args, scripts_path):</div>
<div>+def wic_list(scripts_path, args):</div>
<div>     &quot;&quot;&quot;</div>
<div>     Print the list of images or source plugins.</div>
<div>     &quot;&quot;&quot;</div>
<div>@@ -218,16 +279,20 @@ def wic_list(args, scripts_path):</div>
<div>     elif args.list_type == &quot;source-plugins&quot;:</div>
<div>         list_source_plugins()</div>
<div>         return True</div>
<div>-    elif len(args.help_for) == 1 and args.help_for[0] == &#39;help&#39;:</div>
<div>-        wks_file = args.list_type</div>
<div>-        fullpath = find_canned_image(scripts_<wbr>path, wks_file)</div>
<div>+    elif len(args.info_for) == 1 and args.info_for[0] == &#39;info&#39;:</div>
<div>+        input_file = args.list_type</div>
<div>+        fullpath = find_canned_image(scripts_<wbr>path, input_file)</div>
<div>         if not fullpath:</div>
<div>-            raise WicError(&quot;No image named %s found, exiting. &quot;</div>
<div>-                           &quot;(Use &#39;wic list images&#39; to list available images, &quot;</div>
<div>-                           &quot;or specify a fully-qualified OE kickstart (.wks) &quot;</div>
<div>-                           &quot;filename)&quot; % wks_file)</div>
<div>-</div>
<div>-        list_canned_image_help(<wbr>scripts_path, fullpath)</div>
<div>+            fullpath = find_source_plugin(scripts_<wbr>path, input_file)</div>
<div>+            if not fullpath:</div>
<div>+                raise WicError(&quot;No image named %s found, exiting. &quot;</div>
<div>+                               &quot;(Use &#39;wic list images&#39; to list available images, &quot;</div>
<div>+                               &quot;or specify a fully-qualified OE kickstart (.wks) &quot;</div>
<div>+                               &quot;filename)&quot; % input_file)</div>
<div>+            else:</div>
<div>+                list_source_plugins_help(<wbr>fullpath)</div>
<div>+        else:</div>
<div>+            list_canned_image_help(<wbr>fullpath)</div>
<div>         return True</div>
<div> </div>
<div>     return False</div>
<div>diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py</div>
<div>index 2ac45e0..8230395 100644</div>
<div>--- a/scripts/lib/wic/help.py</div>
<div>+++ b/scripts/lib/wic/help.py</div>
<div>@@ -30,1014 +30,166 @@ import logging</div>
<div> </div>
<div> from wic.pluginbase import PluginMgr, PLUGIN_TYPES</div>
<div> </div>
<div>-logger = logging.getLogger(&#39;wic&#39;)</div>
<div>-</div>
<div>-def subcommand_error(args):</div>
<div>-    <a href="http://logger.info" target="_blank">logger.info</a>(&quot;invalid subcommand %s&quot;, args[0])</div>
<div>-</div>
<div>-</div>
<div>-def display_help(subcommand, subcommands):</div>
<div>-    &quot;&quot;&quot;</div>
<div>-    Display help for subcommand.</div>
<div>-    &quot;&quot;&quot;</div>
<div>-    if subcommand not in subcommands:</div>
<div>-        return False</div>
<div>-</div>
<div>-    hlp = subcommands.get(subcommand, subcommand_error)[2]</div>
<div>-    if callable(hlp):</div>
<div>-        hlp = hlp()</div>
<div>-    pager = subprocess.Popen(&#39;less&#39;, stdin=subprocess.PIPE)</div>
<div>-    pager.communicate(hlp.encode(<wbr>&#39;utf-8&#39;))</div>
<div>-</div>
<div>-    return True</div>
<div>-</div>
<div>-</div>
<div>-def wic_help(args, usage_str, subcommands):</div>
<div>-    &quot;&quot;&quot;</div>
<div>-    Subcommand help dispatcher.</div>
<div>-    &quot;&quot;&quot;</div>
<div>-    if args.help_topic == None or not display_help(args.help_topic, subcommands):</div>
<div>-        print(usage_str)</div>
<div>-</div>
<div>-</div>
<div>-def get_wic_plugins_help():</div>
<div>-    &quot;&quot;&quot;</div>
<div>-    Combine wic_plugins_help with the help for every known</div>
<div>-    source plugin.</div>
<div>-    &quot;&quot;&quot;</div>
<div>-    result = wic_plugins_help</div>
<div>-    for plugin_type in PLUGIN_TYPES:</div>
<div>-        result += &#39;\n\n%s PLUGINS\n\n&#39; % plugin_type.upper()</div>
<div>-        for name, plugin in PluginMgr.get_plugins(plugin_<wbr>type).items():</div>
<div>-            result += &quot;\n %s plugin:\n&quot; % name</div>
<div>-            if plugin.__doc__:</div>
<div>-                result += plugin.__doc__</div>
<div>-            else:</div>
<div>-                result += &quot;\n    %s is missing docstring\n&quot; % plugin</div>
<div>-    return result</div>
<div>-</div>
<div>-</div>
<div>-def invoke_subcommand(args, parser, main_command_usage, subcommands):</div>
<div>-    &quot;&quot;&quot;</div>
<div>-    Dispatch to subcommand handler borrowed from combo-layer.</div>
<div>-    Should use argparse, but has to work in 2.6.</div>
<div>-    &quot;&quot;&quot;</div>
<div>-    if not args.command:</div>
<div>-        logger.error(&quot;No subcommand specified, exiting&quot;)</div>
<div>-        parser.print_help()</div>
<div>-        return 1</div>
<div>-    elif args.command == &quot;help&quot;:</div>
<div>-        wic_help(args, main_command_usage, subcommands)</div>
<div>-    elif args.command not in subcommands:</div>
<div>-        logger.error(&quot;Unsupported subcommand %s, exiting\n&quot;, args.command)</div>
<div>-        parser.print_help()</div>
<div>-        return 1</div>
<div>-    else:</div>
<div>-        subcmd = subcommands.get(args.command, subcommand_error)</div>
<div>-        usage = subcmd[1]</div>
<div>-        subcmd[0](args, usage)</div>
<div>-</div>
<div>-</div>
<div>-##</div>
<div>+# ##</div>
<div> # wic help and usage strings</div>
<div> ##</div>
<div> </div>
<div>-wic_usage = &quot;&quot;&quot;</div>
<div>-</div>
<div>- Create a customized OpenEmbedded image</div>
<div>-</div>
<div>- usage: wic [--version] | [--help] | [COMMAND [ARGS]]</div>
<div>-</div>
<div>- Current &#39;wic&#39; commands are:</div>
<div>-    help              Show help for command or one of the topics (see below)</div>
<div>-    create            Create a new OpenEmbedded image</div>
<div>-    list              List available canned images and source plugins</div>
<div>-</div>
<div>- Help topics:</div>
<div>-    overview          wic overview - General overview of wic</div>
<div>-    plugins           wic plugins - Overview and API</div>
<div>-    kickstart         wic kickstart - wic kickstart reference</div>
<div>-&quot;&quot;&quot;</div>
<div>-</div>
<div>-wic_help_usage = &quot;&quot;&quot;</div>
<div>-</div>
<div>- usage: wic help &lt;subcommand&gt;</div>
<div>-</div>
<div>- This command displays detailed help for the specified subcommand.</div>
<div>-&quot;&quot;&quot;</div>
<div>-</div>
<div>-wic_create_usage = &quot;&quot;&quot;</div>
<div>-</div>
<div>- Create a new OpenEmbedded image</div>
<div>-</div>
<div>- usage: wic create &lt;wks file or image name&gt; [-o &lt;DIRNAME&gt; | --outdir &lt;DIRNAME&gt;]</div>
<div>-            [-e | --image-name] [-s, --skip-build-check] [-D, --debug]</div>
<div>-            [-r, --rootfs-dir] [-b, --bootimg-dir]</div>
<div>-            [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs]</div>
<div>-            [-c, --compress-with] [-m, --bmap]</div>
<div>-</div>
<div>- This command creates an OpenEmbedded image based on the &#39;OE kickstart</div>
<div>- commands&#39; found in the &lt;wks file&gt;.</div>
<div>-</div>
<div>- The -o option can be used to place the image in a directory with a</div>
<div>- different name and location.</div>
<div>-</div>
<div>- See &#39;wic help create&#39; for more detailed instructions.</div>
<div>-&quot;&quot;&quot;</div>
<div>-</div>
<div>-wic_create_help = &quot;&quot;&quot;</div>
<div>-</div>
<div>-NAME</div>
<div>-    wic create - Create a new OpenEmbedded image</div>
<div>-</div>
<div>-SYNOPSIS</div>
<div>-    wic create &lt;wks file or image name&gt; [-o &lt;DIRNAME&gt; | --outdir &lt;DIRNAME&gt;]</div>
<div>-        [-e | --image-name] [-s, --skip-build-check] [-D, --debug]</div>
<div>-        [-r, --rootfs-dir] [-b, --bootimg-dir]</div>
<div>-        [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs]</div>
<div>-        [-c, --compress-with] [-m, --bmap] [--no-fstab-update]</div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>-    This command creates an OpenEmbedded image based on the &#39;OE</div>
<div>-    kickstart commands&#39; found in the &lt;wks file&gt;.</div>
<div>-</div>
<div>-    In order to do this, wic needs to know the locations of the</div>
<div>-    various build artifacts required to build the image.</div>
<div>-</div>
<div>-    Users can explicitly specify the build artifact locations using</div>
<div>-    the -r, -b, -k, and -n options.  See below for details on where</div>
<div>-    the corresponding artifacts are typically found in a normal</div>
<div>-    OpenEmbedded build.</div>
<div>-</div>
<div>-    Alternatively, users can use the -e option to have &#39;wic&#39; determine</div>
<div>-    those locations for a given image.  If the -e option is used, the</div>
<div>-    user needs to have set the appropriate MACHINE variable in</div>
<div>-    local.conf, and have sourced the build environment.</div>
<div>-</div>
<div>-    The -e option is used to specify the name of the image to use the</div>
<div>-    artifacts from e.g. core-image-sato.</div>
<div>-</div>
<div>-    The -r option is used to specify the path to the /rootfs dir to</div>
<div>-    use as the .wks rootfs source.</div>
<div>-</div>
<div>-    The -b option is used to specify the path to the dir containing</div>
<div>-    the boot artifacts (e.g. /EFI or /syslinux dirs) to use as the</div>
<div>-    .wks bootimg source.</div>
<div>-</div>
<div>-    The -k option is used to specify the path to the dir containing</div>
<div>-    the kernel to use in the .wks bootimg.</div>
<div>-</div>
<div>-    The -n option is used to specify the path to the native sysroot</div>
<div>-    containing the tools to use to build the image.</div>
<div>-</div>
<div>-    The -f option is used to build rootfs by running &quot;bitbake &lt;image&gt;&quot;</div>
<div>-</div>
<div>-    The -s option is used to skip the build check.  The build check is</div>
<div>-    a simple sanity check used to determine whether the user has</div>
<div>-    sourced the build environment so that the -e option can operate</div>
<div>-    correctly.  If the user has specified the build artifact locations</div>
<div>-    explicitly, &#39;wic&#39; assumes the user knows what he or she is doing</div>
<div>-    and skips the build check.</div>
<div>-</div>
<div>-    The -D option is used to display debug information detailing</div>
<div>-    exactly what happens behind the scenes when a create request is</div>
<div>-    fulfilled (or not, as the case may be).  It enumerates and</div>
<div>-    displays the command sequence used, and should be included in any</div>
<div>-    bug report describing unexpected results.</div>
<div>-</div>
<div>-    When &#39;wic -e&#39; is used, the locations for the build artifacts</div>
<div>-    values are determined by &#39;wic -e&#39; from the output of the &#39;bitbake</div>
<div>-    -e&#39; command given an image name e.g. &#39;core-image-minimal&#39; and a</div>
<div>-    given machine set in local.conf.  In that case, the image is</div>
<div>-    created as if the following &#39;bitbake -e&#39; variables were used:</div>
<div>-</div>
<div>-    -r:        IMAGE_ROOTFS</div>
<div>-    -k:        STAGING_KERNEL_DIR</div>
<div>-    -n:        STAGING_DIR_NATIVE</div>
<div>-    -b:        empty (plugin-specific handlers must determine this)</div>
<div>-</div>
<div>-    If &#39;wic -e&#39; is not used, the user needs to select the appropriate</div>
<div>-    value for -b (as well as -r, -k, and -n).</div>
<div>-</div>
<div>-    The -o option can be used to place the image in a directory with a</div>
<div>-    different name and location.</div>
<div>-</div>
<div>-    The -c option is used to specify compressor utility to compress</div>
<div>-    an image. gzip, bzip2 and xz compressors are supported.</div>
<div>-</div>
<div>-    The -m option is used to produce .bmap file for the image. This file</div>
<div>-    can be used to flash image using bmaptool utility.</div>
<div>-</div>
<div>-    The --no-fstab-update option is used to doesn&#39;t change fstab file. When</div>
<div>-    using this option the final fstab file will be same that in rootfs and</div>
<div>-    wic doesn&#39;t update file, e.g adding a new mount point. User can control</div>
<div>-    the fstab file content in base-files recipe.</div>
<div>-&quot;&quot;&quot;</div>
<div>-</div>
<div>-wic_list_usage = &quot;&quot;&quot;</div>
<div>-</div>
<div>- List available OpenEmbedded images and source plugins</div>
<div>-</div>
<div>- usage: wic list images</div>
<div>-        wic list &lt;image&gt; help</div>
<div>-        wic list source-plugins</div>
<div>-</div>
<div>- This command enumerates the set of available canned images as well as</div>
<div>- help for those images.  It also can be used to list of available source</div>
<div>- plugins.</div>
<div>-</div>
<div>- The first form enumerates all the available &#39;canned&#39; images.</div>
<div>-</div>
<div>- The second form lists the detailed help information for a specific</div>
<div>- &#39;canned&#39; image.</div>
<div>-</div>
<div>- The third form enumerates all the available --sources (source</div>
<div>- plugins).</div>
<div>-</div>
<div>- See &#39;wic help list&#39; for more details.</div>
<div>+wic_create_short_description = &quot;&quot;&quot;</div>
<div>+Create a new OpenEmbedded image.</div>
<div> &quot;&quot;&quot;</div>
<div> </div>
<div>-wic_list_help = &quot;&quot;&quot;</div>
<div>-</div>
<div>-NAME</div>
<div>-    wic list - List available OpenEmbedded images and source plugins</div>
<div>-</div>
<div>-SYNOPSIS</div>
<div>-    wic list images</div>
<div>-    wic list &lt;image&gt; help</div>
<div>-    wic list source-plugins</div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>-    This command enumerates the set of available canned images as well</div>
<div>-    as help for those images.  It also can be used to list available</div>
<div>-    source plugins.</div>
<div>-</div>
<div>-    The first form enumerates all the available &#39;canned&#39; images.</div>
<div>-    These are actually just the set of .wks files that have been moved</div>
<div>-    into the /scripts/lib/wic/canned-wks directory).</div>
<div>-</div>
<div>-    The second form lists the detailed help information for a specific</div>
<div>-    &#39;canned&#39; image.</div>
<div>-</div>
<div>-    The third form enumerates all the available --sources (source</div>
<div>-    plugins).  The contents of a given partition are driven by code</div>
<div>-    defined in &#39;source plugins&#39;.  Users specify a specific plugin via</div>
<div>-    the --source parameter of the partition .wks command.  Normally</div>
<div>-    this is the &#39;rootfs&#39; plugin but can be any of the more specialized</div>
<div>-    sources listed by the &#39;list source-plugins&#39; command.  Users can</div>
<div>-    also add their own source plugins - see &#39;wic help plugins&#39; for</div>
<div>-    details.</div>
<div>+wic_rm_short_description = &quot;&quot;&quot;</div>
<div>+Remove files or directories from the vfat or ext* partitions.</div>
<div> &quot;&quot;&quot;</div>
<div> </div>
<div>-wic_ls_usage = &quot;&quot;&quot;</div>
<div>-</div>
<div>- List content of a partitioned image</div>
<div>-</div>
<div>- usage: wic ls &lt;image&gt;[:&lt;partition&gt;[&lt;path&gt;]] [--native-sysroot &lt;path&gt;]</div>
<div>-</div>
<div>- This command  outputs either list of image partitions or directory contents</div>
<div>- of vfat and ext* partitions.</div>
<div>-</div>
<div>- See &#39;wic help ls&#39; for more detailed instructions.</div>
<div>-</div>
<div>+wic_write_short_description = &quot;&quot;&quot;</div>
<div>+Write an image to a device.</div>
<div> &quot;&quot;&quot;</div>
<div> </div>
<div>-wic_ls_help = &quot;&quot;&quot;</div>
<div>-</div>
<div>-NAME</div>
<div>-    wic ls - List contents of partitioned image or partition</div>
<div>-</div>
<div>-SYNOPSIS</div>
<div>-    wic ls &lt;image&gt;</div>
<div>-    wic ls &lt;image&gt;:&lt;vfat or ext* partition&gt;</div>
<div>-    wic ls &lt;image&gt;:&lt;vfat or ext* partition&gt;&lt;path&gt;</div>
<div>-    wic ls &lt;image&gt;:&lt;vfat or ext* partition&gt;&lt;path&gt; --native-sysroot &lt;path&gt;</div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>-    This command lists either partitions of the image or directory contents</div>
<div>-    of vfat or ext* partitions.</div>
<div>-</div>
<div>-    The first form it lists partitions of the image.</div>
<div>-    For example:</div>
<div>-        $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic</div>
<div>-        Num     Start        End          Size      Fstype</div>
<div>-        1        1048576     24438783     23390208  fat16</div>
<div>-        2       25165824     50315263     25149440  ext4</div>
<div>-</div>
<div>-    Second and third form list directory content of the partition:</div>
<div>-        $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1</div>
<div>-        Volume in drive : is boot</div>
<div>-         Volume Serial Number is 2DF2-5F02</div>
<div>-        Directory for ::/</div>
<div>-</div>
<div>-        efi          &lt;DIR&gt;     2017-05-11  10:54</div>
<div>-        startup  nsh        26 2017-05-11  10:54</div>
<div>-        vmlinuz        6922288 2017-05-11  10:54</div>
<div>-                3 files           6 922 314 bytes</div>
<div>-                                 15 818 752 bytes free</div>
<div>-</div>
<div>-</div>
<div>-        $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1/EFI/boot/</div>
<div>-        Volume in drive : is boot</div>
<div>-         Volume Serial Number is 2DF2-5F02</div>
<div>-        Directory for ::/EFI/boot</div>
<div>-</div>
<div>-        .            &lt;DIR&gt;     2017-05-11  10:54</div>
<div>-        ..           &lt;DIR&gt;     2017-05-11  10:54</div>
<div>-        grub     cfg       679 2017-05-11  10:54</div>
<div>-        bootx64  efi    571392 2017-05-11  10:54</div>
<div>-                4 files             572 071 bytes</div>
<div>-                                 15 818 752 bytes free</div>
<div>-</div>
<div>-    The -n option is used to specify the path to the native sysroot</div>
<div>-    containing the tools(parted and mtools) to use.</div>
<div>-</div>
<div>-&quot;&quot;&quot;</div>
<div>-</div>
<div>-wic_cp_usage = &quot;&quot;&quot;</div>
<div>-</div>
<div>- Copy files and directories to the vfat or ext* partition</div>
<div>-</div>
<div>- usage: wic cp &lt;src&gt; &lt;image&gt;:&lt;partition&gt;[&lt;path&gt;] [--native-sysroot &lt;path&gt;]</div>
<div>-</div>
<div>- This command  copies local files or directories to the vfat or ext* partitions</div>
<div>-of partitioned  image.</div>
<div>-</div>
<div>- See &#39;wic help cp&#39; for more detailed instructions.</div>
<div>-</div>
<div>+wic_cp_short_description = &quot;&quot;&quot;</div>
<div>+Copy files and directories to the vfat or ext* partitions.</div>
<div> &quot;&quot;&quot;</div>
<div> </div>
<div>-wic_cp_help = &quot;&quot;&quot;</div>
<div>-</div>
<div>-NAME</div>
<div>-    wic cp - copy files and directories to the vfat or ext* partitions</div>
<div>-</div>
<div>-SYNOPSIS</div>
<div>-    wic cp &lt;src&gt; &lt;image&gt;:&lt;partition&gt;</div>
<div>-    wic cp &lt;src&gt; &lt;image&gt;:&lt;partition&gt;&lt;path&gt;</div>
<div>-    wic cp &lt;src&gt; &lt;image&gt;:&lt;partition&gt;&lt;path&gt; --native-sysroot &lt;path&gt;</div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>-    This command copies files and directories to the vfat or ext* partition of</div>
<div>-    the partitioned image.</div>
<div>-</div>
<div>-    The first form of it copies file or directory to the root directory of</div>
<div>-    the partition:</div>
<div>-        $ wic cp test.wks tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1</div>
<div>-        $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1</div>
<div>-        Volume in drive : is boot</div>
<div>-         Volume Serial Number is DB4C-FD4C</div>
<div>-        Directory for ::/</div>
<div>-</div>
<div>-        efi          &lt;DIR&gt;     2017-05-24  18:15</div>
<div>-        loader       &lt;DIR&gt;     2017-05-24  18:15</div>
<div>-        startup  nsh        26 2017-05-24  18:15</div>
<div>-        vmlinuz        6926384 2017-05-24  18:15</div>
<div>-        test     wks       628 2017-05-24  21:22</div>
<div>-                5 files           6 927 038 bytes</div>
<div>-                                 15 677 440 bytes free</div>
<div>-</div>
<div>-    The second form of the command copies file or directory to the specified directory</div>
<div>-    on the partition:</div>
<div>-       $ wic cp test tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1/efi/</div>
<div>-       $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1/efi/</div>
<div>-       Volume in drive : is boot</div>
<div>-        Volume Serial Number is DB4C-FD4C</div>
<div>-       Directory for ::/efi</div>
<div>-</div>
<div>-       .            &lt;DIR&gt;     2017-05-24  18:15</div>
<div>-       ..           &lt;DIR&gt;     2017-05-24  18:15</div>
<div>-       boot         &lt;DIR&gt;     2017-05-24  18:15</div>
<div>-       test         &lt;DIR&gt;     2017-05-24  21:27</div>
<div>-               4 files                   0 bytes</div>
<div>-                                15 675 392 bytes free</div>
<div>-</div>
<div>-    The -n option is used to specify the path to the native sysroot</div>
<div>-    containing the tools(parted and mtools) to use.</div>
<div>+wic_ls_short_description = &quot;&quot;&quot;</div>
<div>+Lists either partitions of the image or directory contents</div>
<div>+of vfat or ext* partitions.&quot;&quot;&quot;</div>
<div>+wic_help_short_description = &quot;&quot;&quot;</div>
<div>+sss</div>
<div> &quot;&quot;&quot;</div>
<div>-</div>
<div>-wic_rm_usage = &quot;&quot;&quot;</div>
<div>-</div>
<div>- Remove files or directories from the vfat or ext* partitions</div>
<div>-</div>
<div>- usage: wic rm &lt;image&gt;:&lt;partition&gt;&lt;path&gt; [--native-sysroot &lt;path&gt;]</div>
<div>-</div>
<div>- This command  removes files or directories from the vfat or ext* partitions of</div>
<div>- the partitioned image.</div>
<div>-</div>
<div>- See &#39;wic help rm&#39; for more detailed instructions.</div>
<div>-</div>
<div>+wic_list_short_description = &quot;&quot;&quot;</div>
<div>+List available canned images and source plugins</div>
<div> &quot;&quot;&quot;</div>
<div> </div>
<div>-wic_rm_help = &quot;&quot;&quot;</div>
<div>+wic_create_description = &quot;&quot;&quot;</div>
<div>+This command creates an OpenEmbedded image based on the &#39;OE</div>
<div>+kickstart commands&#39; found in the &lt;wks file&gt;.</div>
<div> </div>
<div>-NAME</div>
<div>-    wic rm - remove files or directories from the vfat or ext* partitions</div>
<div>+In order to do this, wic needs to know the locations of the</div>
<div>+various build artifacts required to build the image.</div>
<div> </div>
<div>-SYNOPSIS</div>
<div>-    wic rm &lt;src&gt; &lt;image&gt;:&lt;partition&gt;&lt;path&gt;</div>
<div>-    wic rm &lt;src&gt; &lt;image&gt;:&lt;partition&gt;&lt;path&gt; --native-sysroot &lt;path&gt;</div>
<div>+Users can explicitly specify the build artifact locations using</div>
<div>+the -r, -b, -k, and -n options.  See below for details on where</div>
<div>+the corresponding artifacts are typically found in a normal</div>
<div>+OpenEmbedded build.</div>
<div> </div>
<div>-DESCRIPTION</div>
<div>-    This command removes files or directories from the vfat or ext* partition of the</div>
<div>-    partitioned image:</div>
<div>+Alternatively, users can use the -e option to have &#39;wic&#39; determine</div>
<div>+those locations for a given image.  If the -e option is used, the</div>
<div>+user needs to have set the appropriate MACHINE variable in</div>
<div>+local.conf, and have sourced the build environment.</div>
<div> </div>
<div>-        $ wic ls ./tmp/deploy/images/qemux86-<wbr>64/core-image-minimal-qemux86-<wbr>64.wic:1</div>
<div>-        Volume in drive : is boot</div>
<div>-         Volume Serial Number is 11D0-DE21</div>
<div>-        Directory for ::/</div>
<div>+The -s option is used to skip the build check.  The build check is</div>
<div>+a simple sanity check used to determine whether the user has</div>
<div>+sourced the build environment so that the -e option can operate</div>
<div>+correctly.  If the user has specified the build artifact locations</div>
<div>+explicitly, &#39;wic&#39; assumes the user knows what he or she is doing</div>
<div>+and skips the build check.</div>
<div> </div>
<div>-        libcom32 c32    186500 2017-06-02  15:15</div>
<div>-        libutil  c32     24148 2017-06-02  15:15</div>
<div>-        syslinux cfg       209 2017-06-02  15:15</div>
<div>-        vesamenu c32     27104 2017-06-02  15:15</div>
<div>-        vmlinuz        6926384 2017-06-02  15:15</div>
<div>-                5 files           7 164 345 bytes</div>
<div>-                                 16 582 656 bytes free</div>
<div>+When &#39;wic -e&#39; is used, the locations for the build artifacts</div>
<div>+values are determined by &#39;wic -e&#39; from the output of the &#39;bitbake</div>
<div>+-e&#39; command given an image name e.g. &#39;core-image-minimal&#39; and a</div>
<div>+given machine set in local.conf.  In that case, the image is</div>
<div>+created as if the following &#39;bitbake -e&#39; variables were used:</div>
<div> </div>
<div>-        $ wic rm ./tmp/deploy/images/qemux86-<wbr>64/core-image-minimal-qemux86-<wbr>64.wic:1/libutil.c32</div>
<div>+-r:        IMAGE_ROOTFS</div>
<div>+-k:        STAGING_KERNEL_DIR</div>
<div>+-n:        STAGING_DIR_NATIVE</div>
<div>+-b:        empty (plugin-specific handlers must determine this)</div>
<div> </div>
<div>-        $ wic ls ./tmp/deploy/images/qemux86-<wbr>64/core-image-minimal-qemux86-<wbr>64.wic:1</div>
<div>-        Volume in drive : is boot</div>
<div>-         Volume Serial Number is 11D0-DE21</div>
<div>-        Directory for ::/</div>
<div>+If &#39;wic -e&#39; is not used, the user needs to select the appropriate</div>
<div>+value for -b (as well as -r, -k, and -n).</div>
<div> </div>
<div>-        libcom32 c32    186500 2017-06-02  15:15</div>
<div>-        syslinux cfg       209 2017-06-02  15:15</div>
<div>-        vesamenu c32     27104 2017-06-02  15:15</div>
<div>-        vmlinuz        6926384 2017-06-02  15:15</div>
<div>-                4 files           7 140 197 bytes</div>
<div>-                                 16 607 232 bytes free</div>
<div>+Here&#39;s an example that doesn&#39;t take the easy way out and manually</div>
<div>+specifies each build artifact, along with a non-canned .wks file,</div>
<div>+and also uses the -o option to have wic create the output</div>
<div>+somewhere other than the default /var/tmp/wic:</div>
<div> </div>
<div>-    The -n option is used to specify the path to the native sysroot</div>
<div>-    containing the tools(parted and mtools) to use.</div>
<div>+  $ wic create ./test.wks -o ./out --rootfs-dir</div>
<div>+  tmp/work/qemux86_64-poky-<wbr>linux/core-image-minimal/1.0-<wbr>r0/rootfs</div>
<div>+  --bootimg-dir tmp/sysroots/qemux86-64/usr/<wbr>share</div>
<div>+  --kernel-dir tmp/deploy/images/qemux86-64</div>
<div>+  --native-sysroot tmp/sysroots/x86_64-linux</div>
<div> &quot;&quot;&quot;</div>
<div> </div>
<div>-wic_write_usage = &quot;&quot;&quot;</div>
<div> </div>
<div>- Write image to a device</div>
<div>+wic_list_description = &quot;&quot;&quot;</div>
<div>+This command enumerates the set of available canned images as well</div>
<div>+as help for those images.  It also can be used to list available</div>
<div>+source plugins.</div>
<div> </div>
<div>- usage: wic write &lt;image&gt; &lt;target device&gt; [--expand [rules]] [--native-sysroot &lt;path&gt;]</div>
<div>+The first form enumerates all the available &#39;canned&#39; images.</div>
<div>+These are actually just the set of .wks files that have been moved</div>
<div>+into the /scripts/lib/wic/canned-wks directory).</div>
<div> </div>
<div>- This command writes partitioned image to a target device (USB stick, SD card etc).</div>
<div>-</div>
<div>- See &#39;wic help write&#39; for more detailed instructions.</div>
<div>+The second form lists the detailed help information for a specific</div>
<div>+&#39;canned&#39; image.</div>
<div> </div>
<div>+The third form enumerates all the available --sources (source</div>
<div>+plugins).  The contents of a given partition are driven by code</div>
<div>+defined in &#39;source plugins&#39;.  Users specify a specific plugin via</div>
<div>+the --source parameter of the partition .wks command.  Normally</div>
<div>+this is the &#39;rootfs&#39; plugin but can be any of the more specialized</div>
<div>+sources listed by the &#39;list source-plugins&#39; command.  Users can</div>
<div>+also add their own source plugins - see &#39;wic help plugins&#39; for</div>
<div>+details.</div>
<div> &quot;&quot;&quot;</div>
<div> </div>
<div>-wic_write_help = &quot;&quot;&quot;</div>
<div> </div>
<div>-NAME</div>
<div>-    wic write - write an image to a device</div>
<div>+wic_ls_description = &quot;&quot;&quot;</div>
<div>+This command lists either partitions of the image or directory contents</div>
<div>+of vfat or ext* partitions.</div>
<div> </div>
<div>-SYNOPSIS</div>
<div>-    wic write &lt;image&gt; &lt;target&gt;</div>
<div>-    wic write &lt;image&gt; &lt;target&gt; --expand auto</div>
<div>-    wic write &lt;image&gt; &lt;target&gt; --expand 1:100M-2:300M</div>
<div>-    wic write &lt;image&gt; &lt;target&gt; --native-sysroot &lt;path&gt;</div>
<div>+The first form lists partitions of the image.</div>
<div>+For example:</div>
<div>+    $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic</div>
<div>+    Num     Start        End          Size      Fstype</div>
<div>+    1        1048576     24438783     23390208  fat16</div>
<div>+    2       25165824     50315263     25149440  ext4</div>
<div> </div>
<div>-DESCRIPTION</div>
<div>-    This command writes an image to a target device (USB stick, SD card etc)</div>
<div>+The second form lists directory contents of the first partition:</div>
<div> </div>
<div>-        $ wic write ./tmp/deploy/images/qemux86-<wbr>64/core-image-minimal-qemux86-<wbr>64.wic /dev/sdb</div>
<div>+    $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1/EFI/boot/</div>
<div>+    Volume in drive : is boot</div>
<div>+     Volume Serial Number is 2DF2-5F02</div>
<div>+    Directory for ::/EFI/boot</div>
<div> </div>
<div>-    The --expand option is used to resize image partitions.</div>
<div>-    --expand auto expands partitions to occupy all free space available on the target device.</div>
<div>-    It&#39;s also possible to specify expansion rules in a format</div>
<div>-    &lt;partition&gt;:&lt;size&gt;[-&lt;<wbr>partition&gt;:&lt;size&gt;...] for one or more partitions.</div>
<div>-    Specifying size 0 will keep partition unmodified.</div>
<div>-    Note: Resizing boot partition can result in non-bootable image for non-EFI images. It is</div>
<div>-    recommended to use size 0 for boot partition to keep image bootable.</div>
<div>+    .            &lt;DIR&gt;     2017-05-11  10:54</div>
<div>+    ..           &lt;DIR&gt;     2017-05-11  10:54</div>
<div>+    grub     cfg       679 2017-05-11  10:54</div>
<div>+    bootx64  efi    571392 2017-05-11  10:54</div>
<div>+            4 files             572 071 bytes</div>
<div>+                             15 818 752 bytes free</div>
<div> </div>
<div>-    The --native-sysroot option is used to specify the path to the native sysroot</div>
<div>-    containing the tools(parted, resize2fs) to use.</div>
<div> &quot;&quot;&quot;</div>
<div> </div>
<div>-wic_plugins_help = &quot;&quot;&quot;</div>
<div>-</div>
<div>-NAME</div>
<div>-    wic plugins - Overview and API</div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>-    plugins allow wic functionality to be extended and specialized by</div>
<div>-    users.  This section documents the plugin interface, which is</div>
<div>-    currently restricted to &#39;source&#39; plugins.</div>
<div>-</div>
<div>-    &#39;Source&#39; plugins provide a mechanism to customize various aspects</div>
<div>-    of the image generation process in wic, mainly the contents of</div>
<div>-    partitions.</div>
<div>-</div>
<div>-    Source plugins provide a mechanism for mapping values specified in</div>
<div>-    .wks files using the --source keyword to a particular plugin</div>
<div>-    implementation that populates a corresponding partition.</div>
<div>-</div>
<div>-    A source plugin is created as a subclass of SourcePlugin (see</div>
<div>-    scripts/lib/wic/pluginbase.<wbr>py) and the plugin file containing it</div>
<div>-    is added to scripts/lib/wic/plugins/<wbr>source/ to make the plugin</div>
<div>-    implementation available to the wic implementation.</div>
<div>-</div>
<div>-    Source plugins can also be implemented and added by external</div>
<div>-    layers - any plugins found in a scripts/lib/wic/plugins/<wbr>source/</div>
<div>-    directory in an external layer will also be made available.</div>
<div>-</div>
<div>-    When the wic implementation needs to invoke a partition-specific</div>
<div>-    implementation, it looks for the plugin that has the same name as</div>
<div>-    the --source param given to that partition.  For example, if the</div>
<div>-    partition is set up like this:</div>
<div>-</div>
<div>-      part /boot --source bootimg-pcbios   ...</div>
<div>-</div>
<div>-    then the methods defined as class members of the plugin having the</div>
<div>-    matching bootimg-pcbios .name class member would be used.</div>
<div>-</div>
<div>-    To be more concrete, here&#39;s the plugin definition that would match</div>
<div>-    a &#39;--source bootimg-pcbios&#39; usage, along with an example method</div>
<div>-    that would be called by the wic implementation when it needed to</div>
<div>-    invoke an implementation-specific partition-preparation function:</div>
<div>-</div>
<div>-    class BootimgPcbiosPlugin(<wbr>SourcePlugin):</div>
<div>-        name = &#39;bootimg-pcbios&#39;</div>
<div>+wic_cp_description = &quot;&quot;&quot;</div>
<div>+This command copies files and directories to the vfat or ext* partition of</div>
<div>+the partitioned image.</div>
<div> </div>
<div>-    @classmethod</div>
<div>-        def do_prepare_partition(self, part, ...)</div>
<div>-</div>
<div>-    If the subclass itself doesn&#39;t implement a function, a &#39;default&#39;</div>
<div>-    version in a superclass will be located and used, which is why all</div>
<div>-    plugins must be derived from SourcePlugin.</div>
<div>-</div>
<div>-    The SourcePlugin class defines the following methods, which is the</div>
<div>-    current set of methods that can be implemented/overridden by</div>
<div>-    --source plugins.  Any methods not implemented by a SourcePlugin</div>
<div>-    subclass inherit the implementations present in the SourcePlugin</div>
<div>-    class (see the SourcePlugin source for details):</div>
<div>-</div>
<div>-      do_prepare_partition()</div>
<div>-          Called to do the actual content population for a</div>
<div>-          partition. In other words, it &#39;prepares&#39; the final partition</div>
<div>-          image which will be incorporated into the disk image.</div>
<div>-</div>
<div>-      do_configure_partition()</div>
<div>-          Called before do_prepare_partition(), typically used to</div>
<div>-          create custom configuration files for a partition, for</div>
<div>-          example syslinux or grub config files.</div>
<div>-</div>
<div>-      do_install_disk()</div>
<div>-          Called after all partitions have been prepared and assembled</div>
<div>-          into a disk image.  This provides a hook to allow</div>
<div>-          finalization of a disk image, for example to write an MBR to</div>
<div>-          it.</div>
<div>-</div>
<div>-      do_stage_partition()</div>
<div>-          Special content-staging hook called before</div>
<div>-          do_prepare_partition(), normally empty.</div>
<div>-</div>
<div>-          Typically, a partition will just use the passed-in</div>
<div>-          parameters, for example the unmodified value of bootimg_dir.</div>
<div>-          In some cases however, things may need to be more tailored.</div>
<div>-          As an example, certain files may additionally need to be</div>
<div>-          take from bootimg_dir + /boot.  This hook allows those files</div>
<div>-          to be staged in a customized fashion.  Note that</div>
<div>-          get_bitbake_var() allows you to access non-standard</div>
<div>-          variables that you might want to use for these types of</div>
<div>-          situations.</div>
<div>-</div>
<div>-    This scheme is extensible - adding more hooks is a simple matter</div>
<div>-    of adding more plugin methods to SourcePlugin and derived classes.</div>
<div>-    Please see the implementation for details.</div>
<div>+Copies file or directory to the specified directory</div>
<div>+on the partition:</div>
<div>+   $ wic cp test tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1/efi/</div>
<div> &quot;&quot;&quot;</div>
<div> </div>
<div>-wic_overview_help = &quot;&quot;&quot;</div>
<div>-</div>
<div>-NAME</div>
<div>-    wic overview - General overview of wic</div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>-    The &#39;wic&#39; command generates partitioned images from existing</div>
<div>-    OpenEmbedded build artifacts.  Image generation is driven by</div>
<div>-    partitioning commands contained in an &#39;Openembedded kickstart&#39;</div>
<div>-    (.wks) file (see &#39;wic help kickstart&#39;) specified either directly</div>
<div>-    on the command-line or as one of a selection of canned .wks files</div>
<div>-    (see &#39;wic list images&#39;).  When applied to a given set of build</div>
<div>-    artifacts, the result is an image or set of images that can be</div>
<div>-    directly written onto media and used on a particular system.</div>
<div>-</div>
<div>-    The &#39;wic&#39; command and the infrastructure it&#39;s based on is by</div>
<div>-    definition incomplete - its purpose is to allow the generation of</div>
<div>-    customized images, and as such was designed to be completely</div>
<div>-    extensible via a plugin interface (see &#39;wic help plugins&#39;).</div>
<div>-</div>
<div>-  Background and Motivation</div>
<div>-</div>
<div>-    wic is meant to be a completely independent standalone utility</div>
<div>-    that initially provides easier-to-use and more flexible</div>
<div>-    replacements for a couple bits of existing functionality in</div>
<div>-    oe-core: directdisk.bbclass and mkefidisk.sh.  The difference</div>
<div>-    between wic and those examples is that with wic the functionality</div>
<div>-    of those scripts is implemented by a general-purpose partitioning</div>
<div>-    &#39;language&#39; based on Redhat kickstart syntax).</div>
<div>-</div>
<div>-    The initial motivation and design considerations that lead to the</div>
<div>-    current tool are described exhaustively in Yocto Bug #3847</div>
<div>-    (<a href="https://bugzilla.yoctoproject.org/show_bug.cgi?id=3847" target="_blank">https://bugzilla.<wbr>yoctoproject.org/show_bug.cgi?<wbr>id=3847</a>).</div>
<div>-</div>
<div>-  Implementation and Examples</div>
<div>-</div>
<div>-    wic can be used in two different modes, depending on how much</div>
<div>-    control the user needs in specifying the Openembedded build</div>
<div>-    artifacts that will be used in creating the image: &#39;raw&#39; and</div>
<div>-    &#39;cooked&#39;.</div>
<div>-</div>
<div>-    If used in &#39;raw&#39; mode, artifacts are explicitly specified via</div>
<div>-    command-line arguments (see example below).</div>
<div>-</div>
<div>-    The more easily usable &#39;cooked&#39; mode uses the current MACHINE</div>
<div>-    setting and a specified image name to automatically locate the</div>
<div>-    artifacts used to create the image.</div>
<div>-</div>
<div>-    OE kickstart files (.wks) can of course be specified directly on</div>
<div>-    the command-line, but the user can also choose from a set of</div>
<div>-    &#39;canned&#39; .wks files available via the &#39;wic list images&#39; command</div>
<div>-    (example below).</div>
<div>-</div>
<div>-    In any case, the prerequisite for generating any image is to have</div>
<div>-    the build artifacts already available.  The below examples assume</div>
<div>-    the user has already build a &#39;core-image-minimal&#39; for a specific</div>
<div>-    machine (future versions won&#39;t require this redundant step, but</div>
<div>-    for now that&#39;s typically how build artifacts get generated).</div>
<div>-</div>
<div>-    The other prerequisite is to source the build environment:</div>
<div>-</div>
<div>-      $ source oe-init-build-env</div>
<div>-</div>
<div>-    To start out with, we&#39;ll generate an image from one of the canned</div>
<div>-    .wks files.  The following generates a list of availailable</div>
<div>-    images:</div>
<div>-</div>
<div>-      $ wic list images</div>
<div>-        mkefidisk             Create an EFI disk image</div>
<div>-        directdisk            Create a &#39;pcbios&#39; direct disk image</div>
<div>-</div>
<div>-    You can get more information about any of the available images by</div>
<div>-    typing &#39;wic list xxx help&#39;, where &#39;xxx&#39; is one of the image names:</div>
<div>-</div>
<div>-      $ wic list mkefidisk help</div>
<div>-</div>
<div>-    Creates a partitioned EFI disk image that the user can directly dd</div>
<div>-    to boot media.</div>
<div>-</div>
<div>-    At any time, you can get help on the &#39;wic&#39; command or any</div>
<div>-    subcommand (currently &#39;list&#39; and &#39;create&#39;).  For instance, to get</div>
<div>-    the description of &#39;wic create&#39; command and its parameters:</div>
<div>-</div>
<div>-      $ wic create</div>
<div>-</div>
<div>-       Usage:</div>
<div>-</div>
<div>-       Create a new OpenEmbedded image</div>
<div>-</div>
<div>-       usage: wic create &lt;wks file or image name&gt; [-o &lt;DIRNAME&gt; | ...]</div>
<div>-            [-i &lt;JSON PROPERTY FILE&gt; | --infile &lt;JSON PROPERTY_FILE&gt;]</div>
<div>-            [-e | --image-name] [-s, --skip-build-check] [-D, --debug]</div>
<div>-            [-r, --rootfs-dir] [-b, --bootimg-dir] [-k, --kernel-dir]</div>
<div>-            [-n, --native-sysroot] [-f, --build-rootfs]</div>
<div>-</div>
<div>-       This command creates an OpenEmbedded image based on the &#39;OE</div>
<div>-       kickstart commands&#39; found in the &lt;wks file&gt;.</div>
<div>-</div>
<div>-       The -o option can be used to place the image in a directory</div>
<div>-       with a different name and location.</div>
<div>-</div>
<div>-       See &#39;wic help create&#39; for more detailed instructions.</div>
<div>-       ...</div>
<div>-</div>
<div>-    As mentioned in the command, you can get even more detailed</div>
<div>-    information by adding &#39;help&#39; to the above:</div>
<div>-</div>
<div>-      $ wic help create</div>
<div>-</div>
<div>-    So, the easiest way to create an image is to use the -e option</div>
<div>-    with a canned .wks file.  To use the -e option, you need to</div>
<div>-    specify the image used to generate the artifacts and you actually</div>
<div>-    need to have the MACHINE used to build them specified in your</div>
<div>-    local.conf (these requirements aren&#39;t necessary if you aren&#39;t</div>
<div>-    using the -e options.)  Below, we generate a directdisk image,</div>
<div>-    pointing the process at the core-image-minimal artifacts for the</div>
<div>-    current MACHINE:</div>
<div>-</div>
<div>-      $ wic create directdisk -e core-image-minimal</div>
<div>-</div>
<div>-      Checking basic build environment...</div>
<div>-      Done.</div>
<div>-</div>
<div>-      Creating image(s)...</div>
<div>-</div>
<div>-      Info: The new image(s) can be found here:</div>
<div>-      /var/tmp/wic/build/<wbr>directdisk-201309252350-sda.<wbr>direct</div>
<div>-</div>
<div>-      The following build artifacts were used to create the image(s):</div>
<div>-</div>
<div>-      ROOTFS_DIR:      ...</div>
<div>-      BOOTIMG_DIR:     ...</div>
<div>-      KERNEL_DIR:      ...</div>
<div>-      NATIVE_SYSROOT:  ...</div>
<div>-</div>
<div>-      The image(s) were created using OE kickstart file:</div>
<div>-        .../scripts/lib/wic/canned-<wbr>wks/directdisk.wks</div>
<div>-</div>
<div>-    The output shows the name and location of the image created, and</div>
<div>-    so that you know exactly what was used to generate the image, each</div>
<div>-    of the artifacts and the kickstart file used.</div>
<div>-</div>
<div>-    Similarly, you can create a &#39;mkefidisk&#39; image in the same way</div>
<div>-    (notice that this example uses a different machine - because it&#39;s</div>
<div>-    using the -e option, you need to change the MACHINE in your</div>
<div>-    local.conf):</div>
<div>-</div>
<div>-      $ wic create mkefidisk -e core-image-minimal</div>
<div>-      Checking basic build environment...</div>
<div>-      Done.</div>
<div>-</div>
<div>-      Creating image(s)...</div>
<div>-</div>
<div>-      Info: The new image(s) can be found here:</div>
<div>-         /var/tmp/wic/build/mkefidisk-<wbr>201309260027-sda.direct</div>
<div>-</div>
<div>-      ...</div>
<div>-</div>
<div>-    Here&#39;s an example that doesn&#39;t take the easy way out and manually</div>
<div>-    specifies each build artifact, along with a non-canned .wks file,</div>
<div>-    and also uses the -o option to have wic create the output</div>
<div>-    somewhere other than the default /var/tmp/wic:</div>
<div>-</div>
<div>-      $ wic create ./test.wks -o ./out --rootfs-dir</div>
<div>-      tmp/work/qemux86_64-poky-<wbr>linux/core-image-minimal/1.0-<wbr>r0/rootfs</div>
<div>-      --bootimg-dir tmp/sysroots/qemux86-64/usr/<wbr>share</div>
<div>-      --kernel-dir tmp/deploy/images/qemux86-64</div>
<div>-      --native-sysroot tmp/sysroots/x86_64-linux</div>
<div>-</div>
<div>-     Creating image(s)...</div>
<div>-</div>
<div>-     Info: The new image(s) can be found here:</div>
<div>-           out/build/test-201507211313-<wbr>sda.direct</div>
<div>-</div>
<div>-     The following build artifacts were used to create the image(s):</div>
<div>-       ROOTFS_DIR:                   tmp/work/qemux86_64-poky-<wbr>linux/core-image-minimal/1.0-<wbr>r0/rootfs</div>
<div>-       BOOTIMG_DIR:                  tmp/sysroots/qemux86-64/usr/<wbr>share</div>
<div>-       KERNEL_DIR:                   tmp/deploy/images/qemux86-64</div>
<div>-       NATIVE_SYSROOT:               tmp/sysroots/x86_64-linux</div>
<div>-</div>
<div>-     The image(s) were created using OE kickstart file:</div>
<div>-     ./test.wks</div>
<div>-</div>
<div>-     Here is a content of test.wks:</div>
<div> </div>
<div>-     part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024</div>
<div>-     part / --source rootfs --ondisk sda --fstype=ext3 --label platform --align 1024</div>
<div>+wic_rm_description = &quot;&quot;&quot;</div>
<div>+This command removes files or directories from the vfat or ext* partition of the</div>
<div>+partitioned image: wic rm &lt;wic image&gt;:&lt;partition&gt;&lt;path&gt; </div>
<div> </div>
<div>-     bootloader  --timeout=0  --append=&quot;rootwait rootfstype=ext3 video=vesafb vga=0x318 console=tty0&quot;</div>
<div>+$wic rm ./tmp/deploy/images/qemux86-<wbr>64/core-image-minimal-qemux86-<wbr>64.wic:1/libutil.c32 </div>
<div> </div>
<div>-</div>
<div>-    Finally, here&#39;s an example of the actual partition language</div>
<div>-    commands used to generate the mkefidisk image i.e. these are the</div>
<div>-    contents of the mkefidisk.wks OE kickstart file:</div>
<div>-</div>
<div>-      # short-description: Create an EFI disk image</div>
<div>-      # long-description: Creates a partitioned EFI disk image that the user</div>
<div>-      # can directly dd to boot media.</div>
<div>-</div>
<div>-      part /boot --source bootimg-efi --ondisk sda --fstype=efi --active</div>
<div>-</div>
<div>-      part / --source rootfs --ondisk sda --fstype=ext3 --label platform</div>
<div>-</div>
<div>-      part swap --ondisk sda --size 44 --label swap1 --fstype=swap</div>
<div>-</div>
<div>-      bootloader  --timeout=10  --append=&quot;rootwait console=ttyPCH0,115200&quot;</div>
<div>-</div>
<div>-    You can get a complete listing and description of all the</div>
<div>-    kickstart commands available for use in .wks files from &#39;wic help</div>
<div>-    kickstart&#39;.</div>
<div> &quot;&quot;&quot;</div>
<div> </div>
<div>-wic_kickstart_help = &quot;&quot;&quot;</div>
<div>-</div>
<div>-NAME</div>
<div>-    wic kickstart - wic kickstart reference</div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>-    This section provides the definitive reference to the wic</div>
<div>-    kickstart language.  It also provides documentation on the list of</div>
<div>-    --source plugins available for use from the &#39;part&#39; command (see</div>
<div>-    the &#39;Platform-specific Plugins&#39; section below).</div>
<div>-</div>
<div>-    The current wic implementation supports only the basic kickstart</div>
<div>-    partitioning commands: partition (or part for short) and</div>
<div>-    bootloader.</div>
<div>-</div>
<div>-    The following is a listing of the commands, their syntax, and</div>
<div>-    meanings. The commands are based on the Fedora kickstart</div>
<div>-    documentation but with modifications to reflect wic capabilities.</div>
<div>-</div>
<div>-      <a href="http://fedoraproject.org/wiki/Anaconda/Kickstart#part_or_partition" target="_blank">http://fedoraproject.org/<wbr>wiki/Anaconda/Kickstart#part_<wbr>or_partition</a></div>
<div>-      <a href="http://fedoraproject.org/wiki/Anaconda/Kickstart#bootloader" target="_blank">http://fedoraproject.org/<wbr>wiki/Anaconda/Kickstart#<wbr>bootloader</a></div>
<div>-</div>
<div>-  Commands</div>
<div>-</div>
<div>-    * &#39;part&#39; or &#39;partition&#39;</div>
<div>-</div>
<div>-       This command creates a partition on the system and uses the</div>
<div>-       following syntax:</div>
<div>-</div>
<div>-         part [&lt;mountpoint&gt;]</div>
<div>-</div>
<div>-       The &lt;mountpoint&gt; is where the partition will be mounted and</div>
<div>-       must take of one of the following forms:</div>
<div>-</div>
<div>-         /&lt;path&gt;: For example: /, /usr, or /home</div>
<div>-</div>
<div>-         swap: The partition will be used as swap space.</div>
<div>-</div>
<div>-       If a &lt;mountpoint&gt; is not specified the partition will be created</div>
<div>-       but will not be mounted.</div>
<div>-</div>
<div>-       Partitions with a &lt;mountpoint&gt; specified will be automatically mounted.</div>
<div>-       This is achieved by wic adding entries to the fstab during image</div>
<div>-       generation. In order for a valid fstab to be generated one of the</div>
<div>-       --ondrive, --ondisk or --use-uuid partition options must be used for</div>
<div>-       each partition that specifies a mountpoint.</div>
<div>-</div>
<div>-</div>
<div>-       The following are supported &#39;part&#39; options:</div>
<div>-</div>
<div>-         --size: The minimum partition size. Specify an integer value</div>
<div>-                 such as 500. Multipliers k, M ang G can be used. If</div>
<div>-                 not specified, the size is in MB.</div>
<div>-                 You do not need this option if you use --source.</div>
<div>-</div>
<div>-         --fixed-size: Exact partition size. Value format is the same</div>
<div>-                       as for --size option. This option cannot be</div>
<div>-                       specified along with --size. If partition data</div>
<div>-                       is larger than --fixed-size and error will be</div>
<div>-                       raised when assembling disk image.</div>
<div>-</div>
<div>-         --source: This option is a wic-specific option that names the</div>
<div>-                   source of the data that will populate the</div>
<div>-                   partition.  The most common value for this option</div>
<div>-                   is &#39;rootfs&#39;, but can be any value which maps to a</div>
<div>-                   valid &#39;source plugin&#39; (see &#39;wic help plugins&#39;).</div>
<div>-</div>
<div>-                   If &#39;--source rootfs&#39; is used, it tells the wic</div>
<div>-                   command to create a partition as large as needed</div>
<div>-                   and to fill it with the contents of the root</div>
<div>-                   filesystem pointed to by the &#39;-r&#39; wic command-line</div>
<div>-                   option (or the equivalent rootfs derived from the</div>
<div>-                   &#39;-e&#39; command-line option).  The filesystem type</div>
<div>-                   that will be used to create the partition is driven</div>
<div>-                   by the value of the --fstype option specified for</div>
<div>-                   the partition (see --fstype below).</div>
<div>-</div>
<div>-                   If --source &lt;plugin-name&gt;&#39; is used, it tells the</div>
<div>-                   wic command to create a partition as large as</div>
<div>-                   needed and to fill with the contents of the</div>
<div>-                   partition that will be generated by the specified</div>
<div>-                   plugin name using the data pointed to by the &#39;-r&#39;</div>
<div>-                   wic command-line option (or the equivalent rootfs</div>
<div>-                   derived from the &#39;-e&#39; command-line option).</div>
<div>-                   Exactly what those contents and filesystem type end</div>
<div>-                   up being are dependent on the given plugin</div>
<div>-                   implementation.</div>
<div>-</div>
<div>-                   If --source option is not used, the wic command</div>
<div>-                   will create empty partition. --size parameter has</div>
<div>-                   to be used to specify size of empty partition.</div>
<div>+wic_write_description = &quot;&quot;&quot;</div>
<div>+This command writes an image to a target device (USB stick, SD card etc)</div>
<div> </div>
<div>-         --ondisk or --ondrive: Forces the partition to be created on</div>
<div>-                                a particular disk.</div>
<div>-</div>
<div>-         --fstype: Sets the file system type for the partition.  These</div>
<div>-           apply to partitions created using &#39;--source rootfs&#39; (see</div>
<div>-           --source above).  Valid values are:</div>
<div>-</div>
<div>-             vfat</div>
<div>-             msdos</div>
<div>-             ext2</div>
<div>-             ext3</div>
<div>-             ext4</div>
<div>-             btrfs</div>
<div>-             squashfs</div>
<div>-             swap</div>
<div>-</div>
<div>-         --fsoptions: Specifies a free-form string of options to be</div>
<div>-                      used when mounting the filesystem. This string</div>
<div>-                      will be copied into the /etc/fstab file of the</div>
<div>-                      installed system and should be enclosed in</div>
<div>-                      quotes.  If not specified, the default string is</div>
<div>-                      &quot;defaults&quot;.</div>
<div>-</div>
<div>-         --label label: Specifies the label to give to the filesystem</div>
<div>-                        to be made on the partition. If the given</div>
<div>-                        label is already in use by another filesystem,</div>
<div>-                        a new label is created for the partition.</div>
<div>-</div>
<div>-         --active: Marks the partition as active.</div>
<div>-</div>
<div>-         --align (in KBytes): This option is specific to wic and says</div>
<div>-                              to start a partition on an x KBytes</div>
<div>-                              boundary.</div>
<div>-</div>
<div>-         --no-table: This option is specific to wic. Space will be</div>
<div>-                     reserved for the partition and it will be</div>
<div>-                     populated but it will not be added to the</div>
<div>-                     partition table. It may be useful for</div>
<div>-                     bootloaders.</div>
<div>-</div>
<div>-         --exclude-path: This option is specific to wic. It excludes the given</div>
<div>-                         relative path from the resulting image. If the path</div>
<div>-                         ends with a slash, only the content of the directory</div>
<div>-                         is omitted, not the directory itself. This option only</div>
<div>-                         has an effect with the rootfs source plugin.</div>
<div>-</div>
<div>-         --extra-space: This option is specific to wic. It adds extra</div>
<div>-                        space after the space filled by the content</div>
<div>-                        of the partition. The final size can go</div>
<div>-                        beyond the size specified by --size.</div>
<div>-                        By default, 10MB. This option cannot be used</div>
<div>-                        with --fixed-size option.</div>
<div>-</div>
<div>-         --overhead-factor: This option is specific to wic. The</div>
<div>-                            size of the partition is multiplied by</div>
<div>-                            this factor. It has to be greater than or</div>
<div>-                            equal to 1. The default value is 1.3.</div>
<div>-                            This option cannot be used with --fixed-size</div>
<div>-                            option.</div>
<div>-</div>
<div>-         --part-name: This option is specific to wic. It specifies name for GPT partitions.</div>
<div>-</div>
<div>-         --part-type: This option is specific to wic. It specifies partition</div>
<div>-                      type GUID for GPT partitions.</div>
<div>-                      List of partition type GUIDS can be found here:</div>
<div>-                      <a href="http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs" target="_blank">http://en.wikipedia.org/wiki/<wbr>GUID_Partition_Table#<wbr>Partition_type_GUIDs</a></div>
<div>-</div>
<div>-         --use-uuid: This option is specific to wic. It makes wic to generate</div>
<div>-                     random globally unique identifier (GUID) for the partition</div>
<div>-                     and use it in bootloader configuration to specify root partition.</div>
<div>-</div>
<div>-         --uuid: This option is specific to wic. It specifies partition UUID.</div>
<div>-                 It&#39;s useful if preconfigured partition UUID is added to kernel command line</div>
<div>-                 in bootloader configuration before running wic. In this case .wks file can</div>
<div>-                 be generated or modified to set preconfigured parition UUID using this option.</div>
<div>-</div>
<div>-         --system-id: This option is specific to wic. It specifies partition system id. It&#39;s useful</div>
<div>-                      for the harware that requires non-default partition system ids. The parameter</div>
<div>-                      in one byte long hex number either with 0x prefix or without it.</div>
<div>-</div>
<div>-         --mkfs-extraopts: This option specifies extra options to pass to mkfs utility.</div>
<div>-                           NOTE, that wic uses default options for some filesystems, for example</div>
<div>-                           &#39;-S 512&#39; for mkfs.fat or &#39;-F -i 8192&#39; for mkfs.ext. Those options will</div>
<div>-                           not take effect when --mkfs-extraopts is used. This should be taken into</div>
<div>-                           account when using --mkfs-extraopts.</div>
<div>-</div>
<div>-    * bootloader</div>
<div>-</div>
<div>-      This command allows the user to specify various bootloader</div>
<div>-      options.  The following are supported &#39;bootloader&#39; options:</div>
<div>-</div>
<div>-        --timeout: Specifies the number of seconds before the</div>
<div>-                   bootloader times out and boots the default option.</div>
<div>-</div>
<div>-        --append: Specifies kernel parameters. These will be added to</div>
<div>-                  bootloader command-line - for example, the syslinux</div>
<div>-                  APPEND or grub kernel command line.</div>
<div>-</div>
<div>-        --configfile: Specifies a user defined configuration file for</div>
<div>-                      the bootloader. This file must be located in the</div>
<div>-                      canned-wks folder or could be the full path to the</div>
<div>-                      file. Using this option will override any other</div>
<div>-                      bootloader option.</div>
<div>-</div>
<div>-      Note that bootloader functionality and boot partitions are</div>
<div>-      implemented by the various --source plugins that implement</div>
<div>-      bootloader functionality; the bootloader command essentially</div>
<div>-      provides a means of modifying bootloader configuration.</div>
<div>-</div>
<div>-    * include</div>
<div>-</div>
<div>-      This command allows the user to include the content of .wks file</div>
<div>-      into original .wks file.</div>
<div>-</div>
<div>-      Command uses the following syntax:</div>
<div>-</div>
<div>-         include &lt;file&gt;</div>
<div>-</div>
<div>-      The &lt;file&gt; is either path to the file or its name. If name is</div>
<div>-      specified wic will try to find file in the directories with canned</div>
<div>-      .wks files.</div>
<div>-</div>
<div>-&quot;&quot;&quot;</div>
<div>+    $ wic write ./tmp/deploy/images/qemux86-<wbr>64/core-image-minimal-qemux86-<wbr>64.wic /dev/sdb</div>
<div> </div>
<div>-wic_help_help = &quot;&quot;&quot;</div>
<div>-NAME</div>
<div>-    wic help - display a help topic</div>
<div>+The --expand option is used to resize image partitions.</div>
<div>+--expand auto expands partitions to occupy all free space available on the target device.</div>
<div>+It&#39;s also possible to specify expansion rules in a format</div>
<div>+&lt;partition&gt;:&lt;size&gt;[-&lt;<wbr>partition&gt;:&lt;size&gt;...] for one or more partitions.</div>
<div>+Specifying size 0 will keep partition unmodified.</div>
<div>+Note: Resizing boot partition can result in non-bootable image for non-EFI images. It is</div>
<div>+recommended to use size 0 for boot partition to keep image bootable.</div>
<div> </div>
<div>-DESCRIPTION</div>
<div>-    Specify a help topic to display it. Topics are shown above.</div>
<div> &quot;&quot;&quot;</div>
<div>diff --git a/scripts/wic b/scripts/wic</div>
<div>index 097084a..cb348e3 100755</div>
<div>--- a/scripts/wic</div>
<div>+++ b/scripts/wic</div>
<div>@@ -106,7 +106,7 @@ class RootfsArgAction(argparse.<wbr>Action):</div>
<div>         namespace.__dict__[&#39;rootfs_<wbr>dir&#39;][key] = rootfs_dir</div>
<div> </div>
<div> </div>
<div>-def wic_create_subcommand(options, usage_str):</div>
<div>+def wic_create_subcommand(options)<wbr>:</div>
<div>     &quot;&quot;&quot;</div>
<div>     Command-line handling for image creation.  The real work is done</div>
<div>     by image.engine.wic_create()</div>
<div>@@ -177,7 +177,7 @@ def wic_create_subcommand(options, usage_str):</div>
<div>     wks_file = options.wks_file</div>
<div> </div>
<div>     if not wks_file.endswith(&quot;.wks&quot;):</div>
<div>-        wks_file = engine.find_canned_image(<wbr>scripts_path, wks_file)</div>
<div>+        wks_file = engine.find_canned_image(wks_<wbr>file)</div>
<div>         if not wks_file:</div>
<div>             raise WicError(&quot;No image named %s found, exiting.  (Use &#39;wic list images&#39; &quot;</div>
<div>                            &quot;to list available images, or specify a fully-qualified OE &quot;</div>
<div>@@ -227,91 +227,44 @@ def wic_create_subcommand(options, usage_str):</div>
<div>                       native_sysroot, options)</div>
<div> </div>
<div> </div>
<div>-def wic_list_subcommand(args, usage_str):</div>
<div>+def wic_list_subcommand(args):</div>
<div>     &quot;&quot;&quot;</div>
<div>     Command-line handling for listing available images.</div>
<div>     The real work is done by image.engine.wic_list()</div>
<div>     &quot;&quot;&quot;</div>
<div>-    if not engine.wic_list(args, scripts_path):</div>
<div>+    if not engine.wic_list(scripts_path, args):</div>
<div>         raise WicError(&quot;Bad list arguments, exiting&quot;)</div>
<div> </div>
<div> </div>
<div>-def wic_ls_subcommand(args, usage_str):</div>
<div>+def wic_ls_subcommand(args):</div>
<div>     &quot;&quot;&quot;</div>
<div>     Command-line handling for list content of images.</div>
<div>     The real work is done by engine.wic_ls()</div>
<div>     &quot;&quot;&quot;</div>
<div>     engine.wic_ls(args, args.native_sysroot)</div>
<div> </div>
<div>-def wic_cp_subcommand(args, usage_str):</div>
<div>+def wic_cp_subcommand(args):</div>
<div>     &quot;&quot;&quot;</div>
<div>     Command-line handling for copying files/dirs to images.</div>
<div>     The real work is done by engine.wic_cp()</div>
<div>     &quot;&quot;&quot;</div>
<div>     engine.wic_cp(args, args.native_sysroot)</div>
<div> </div>
<div>-def wic_rm_subcommand(args, usage_str):</div>
<div>+def wic_rm_subcommand(args):</div>
<div>     &quot;&quot;&quot;</div>
<div>     Command-line handling for removing files/dirs from images.</div>
<div>     The real work is done by engine.wic_rm()</div>
<div>     &quot;&quot;&quot;</div>
<div>     engine.wic_rm(args, args.native_sysroot)</div>
<div> </div>
<div>-def wic_write_subcommand(args, usage_str):</div>
<div>+def wic_write_subcommand(args):</div>
<div>     &quot;&quot;&quot;</div>
<div>     Command-line handling for writing images.</div>
<div>     The real work is done by engine.wic_write()</div>
<div>     &quot;&quot;&quot;</div>
<div>     engine.wic_write(args, args.native_sysroot)</div>
<div> </div>
<div>-def wic_help_subcommand(args, usage_str):</div>
<div>-    &quot;&quot;&quot;</div>
<div>-    Command-line handling for help subcommand to keep the current</div>
<div>-    structure of the function definitions.</div>
<div>-    &quot;&quot;&quot;</div>
<div>-    pass</div>
<div>-</div>
<div> </div>
<div>-def wic_help_topic_subcommand(<wbr>usage_str, help_str):</div>
<div>-    &quot;&quot;&quot;</div>
<div>-    Display function for help &#39;sub-subcommands&#39;.</div>
<div>-    &quot;&quot;&quot;</div>
<div>-    print(help_str)</div>
<div>-    return</div>
<div>-</div>
<div>-</div>
<div>-wic_help_topic_usage = &quot;&quot;&quot;</div>
<div>-&quot;&quot;&quot;</div>
<div>-</div>
<div>-helptopics = {</div>
<div>-    &quot;plugins&quot;:   [wic_help_topic_subcommand,</div>
<div>-                  wic_help_topic_usage,</div>
<div>-                  hlp.wic_plugins_help],</div>
<div>-    &quot;overview&quot;:  [wic_help_topic_subcommand,</div>
<div>-                  wic_help_topic_usage,</div>
<div>-                  hlp.wic_overview_help],</div>
<div>-    &quot;kickstart&quot;: [wic_help_topic_subcommand,</div>
<div>-                  wic_help_topic_usage,</div>
<div>-                  hlp.wic_kickstart_help],</div>
<div>-    &quot;create&quot;:    [wic_help_topic_subcommand,</div>
<div>-                  wic_help_topic_usage,</div>
<div>-                  hlp.wic_create_help],</div>
<div>-    &quot;ls&quot;:        [wic_help_topic_subcommand,</div>
<div>-                  wic_help_topic_usage,</div>
<div>-                  hlp.wic_ls_help],</div>
<div>-    &quot;cp&quot;:        [wic_help_topic_subcommand,</div>
<div>-                  wic_help_topic_usage,</div>
<div>-                  hlp.wic_cp_help],</div>
<div>-    &quot;rm&quot;:        [wic_help_topic_subcommand,</div>
<div>-                  wic_help_topic_usage,</div>
<div>-                  hlp.wic_rm_help],</div>
<div>-    &quot;write&quot;:     [wic_help_topic_subcommand,</div>
<div>-                  wic_help_topic_usage,</div>
<div>-                  hlp.wic_write_help],</div>
<div>-    &quot;list&quot;:      [wic_help_topic_subcommand,</div>
<div>-                  wic_help_topic_usage,</div>
<div>-                  hlp.wic_list_help]</div>
<div>-}</div>
<div> </div>
<div> </div>
<div> def wic_init_parser_create(<wbr>subparser):</div>
<div>@@ -333,17 +286,15 @@ def wic_init_parser_create(<wbr>subparser):</div>
<div>                       help=&quot;path to the dir containing the kernel to use &quot;</div>
<div>                            &quot;in the .wks bootimg&quot;)</div>
<div>     subparser.add_argument(&quot;-n&quot;, &quot;--native-sysroot&quot;, dest=&quot;native_sysroot&quot;,</div>
<div>-                      help=&quot;path to the native sysroot containing the tools &quot;</div>
<div>-                           &quot;to use to build the image&quot;)</div>
<div>+                      help=&quot;path to the native sysroot containing the tools (parted and mtools) to use.&quot;)</div>
<div>     subparser.add_argument(&quot;-s&quot;, &quot;--skip-build-check&quot;, dest=&quot;build_check&quot;,</div>
<div>                       action=&quot;store_false&quot;, default=True, help=&quot;skip the build check&quot;)</div>
<div>     subparser.add_argument(&quot;-f&quot;, &quot;--build-rootfs&quot;, action=&quot;store_true&quot;, help=&quot;build rootfs&quot;)</div>
<div>     subparser.add_argument(&quot;-c&quot;, &quot;--compress-with&quot;, choices=(&quot;gzip&quot;, &quot;bzip2&quot;, &quot;xz&quot;),</div>
<div>                       dest=&#39;compressor&#39;,</div>
<div>                       help=&quot;compress image with specified compressor&quot;)</div>
<div>-    subparser.add_argument(&quot;-m&quot;, &quot;--bmap&quot;, action=&quot;store_true&quot;, help=&quot;generate .bmap&quot;)</div>
<div>-    subparser.add_argument(&quot;--no-<wbr>fstab-update&quot; ,action=&quot;store_true&quot;,</div>
<div>-                      help=&quot;Do not change fstab file.&quot;)</div>
<div>+    subparser.add_argument(&quot;-m&quot;, &quot;--bmap&quot;, action=&quot;store_true&quot;, help=&quot;used to produce .bmap file for the image.&quot;</div>
<div>+                           &quot;This file can be used to flash image using bmaptool utility&quot;)</div>
<div>     subparser.add_argument(&quot;-v&quot;, &quot;--vars&quot;, dest=&#39;vars_dir&#39;,</div>
<div>                       help=&quot;directory with &lt;image&gt;.env files that store &quot;</div>
<div>                            &quot;bitbake variables&quot;)</div>
<div>@@ -357,10 +308,10 @@ def wic_init_parser_list(<wbr>subparser):</div>
<div>                         help=&quot;can be &#39;images&#39; or &#39;source-plugins&#39; &quot;</div>
<div>                              &quot;to obtain a list. &quot;</div>
<div>                              &quot;If value is a valid .wks image file&quot;)</div>
<div>-    subparser.add_argument(&quot;help_<wbr>for&quot;, default=[], nargs=&#39;*&#39;,</div>
<div>+    subparser.add_argument(&quot;info_<wbr>for&quot;, default=[], nargs=&#39;*&#39;,</div>
<div>                         help=&quot;If &#39;list_type&#39; is a valid .wks image file &quot;</div>
<div>-                             &quot;this value can be &#39;help&#39; to show the help information &quot;</div>
<div>-                             &quot;defined inside the .wks file&quot;)</div>
<div>+                             &quot;this value can be &#39;info&#39; to show the image or plugin information &quot;)</div>
<div>+</div>
<div>     return</div>
<div> </div>
<div> def imgtype(arg):</div>
<div>@@ -385,9 +336,9 @@ def imgtype(arg):</div>
<div> </div>
<div> def wic_init_parser_ls(subparser):</div>
<div>     subparser.add_argument(&quot;path&quot;<wbr>, type=imgtype,</div>
<div>-                        help=&quot;image spec: &lt;image&gt;[:&lt;vfat partition&gt;[&lt;path&gt;]]&quot;)</div>
<div>+                        help=&quot;image spec: &lt;image&gt;[:&lt;partition&gt;[&lt;path&gt;]]&quot;<wbr>)</div>
<div>     subparser.add_argument(&quot;-n&quot;, &quot;--native-sysroot&quot;,</div>
<div>-                        help=&quot;path to the native sysroot containing the tools&quot;)</div>
<div>+                        help=&quot;path to the native sysroot containing the tools (parted and mtools) to use.&quot;)</div>
<div> </div>
<div> def imgpathtype(arg):</div>
<div>     img = imgtype(arg)</div>
<div>@@ -399,15 +350,15 @@ def wic_init_parser_cp(subparser):</div>
<div>     subparser.add_argument(&quot;src&quot;,</div>
<div>                         help=&quot;source spec&quot;)</div>
<div>     subparser.add_argument(&quot;dest&quot;<wbr>, type=imgpathtype,</div>
<div>-                        help=&quot;image spec: &lt;image&gt;:&lt;vfat partition&gt;[&lt;path&gt;]&quot;)</div>
<div>+                        help=&quot;image spec: &lt;image&gt;:&lt;partition&gt;[&lt;path&gt;]&quot;)</div>
<div>     subparser.add_argument(&quot;-n&quot;, &quot;--native-sysroot&quot;,</div>
<div>-                        help=&quot;path to the native sysroot containing the tools&quot;)</div>
<div>+                        help=&quot;path to the native sysroot containing the tools (parted and mtools) to use.&quot;)</div>
<div> </div>
<div> def wic_init_parser_rm(subparser):</div>
<div>     subparser.add_argument(&quot;path&quot;<wbr>, type=imgpathtype,</div>
<div>-                        help=&quot;path: &lt;image&gt;:&lt;vfat partition&gt;&lt;path&gt;&quot;)</div>
<div>+                        help=&quot;image spec: &lt;image&gt;[:&lt;partition&gt;[&lt;path&gt;]&quot;)</div>
<div>     subparser.add_argument(&quot;-n&quot;, &quot;--native-sysroot&quot;,</div>
<div>-                        help=&quot;path to the native sysroot containing the tools&quot;)</div>
<div>+                        help=&quot;path to the native sysroot containing the tools (parted and mtools) to use.&quot;)</div>
<div> </div>
<div> def expandtype(rules):</div>
<div>     &quot;&quot;&quot;</div>
<div>@@ -448,59 +399,56 @@ def wic_init_parser_write(<wbr>subparser):</div>
<div>     subparser.add_argument(&quot;-e&quot;, &quot;--expand&quot;, type=expandtype,</div>
<div>                         help=&quot;expand rules: auto or &lt;partition&gt;:&lt;size&gt;[,&lt;<wbr>partition&gt;:&lt;size&gt;]&quot;)</div>
<div>     subparser.add_argument(&quot;-n&quot;, &quot;--native-sysroot&quot;,</div>
<div>-                        help=&quot;path to the native sysroot containing the tools&quot;)</div>
<div>-</div>
<div>-def wic_init_parser_help(<wbr>subparser):</div>
<div>-    helpparsers = subparser.add_subparsers(dest=<wbr>&#39;help_topic&#39;, help=hlp.wic_usage)</div>
<div>-    for helptopic in helptopics:</div>
<div>-        helpparsers.add_parser(<wbr>helptopic, help=helptopics[helptopic][2])</div>
<div>-    return</div>
<div>+                        help=&quot;path to the native sysroot containing the tools (parted and mtools) to use.&quot;)</div>
<div> </div>
<div> </div>
<div> subcommands = {</div>
<div>     &quot;create&quot;:    [wic_create_subcommand,</div>
<div>-                  hlp.wic_create_usage,</div>
<div>-                  hlp.wic_create_help,</div>
<div>-                  wic_init_parser_create],</div>
<div>+                  hlp.wic_create_description,</div>
<div>+                  wic_init_parser_create,</div>
<div>+                  hlp.wic_create_short_<wbr>description],</div>
<div>     &quot;list&quot;:      [wic_list_subcommand,</div>
<div>-                  hlp.wic_list_usage,</div>
<div>-                  hlp.wic_list_help,</div>
<div>-                  wic_init_parser_list],</div>
<div>+                  hlp.wic_list_description,</div>
<div>+                  wic_init_parser_list,</div>
<div>+                  hlp.wic_list_short_<wbr>description],</div>
<div>     &quot;ls&quot;:        [wic_ls_subcommand,</div>
<div>-                  hlp.wic_ls_usage,</div>
<div>-                  hlp.wic_ls_help,</div>
<div>-                  wic_init_parser_ls],</div>
<div>+                  hlp.wic_ls_description,</div>
<div>+                  wic_init_parser_ls,</div>
<div>+                  hlp.wic_ls_short_description]<wbr>,</div>
<div>     &quot;cp&quot;:        [wic_cp_subcommand,</div>
<div>-                  hlp.wic_cp_usage,</div>
<div>-                  hlp.wic_cp_help,</div>
<div>-                  wic_init_parser_cp],</div>
<div>+                  hlp.wic_cp_description,</div>
<div>+                  wic_init_parser_cp,</div>
<div>+                  hlp.wic_cp_short_description]<wbr>,</div>
<div>     &quot;rm&quot;:        [wic_rm_subcommand,</div>
<div>-                  hlp.wic_rm_usage,</div>
<div>-                  hlp.wic_rm_help,</div>
<div>-                  wic_init_parser_rm],</div>
<div>+                  hlp.wic_rm_description,</div>
<div>+                  wic_init_parser_rm,</div>
<div>+                  hlp.wic_rm_short_description]<wbr>,</div>
<div>     &quot;write&quot;:     [wic_write_subcommand,</div>
<div>-                  hlp.wic_write_usage,</div>
<div>-                  hlp.wic_write_help,</div>
<div>-                  wic_init_parser_write],</div>
<div>-    &quot;help&quot;:      [wic_help_subcommand,</div>
<div>-                  wic_help_topic_usage,</div>
<div>-                  hlp.wic_help_help,</div>
<div>-                  wic_init_parser_help]</div>
<div>+                  hlp.wic_write_description,</div>
<div>+                  wic_init_parser_write,</div>
<div>+                  hlp.wic_write_short_<wbr>description],</div>
<div> }</div>
<div> </div>
<div>+def invoke_subcommand(args, parser, main_command_usage, subcommands):</div>
<div>+        subcmd = subcommands.get(args.command, subcommand_error)</div>
<div>+        usage = subcmd[1]</div>
<div>+        subcmd[0](args, usage)</div>
<div>+</div>
<div> </div>
<div> def init_parser(parser):</div>
<div>     parser.add_argument(&quot;--<wbr>version&quot;, action=&quot;version&quot;,</div>
<div>         version=&quot;%(prog)s {version}&quot;.format(version=__<wbr>version__))</div>
<div>-    subparsers = parser.add_subparsers(dest=&#39;<wbr>command&#39;, help=hlp.wic_usage)</div>
<div>+    subparsers = parser.add_subparsers(dest=&#39;<wbr>command&#39;)</div>
<div>+    helpparser = subparsers.add_parser(&quot;help&quot;, help=&quot;Display usages&quot;)</div>
<div>     for subcmd in subcommands:</div>
<div>-        subparser = subparsers.add_parser(subcmd, help=subcommands[subcmd][2])</div>
<div>-        subcommands[subcmd][3](<wbr>subparser)</div>
<div>+        subparser = subparsers.add_parser(subcmd, help=subcommands[subcmd][3], formatter_class=argparse.<wbr>RawDescriptionHelpFormatter, description=subcommands[<wbr>subcmd][1])</div>
<div>+        subcommands[subcmd][2](<wbr>subparser)</div>
<div>+</div>
<div> </div>
<div> </div>
<div> def main(argv):</div>
<div>     parser = argparse.ArgumentParser(</div>
<div>-        description=&quot;wic version %s&quot; % __version__)</div>
<div>+        description=&quot;Create a customized OpenEmbedded image. Wic version %s&quot; % __version__)</div>
<div> </div>
<div>     init_parser(parser)</div>
<div> </div>
<div>@@ -508,22 +456,15 @@ def main(argv):</div>
<div> </div>
<div>     if &quot;command&quot; in vars(args):</div>
<div>         if args.command == &quot;help&quot;:</div>
<div>-            if args.help_topic is None:</div>
<div>-                parser.print_help()</div>
<div>-                print()</div>
<div>-                print(&quot;Please specify a help topic&quot;)</div>
<div>-            elif args.help_topic in helptopics:</div>
<div>-                hlpt = helptopics[args.help_topic]</div>
<div>-                hlpt[0](hlpt[1], hlpt[2])</div>
<div>-            return 0</div>
<div>-</div>
<div>-    return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands)</div>
<div>-</div>
<div>+            parser.print_help()</div>
<div>+            print()</div>
<div>+        else:</div>
<div>+            subcmd = subcommands.get(args.command)</div>
<div>+            subcmd[0](args)</div>
<div> </div>
<div> if __name__ == &quot;__main__&quot;:</div>
<div>     try:</div>
<div>         sys.exit(main(sys.argv[1:]))</div>
<div>     except WicError as err:</div>
<div>-        print()</div>
<div>         logger.error(err)</div>
<div>         sys.exit(1)</div><span class="HOEnZb"><font color="#888888">
<div>-- </div>
<div>2.7.4</div>
<div><br>
</div>
</font></span></div>
<div>
<div id="m_4720050032115839289MAC_OUTLOOK_SIGNATURE"></div>
</div>
</div>

<br>--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
<br></blockquote></div><br></div>