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

Can you resend that using git= -send-email?=C2=A0 Copy/pasting it into a mail client has sent it as HTML, = which git-apply can't read.

Cheers,
= Ross

O= n 11 December 2017 at 21:25, Elliot, Amber N <amber.n.elliot@intel= .com> wrote:
The wic help output formally consisted of manually created strings mix= ed with argparse,
which was unformatted and unusable. This fix cleans up the help messag= es, rewrites help
functionality to use argparse, and adds functionality to show informat= ion for
plugins (similar to canned images).

Fixes [YOCTO #12205]

Signed-off-by: anelliot <amber.n.elliot@intel.com>
---
=C2=A0scripts/lib/wic/engine.py | =C2=A0 87 +++-
=C2=A0scripts/lib/wic/help.py =C2=A0 | 1072 +++++---------------------= -------------------
=C2=A0scripts/wic =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | = =C2=A0169 +++----
=C2=A03 files changed, 243 insertions(+), 1085 deletions(-)

diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index edcfab3..5d1e1d8 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -58,6 +58,8 @@ def verify_build_env():
=C2=A0
=C2=A0CANNED_IMAGE_DIR =3D "lib/wic/canned-wks" # relative t= o scripts
=C2=A0SCRIPTS_CANNED_IMAGE_DIR =3D "scripts/" + CANNED_IMAGE= _DIR
+SOURCE_PLUGIN_DIR =3D "lib/wic/plugins/source"
+SCRIPTS_SOURCE_PLUGIN_DIR =3D "scripts/" + SOURCE_PLUGIN_DI= R
=C2=A0WIC_DIR =3D "wic"
=C2=A0
=C2=A0def build_canned_image_list(path):
@@ -76,6 +78,23 @@ def build_canned_image_list(path):
=C2=A0
=C2=A0 =C2=A0 =C2=A0return canned_wks_layer_dirs
=C2=A0
+def build_source_plugin_list(path):
+ =C2=A0 =C2=A0layers_path =3D get_bitbake_var("BBLAYERS")
+ =C2=A0 =C2=A0canned_wks_layer_dirs =3D []
+
+ =C2=A0 =C2=A0if layers_path is not None:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0for layer_path in layers_path.split():
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for wks_path in (WIC_DIR, S= CRIPTS_SOURCE_PLUGIN_DIR):
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cpath =3D os.= path.join(layer_path, wks_path)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if os.path.is= dir(cpath):
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0canned_wks_layer_dirs.append(cpath)
+
+ =C2=A0 =C2=A0cpath =3D os.path.join(path, SOURCE_PLUGIN_DIR)
+ =C2=A0 =C2=A0canned_wks_layer_dirs.append(cpath)
+
+ =C2=A0 =C2=A0return canned_wks_layer_dirs
+
+
=C2=A0def find_canned_image(scripts_path, wks_file):
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0Find a .wks file with the given name in the canned= files dir.
@@ -95,6 +114,24 @@ def find_canned_image(scripts_path, wks_file)= :
=C2=A0 =C2=A0 =C2=A0return None
=C2=A0
=C2=A0
+def find_source_plugin(scripts_path, plugin_file):
+ =C2=A0 =C2=A0"""
+ =C2=A0 =C2=A0Find a .py file with the given name in the source plugi= n dir.
+
+ =C2=A0 =C2=A0Return False if not found
+ =C2=A0 =C2=A0"""
+ =C2=A0 =C2=A0layers_source_plugin_dir =3D build_source_plugin_list(<= wbr>scripts_path)
+
+ =C2=A0 =C2=A0for source_plugin_dir in layers_source_plugin_dir:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0for root, dirs, files in os.walk(source_p= lugin_dir):
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for fname in files:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if fname.ends= with("~") or fname.endswith("#"):
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0continue
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if fname.ends= with(".py") and plugin_file + ".py" =3D=3D fname:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0fullpath =3D os.path.join(source_plugin_dir, fname)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0return fullpath
+ =C2=A0 =C2=A0return None
+
=C2=A0def list_canned_images(scripts_path):
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0List the .wks files in the canned image dir, minus= the extension.
@@ -119,7 +156,7 @@ def list_canned_images(scripts_path):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0print(" =C2=A0%s\t\t%s" % (basename.ljust(30), desc))
=C2=A0
=C2=A0
-def list_canned_image_help(scripts_path, fullpath):
+def list_canned_image_help(fullpath):
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0List the help and params in the specified canned i= mage.
=C2=A0 =C2=A0 =C2=A0"""
@@ -139,6 +176,7 @@ def list_canned_image_help(scripts_path, full= path):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if idx !=3D -1:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print(li= ne[idx + len("#:"):].rstrip())
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break
=C2=A0
=C2=A0
@@ -152,6 +190,29 @@ def list_source_plugins():
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print(" =C2=A0%s" % plugin= )
=C2=A0
=C2=A0
+def list_source_plugins_help(fullpath):
+ =C2=A0 =C2=A0"""
+ =C2=A0 =C2=A0List the help and params in the specified canned image.=
+ =C2=A0 =C2=A0"""
+ =C2=A0 =C2=A0found =3D False
+ =C2=A0 =C2=A0with open(fullpath) as plugin:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0for line in plugin:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if not found:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0idx =3D line.= find("DESCRIPTION")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if idx !=3D -= 1:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0print(line[idx + len("DESCRIPTION"):].strip())
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0found =3D True
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0continue
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if not line.strip():
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0idx =3D line.find("#&q= uot;)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0auth =3D line.find("AU= THORS")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if idx !=3D -1 and auth =3D= =3D -1:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print(line[id= x + len("#:"):].rstrip())
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break
+
+
=C2=A0def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 native_sysroot= , options):
=C2=A0 =C2=A0 =C2=A0"""
@@ -204,7 +265,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, = kernel_dir,
=C2=A0 =C2=A0 =C2=A0l= ogger.info("The image(s) were created using OE kickstart file:\n = =C2=A0%s", wks_file)
=C2=A0
=C2=A0
-def wic_list(args, scripts_path):
+def wic_list(scripts_path, args):
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0Print the list of images or source plugins.
=C2=A0 =C2=A0 =C2=A0"""
@@ -218,16 +279,20 @@ def wic_list(args, scripts_path):
=C2=A0 =C2=A0 =C2=A0elif args.list_type =3D=3D "source-plugins&qu= ot;:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0list_source_plugins()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return True
- =C2=A0 =C2=A0elif len(args.help_for) =3D=3D 1 and args.help_for[0] = =3D=3D 'help':
- =C2=A0 =C2=A0 =C2=A0 =C2=A0wks_file =3D args.list_type
- =C2=A0 =C2=A0 =C2=A0 =C2=A0fullpath =3D find_canned_image(scripts_path, wks_file)
+ =C2=A0 =C2=A0elif len(args.info_for) =3D=3D 1 and args.info_for[0] = =3D=3D 'info':
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0input_file =3D args.list_type
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0fullpath =3D find_canned_image(scripts_path, input_file)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if not fullpath:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0raise WicError("No ima= ge named %s found, exiting. "
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 "(Use 'wic list images' to list avail= able images, "
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 "or specify a fully-qualified OE kickstart (.= wks) "
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 "filename)" % wks_file)
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0list_canned_image_help(scripts_path,= fullpath)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0fullpath =3D find_source_pl= ugin(scripts_path, input_file)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if not fullpath:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0raise WicErro= r("No image named %s found, exiting. "
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "(Use 'wic list images'= to list available images, "
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "or specify a fully-qualified O= E kickstart (.wks) "
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "filename)" % input_file)<= /div>
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0list_source_p= lugins_help(fullpath)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0else:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0list_canned_image_help(fullpath)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return True
=C2=A0
=C2=A0 =C2=A0 =C2=A0return False
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index 2ac45e0..8230395 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -30,1014 +30,166 @@ import logging
=C2=A0
=C2=A0from wic.pluginbase import PluginMgr, PLUGIN_TYPES
=C2=A0
-logger =3D logging.getLogger('wic')
-
-def subcommand_error(args):
- =C2=A0 =C2=A0logger= .info("invalid subcommand %s", args[0])
-
-
-def display_help(subcommand, subcommands):
- =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0Display help for subcommand.
- =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0if subcommand not in subcommands:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0return False
-
- =C2=A0 =C2=A0hlp =3D subcommands.get(subcommand, subcommand_error)[2= ]
- =C2=A0 =C2=A0if callable(hlp):
- =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp =3D hlp()
- =C2=A0 =C2=A0pager =3D subprocess.Popen('less', stdin=3Dsubp= rocess.PIPE)
- =C2=A0 =C2=A0pager.communicate(hlp.encode('utf-8'))
-
- =C2=A0 =C2=A0return True
-
-
-def wic_help(args, usage_str, subcommands):
- =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0Subcommand help dispatcher.
- =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0if args.help_topic =3D=3D None or not display_help(args= .help_topic, subcommands):
- =C2=A0 =C2=A0 =C2=A0 =C2=A0print(usage_str)
-
-
-def get_wic_plugins_help():
- =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0Combine wic_plugins_help with the help for every known<= /div>
- =C2=A0 =C2=A0source plugin.
- =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0result =3D wic_plugins_help
- =C2=A0 =C2=A0for plugin_type in PLUGIN_TYPES:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0result +=3D '\n\n%s PLUGINS\n\n' = % plugin_type.upper()
- =C2=A0 =C2=A0 =C2=A0 =C2=A0for name, plugin in PluginMgr.get_plugins= (plugin_type).items():
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0result +=3D "\n %s plu= gin:\n" % name
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if plugin.__doc__:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0result +=3D p= lugin.__doc__
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0result +=3D &= quot;\n =C2=A0 =C2=A0%s is missing docstring\n" % plugin
- =C2=A0 =C2=A0return result
-
-
-def invoke_subcommand(args, parser, main_command_usage, subcommands):=
- =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0Dispatch to subcommand handler borrowed from combo-laye= r.
- =C2=A0 =C2=A0Should use argparse, but has to work in 2.6.
- =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0if not args.command:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0logger.error("No subcommand specifie= d, exiting")
- =C2=A0 =C2=A0 =C2=A0 =C2=A0parser.print_help()
- =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1
- =C2=A0 =C2=A0elif args.command =3D=3D "help":
- =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_help(args, main_command_usage, subcom= mands)
- =C2=A0 =C2=A0elif args.command not in subcommands:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0logger.error("Unsupported subcommand= %s, exiting\n", args.command)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0parser.print_help()
- =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1
- =C2=A0 =C2=A0else:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0subcmd =3D subcommands.get(args.command, = subcommand_error)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0usage =3D subcmd[1]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0subcmd[0](args, usage)
-
-
-##
+# ##
=C2=A0# wic help and usage strings
=C2=A0##
=C2=A0
-wic_usage =3D """
-
- Create a customized OpenEmbedded image
-
- usage: wic [--version] | [--help] | [COMMAND [ARGS]]
-
- Current 'wic' commands are:
- =C2=A0 =C2=A0help =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Sh= ow help for command or one of the topics (see below)
- =C2=A0 =C2=A0create =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Create = a new OpenEmbedded image
- =C2=A0 =C2=A0list =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Li= st available canned images and source plugins
-
- Help topics:
- =C2=A0 =C2=A0overview =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic overview= - General overview of wic
- =C2=A0 =C2=A0plugins =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 wic plugins = - Overview and API
- =C2=A0 =C2=A0kickstart =C2=A0 =C2=A0 =C2=A0 =C2=A0 wic kickstart - w= ic kickstart reference
-"""
-
-wic_help_usage =3D """
-
- usage: wic help <subcommand>
-
- This command displays detailed help for the specified subcommand.
-"""
-
-wic_create_usage =3D """
-
- Create a new OpenEmbedded image
-
- usage: wic create <wks file or image name> [-o <DIRNAME>= | --outdir <DIRNAME>]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[-e | --image-name] [-s, --= skip-build-check] [-D, --debug]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[-r, --rootfs-dir] [-b, --b= ootimg-dir]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[-k, --kernel-dir] [-n, --n= ative-sysroot] [-f, --build-rootfs]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[-c, --compress-with] [-m, = --bmap]
-
- This command creates an OpenEmbedded image based on the 'OE kick= start
- commands' found in the <wks file>.
-
- The -o option can be used to place the image in a directory with a
- different name and location.
-
- See 'wic help create' for more detailed instructions.
-"""
-
-wic_create_help =3D """
-
-NAME
- =C2=A0 =C2=A0wic create - Create a new OpenEmbedded image
-
-SYNOPSIS
- =C2=A0 =C2=A0wic create <wks file or image name> [-o <DIRNA= ME> | --outdir <DIRNAME>]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0[-e | --image-name] [-s, --skip-build-che= ck] [-D, --debug]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0[-r, --rootfs-dir] [-b, --bootimg-dir]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0[-k, --kernel-dir] [-n, --native-sysroot]= [-f, --build-rootfs]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0[-c, --compress-with] [-m, --bmap] [--no-= fstab-update]
-
-DESCRIPTION
- =C2=A0 =C2=A0This command creates an OpenEmbedded image based on the= 'OE
- =C2=A0 =C2=A0kickstart commands' found in the <wks file>.<= /div>
-
- =C2=A0 =C2=A0In order to do this, wic needs to know the locations of= the
- =C2=A0 =C2=A0various build artifacts required to build the image.
-
- =C2=A0 =C2=A0Users can explicitly specify the build artifact locatio= ns using
- =C2=A0 =C2=A0the -r, -b, -k, and -n options.=C2=A0 See below for det= ails on where
- =C2=A0 =C2=A0the corresponding artifacts are typically found in a no= rmal
- =C2=A0 =C2=A0OpenEmbedded build.
-
- =C2=A0 =C2=A0Alternatively, users can use the -e option to have '= ;wic' determine
- =C2=A0 =C2=A0those locations for a given image.=C2=A0 If the -e opti= on is used, the
- =C2=A0 =C2=A0user needs to have set the appropriate MACHINE variable= in
- =C2=A0 =C2=A0local.conf, and have sourced the build environment.
-
- =C2=A0 =C2=A0The -e option is used to specify the name of the image = to use the
- =C2=A0 =C2=A0artifacts from e.g. core-image-sato.
-
- =C2=A0 =C2=A0The -r option is used to specify the path to the /rootf= s dir to
- =C2=A0 =C2=A0use as the .wks rootfs source.
-
- =C2=A0 =C2=A0The -b option is used to specify the path to the dir co= ntaining
- =C2=A0 =C2=A0the boot artifacts (e.g. /EFI or /syslinux dirs) to use= as the
- =C2=A0 =C2=A0.wks bootimg source.
-
- =C2=A0 =C2=A0The -k option is used to specify the path to the dir co= ntaining
- =C2=A0 =C2=A0the kernel to use in the .wks bootimg.
-
- =C2=A0 =C2=A0The -n option is used to specify the path to the native= sysroot
- =C2=A0 =C2=A0containing the tools to use to build the image.
-
- =C2=A0 =C2=A0The -f option is used to build rootfs by running "= bitbake <image>"
-
- =C2=A0 =C2=A0The -s option is used to skip the build check.=C2=A0 Th= e build check is
- =C2=A0 =C2=A0a simple sanity check used to determine whether the use= r has
- =C2=A0 =C2=A0sourced the build environment so that the -e option can= operate
- =C2=A0 =C2=A0correctly.=C2=A0 If the user has specified the build ar= tifact locations
- =C2=A0 =C2=A0explicitly, 'wic' assumes the user knows what h= e or she is doing
- =C2=A0 =C2=A0and skips the build check.
-
- =C2=A0 =C2=A0The -D option is used to display debug information deta= iling
- =C2=A0 =C2=A0exactly what happens behind the scenes when a create re= quest is
- =C2=A0 =C2=A0fulfilled (or not, as the case may be).=C2=A0 It enumer= ates and
- =C2=A0 =C2=A0displays the command sequence used, and should be inclu= ded in any
- =C2=A0 =C2=A0bug report describing unexpected results.
-
- =C2=A0 =C2=A0When 'wic -e' is used, the locations for the bu= ild artifacts
- =C2=A0 =C2=A0values are determined by 'wic -e' from the outp= ut of the 'bitbake
- =C2=A0 =C2=A0-e' command given an image name e.g. 'core-imag= e-minimal' and a
- =C2=A0 =C2=A0given machine set in local.conf.=C2=A0 In that case, th= e image is
- =C2=A0 =C2=A0created as if the following 'bitbake -e' variab= les were used:
-
- =C2=A0 =C2=A0-r: =C2=A0 =C2=A0 =C2=A0 =C2=A0IMAGE_ROOTFS
- =C2=A0 =C2=A0-k: =C2=A0 =C2=A0 =C2=A0 =C2=A0STAGING_KERNEL_DIR
- =C2=A0 =C2=A0-n: =C2=A0 =C2=A0 =C2=A0 =C2=A0STAGING_DIR_NATIVE
- =C2=A0 =C2=A0-b: =C2=A0 =C2=A0 =C2=A0 =C2=A0empty (plugin-specific h= andlers must determine this)
-
- =C2=A0 =C2=A0If 'wic -e' is not used, the user needs to sele= ct the appropriate
- =C2=A0 =C2=A0value for -b (as well as -r, -k, and -n).
-
- =C2=A0 =C2=A0The -o option can be used to place the image in a direc= tory with a
- =C2=A0 =C2=A0different name and location.
-
- =C2=A0 =C2=A0The -c option is used to specify compressor utility to = compress
- =C2=A0 =C2=A0an image. gzip, bzip2 and xz compressors are supported.=
-
- =C2=A0 =C2=A0The -m option is used to produce .bmap file for the ima= ge. This file
- =C2=A0 =C2=A0can be used to flash image using bmaptool utility.
-
- =C2=A0 =C2=A0The --no-fstab-update option is used to doesn't cha= nge fstab file. When
- =C2=A0 =C2=A0using this option the final fstab file will be same tha= t in rootfs and
- =C2=A0 =C2=A0wic doesn't update file, e.g adding a new mount poi= nt. User can control
- =C2=A0 =C2=A0the fstab file content in base-files recipe.
-"""
-
-wic_list_usage =3D """
-
- List available OpenEmbedded images and source plugins
-
- usage: wic list images
- =C2=A0 =C2=A0 =C2=A0 =C2=A0wic list <image> help
- =C2=A0 =C2=A0 =C2=A0 =C2=A0wic list source-plugins
-
- This command enumerates the set of available canned images as well a= s
- help for those images.=C2=A0 It also can be used to list of availabl= e source
- plugins.
-
- The first form enumerates all the available 'canned' images.=
-
- The second form lists the detailed help information for a specific
- 'canned' image.
-
- The third form enumerates all the available --sources (source
- plugins).
-
- See 'wic help list' for more details.
+wic_create_short_description =3D """
+Create a new OpenEmbedded image.
=C2=A0"""
=C2=A0
-wic_list_help =3D """
-
-NAME
- =C2=A0 =C2=A0wic list - List available OpenEmbedded images and sourc= e plugins
-
-SYNOPSIS
- =C2=A0 =C2=A0wic list images
- =C2=A0 =C2=A0wic list <image> help
- =C2=A0 =C2=A0wic list source-plugins
-
-DESCRIPTION
- =C2=A0 =C2=A0This command enumerates the set of available canned ima= ges as well
- =C2=A0 =C2=A0as help for those images.=C2=A0 It also can be used to = list available
- =C2=A0 =C2=A0source plugins.
-
- =C2=A0 =C2=A0The first form enumerates all the available 'canned= ' images.
- =C2=A0 =C2=A0These are actually just the set of .wks files that have= been moved
- =C2=A0 =C2=A0into the /scripts/lib/wic/canned-wks directory).
-
- =C2=A0 =C2=A0The second form lists the detailed help information for= a specific
- =C2=A0 =C2=A0'canned' image.
-
- =C2=A0 =C2=A0The third form enumerates all the available --sources (= source
- =C2=A0 =C2=A0plugins).=C2=A0 The contents of a given partition are d= riven by code
- =C2=A0 =C2=A0defined in 'source plugins'.=C2=A0 Users specif= y a specific plugin via
- =C2=A0 =C2=A0the --source parameter of the partition .wks command.= =C2=A0 Normally
- =C2=A0 =C2=A0this is the 'rootfs' plugin but can be any of t= he more specialized
- =C2=A0 =C2=A0sources listed by the 'list source-plugins' com= mand.=C2=A0 Users can
- =C2=A0 =C2=A0also add their own source plugins - see 'wic help p= lugins' for
- =C2=A0 =C2=A0details.
+wic_rm_short_description =3D """
+Remove files or directories from the vfat or ext* partitions.
=C2=A0"""
=C2=A0
-wic_ls_usage =3D """
-
- List content of a partitioned image
-
- usage: wic ls <image>[:<partition>[<path>]] [--nat= ive-sysroot <path>]
-
- This command =C2=A0outputs either list of image partitions or direct= ory contents
- of vfat and ext* partitions.
-
- See 'wic help ls' for more detailed instructions.
-
+wic_write_short_description =3D """
+Write an image to a device.
=C2=A0"""
=C2=A0
-wic_ls_help =3D """
-
-NAME
- =C2=A0 =C2=A0wic ls - List contents of partitioned image or partitio= n
-
-SYNOPSIS
- =C2=A0 =C2=A0wic ls <image>
- =C2=A0 =C2=A0wic ls <image>:<vfat or ext* partition>
- =C2=A0 =C2=A0wic ls <image>:<vfat or ext* partition><= path>
- =C2=A0 =C2=A0wic ls <image>:<vfat or ext* partition><= path> --native-sysroot <path>
-
-DESCRIPTION
- =C2=A0 =C2=A0This command lists either partitions of the image or di= rectory contents
- =C2=A0 =C2=A0of vfat or ext* partitions.
-
- =C2=A0 =C2=A0The first form it lists partitions of the image.
- =C2=A0 =C2=A0For example:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0$ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic
- =C2=A0 =C2=A0 =C2=A0 =C2=A0Num =C2=A0 =C2=A0 Start =C2=A0 =C2=A0 =C2= =A0 =C2=A0End =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Size =C2=A0 =C2=A0 =C2=A0Fs= type
- =C2=A0 =C2=A0 =C2=A0 =C2=A01 =C2=A0 =C2=A0 =C2=A0 =C2=A01048576 =C2= =A0 =C2=A0 24438783 =C2=A0 =C2=A0 23390208 =C2=A0fat16
- =C2=A0 =C2=A0 =C2=A0 =C2=A02 =C2=A0 =C2=A0 =C2=A0 25165824 =C2=A0 = =C2=A0 50315263 =C2=A0 =C2=A0 25149440 =C2=A0ext4
-
- =C2=A0 =C2=A0Second and third form list directory content of the par= tition:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0$ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1
- =C2=A0 =C2=A0 =C2=A0 =C2=A0Volume in drive : is boot
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 Volume Serial Number is 2DF2-5F02
- =C2=A0 =C2=A0 =C2=A0 =C2=A0Directory for ::/
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0efi =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<= ;DIR> =C2=A0 =C2=A0 2017-05-11 =C2=A010:54
- =C2=A0 =C2=A0 =C2=A0 =C2=A0startup =C2=A0nsh =C2=A0 =C2=A0 =C2=A0 = =C2=A026 2017-05-11 =C2=A010:54
- =C2=A0 =C2=A0 =C2=A0 =C2=A0vmlinuz =C2=A0 =C2=A0 =C2=A0 =C2=A0692228= 8 2017-05-11 =C2=A010:54
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A03 files =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 6 922 314 bytes
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 15 818 752 bytes free
-
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0$ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1/EFI/boot/
- =C2=A0 =C2=A0 =C2=A0 =C2=A0Volume in drive : is boot
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 Volume Serial Number is 2DF2-5F02
- =C2=A0 =C2=A0 =C2=A0 =C2=A0Directory for ::/EFI/boot
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0. =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0<DIR> =C2=A0 =C2=A0 2017-05-11 =C2=A010:54
- =C2=A0 =C2=A0 =C2=A0 =C2=A0.. =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <= ;DIR> =C2=A0 =C2=A0 2017-05-11 =C2=A010:54
- =C2=A0 =C2=A0 =C2=A0 =C2=A0grub =C2=A0 =C2=A0 cfg =C2=A0 =C2=A0 =C2= =A0 679 2017-05-11 =C2=A010:54
- =C2=A0 =C2=A0 =C2=A0 =C2=A0bootx64 =C2=A0efi =C2=A0 =C2=A0571392 201= 7-05-11 =C2=A010:54
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A04 files =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 572 071 bytes
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 15 818 752 bytes free
-
- =C2=A0 =C2=A0The -n option is used to specify the path to the native= sysroot
- =C2=A0 =C2=A0containing the tools(parted and mtools) to use.
-
-"""
-
-wic_cp_usage =3D """
-
- Copy files and directories to the vfat or ext* partition
-
- usage: wic cp <src> <image>:<partition>[<path&g= t;] [--native-sysroot <path>]
-
- This command =C2=A0copies local files or directories to the vfat or = ext* partitions
-of partitioned =C2=A0image.
-
- See 'wic help cp' for more detailed instructions.
-
+wic_cp_short_description =3D """
+Copy files and directories to the vfat or ext* partitions.
=C2=A0"""
=C2=A0
-wic_cp_help =3D """
-
-NAME
- =C2=A0 =C2=A0wic cp - copy files and directories to the vfat or ext*= partitions
-
-SYNOPSIS
- =C2=A0 =C2=A0wic cp <src> <image>:<partition>
- =C2=A0 =C2=A0wic cp <src> <image>:<partition><p= ath>
- =C2=A0 =C2=A0wic cp <src> <image>:<partition><p= ath> --native-sysroot <path>
-
-DESCRIPTION
- =C2=A0 =C2=A0This command copies files and directories to the vfat o= r ext* partition of
- =C2=A0 =C2=A0the partitioned image.
-
- =C2=A0 =C2=A0The first form of it copies file or directory to the ro= ot directory of
- =C2=A0 =C2=A0the partition:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0$ wic cp test.wks tmp/deploy/images/qemux= 86-64/core-image-minimal-qemux86-64.wic:1
- =C2=A0 =C2=A0 =C2=A0 =C2=A0$ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1
- =C2=A0 =C2=A0 =C2=A0 =C2=A0Volume in drive : is boot
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 Volume Serial Number is DB4C-FD4C
- =C2=A0 =C2=A0 =C2=A0 =C2=A0Directory for ::/
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0efi =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<= ;DIR> =C2=A0 =C2=A0 2017-05-24 =C2=A018:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0loader =C2=A0 =C2=A0 =C2=A0 <DIR> = =C2=A0 =C2=A0 2017-05-24 =C2=A018:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0startup =C2=A0nsh =C2=A0 =C2=A0 =C2=A0 = =C2=A026 2017-05-24 =C2=A018:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0vmlinuz =C2=A0 =C2=A0 =C2=A0 =C2=A0692638= 4 2017-05-24 =C2=A018:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0test =C2=A0 =C2=A0 wks =C2=A0 =C2=A0 =C2= =A0 628 2017-05-24 =C2=A021:22
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A05 files =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 6 927 038 bytes
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 15 677 440 bytes free
-
- =C2=A0 =C2=A0The second form of the command copies file or directory= to the specified directory
- =C2=A0 =C2=A0on the partition:
- =C2=A0 =C2=A0 =C2=A0 $ wic cp test tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1/efi/
- =C2=A0 =C2=A0 =C2=A0 $ wic ls tmp/deploy/images/qemux86-64/core= -image-minimal-qemux86-64.wic:1/efi/
- =C2=A0 =C2=A0 =C2=A0 Volume in drive : is boot
- =C2=A0 =C2=A0 =C2=A0 =C2=A0Volume Serial Number is DB4C-FD4C
- =C2=A0 =C2=A0 =C2=A0 Directory for ::/efi
-
- =C2=A0 =C2=A0 =C2=A0 . =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<= DIR> =C2=A0 =C2=A0 2017-05-24 =C2=A018:15
- =C2=A0 =C2=A0 =C2=A0 .. =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <DIR&g= t; =C2=A0 =C2=A0 2017-05-24 =C2=A018:15
- =C2=A0 =C2=A0 =C2=A0 boot =C2=A0 =C2=A0 =C2=A0 =C2=A0 <DIR> = =C2=A0 =C2=A0 2017-05-24 =C2=A018:15
- =C2=A0 =C2=A0 =C2=A0 test =C2=A0 =C2=A0 =C2=A0 =C2=A0 <DIR> = =C2=A0 =C2=A0 2017-05-24 =C2=A021:27
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 4 files =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0 bytes
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A015 675 392 bytes free
-
- =C2=A0 =C2=A0The -n option is used to specify the path to the native= sysroot
- =C2=A0 =C2=A0containing the tools(parted and mtools) to use.
+wic_ls_short_description =3D """
+Lists either partitions of the image or directory contents
+of vfat or ext* partitions."""
+wic_help_short_description =3D """
+sss
=C2=A0"""
-
-wic_rm_usage =3D """
-
- Remove files or directories from the vfat or ext* partitions
-
- usage: wic rm <image>:<partition><path> [--native-= sysroot <path>]
-
- This command =C2=A0removes files or directories from the vfat or ext= * partitions of
- the partitioned image.
-
- See 'wic help rm' for more detailed instructions.
-
+wic_list_short_description =3D """
+List available canned images and source plugins
=C2=A0"""
=C2=A0
-wic_rm_help =3D """
+wic_create_description =3D """
+This command creates an OpenEmbedded image based on the 'OE
+kickstart commands' found in the <wks file>.
=C2=A0
-NAME
- =C2=A0 =C2=A0wic rm - remove files or directories from the vfat or e= xt* partitions
+In order to do this, wic needs to know the locations of the
+various build artifacts required to build the image.
=C2=A0
-SYNOPSIS
- =C2=A0 =C2=A0wic rm <src> <image>:<partition><p= ath>
- =C2=A0 =C2=A0wic rm <src> <image>:<partition><p= ath> --native-sysroot <path>
+Users can explicitly specify the build artifact locations using
+the -r, -b, -k, and -n options.=C2=A0 See below for details on where<= /div>
+the corresponding artifacts are typically found in a normal
+OpenEmbedded build.
=C2=A0
-DESCRIPTION
- =C2=A0 =C2=A0This command removes files or directories from the vfat= or ext* partition of the
- =C2=A0 =C2=A0partitioned image:
+Alternatively, users can use the -e option to have 'wic' dete= rmine
+those locations for a given image.=C2=A0 If the -e option is used, th= e
+user needs to have set the appropriate MACHINE variable in
+local.conf, and have sourced the build environment.
=C2=A0
- =C2=A0 =C2=A0 =C2=A0 =C2=A0$ wic ls ./tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1
- =C2=A0 =C2=A0 =C2=A0 =C2=A0Volume in drive : is boot
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 Volume Serial Number is 11D0-DE21
- =C2=A0 =C2=A0 =C2=A0 =C2=A0Directory for ::/
+The -s option is used to skip the build check.=C2=A0 The build check = is
+a simple sanity check used to determine whether the user has
+sourced the build environment so that the -e option can operate
+correctly.=C2=A0 If the user has specified the build artifact locatio= ns
+explicitly, 'wic' assumes the user knows what he or she is do= ing
+and skips the build check.
=C2=A0
- =C2=A0 =C2=A0 =C2=A0 =C2=A0libcom32 c32 =C2=A0 =C2=A0186500 2017-06-= 02 =C2=A015:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0libutil =C2=A0c32 =C2=A0 =C2=A0 24148 201= 7-06-02 =C2=A015:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0syslinux cfg =C2=A0 =C2=A0 =C2=A0 209 201= 7-06-02 =C2=A015:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0vesamenu c32 =C2=A0 =C2=A0 27104 2017-06-= 02 =C2=A015:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0vmlinuz =C2=A0 =C2=A0 =C2=A0 =C2=A0692638= 4 2017-06-02 =C2=A015:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A05 files =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 7 164 345 bytes
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 16 582 656 bytes free
+When 'wic -e' is used, the locations for the build artifacts<= /div>
+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.=C2=A0 In that case, the image is
+created as if the following 'bitbake -e' variables were used:=
=C2=A0
- =C2=A0 =C2=A0 =C2=A0 =C2=A0$ wic rm ./tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1/libutil.c32
+-r: =C2=A0 =C2=A0 =C2=A0 =C2=A0IMAGE_ROOTFS
+-k: =C2=A0 =C2=A0 =C2=A0 =C2=A0STAGING_KERNEL_DIR
+-n: =C2=A0 =C2=A0 =C2=A0 =C2=A0STAGING_DIR_NATIVE
+-b: =C2=A0 =C2=A0 =C2=A0 =C2=A0empty (plugin-specific handlers must d= etermine this)
=C2=A0
- =C2=A0 =C2=A0 =C2=A0 =C2=A0$ wic ls ./tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1
- =C2=A0 =C2=A0 =C2=A0 =C2=A0Volume in drive : is boot
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 Volume Serial Number is 11D0-DE21
- =C2=A0 =C2=A0 =C2=A0 =C2=A0Directory for ::/
+If 'wic -e' is not used, the user needs to select the appropr= iate
+value for -b (as well as -r, -k, and -n).
=C2=A0
- =C2=A0 =C2=A0 =C2=A0 =C2=A0libcom32 c32 =C2=A0 =C2=A0186500 2017-06-= 02 =C2=A015:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0syslinux cfg =C2=A0 =C2=A0 =C2=A0 209 201= 7-06-02 =C2=A015:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0vesamenu c32 =C2=A0 =C2=A0 27104 2017-06-= 02 =C2=A015:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0vmlinuz =C2=A0 =C2=A0 =C2=A0 =C2=A0692638= 4 2017-06-02 =C2=A015:15
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A04 files =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 7 140 197 bytes
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 16 607 232 bytes free
+Here's an example that doesn't take the easy way out and manu= ally
+specifies each build artifact, along with a non-canned .wks file,
+and also uses the -o option to have wic create the output
+somewhere other than the default /var/tmp/wic:
=C2=A0
- =C2=A0 =C2=A0The -n option is used to specify the path to the native= sysroot
- =C2=A0 =C2=A0containing the tools(parted and mtools) to use.
+ =C2=A0$ wic create ./test.wks -o ./out --rootfs-dir
+ =C2=A0tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs
+ =C2=A0--bootimg-dir tmp/sysroots/qemux86-64/usr/share
+ =C2=A0--kernel-dir tmp/deploy/images/qemux86-64
+ =C2=A0--native-sysroot tmp/sysroots/x86_64-linux
=C2=A0"""
=C2=A0
-wic_write_usage =3D """
=C2=A0
- Write image to a device
+wic_list_description =3D """
+This command enumerates the set of available canned images as well
+as help for those images.=C2=A0 It also can be used to list available=
+source plugins.
=C2=A0
- usage: wic write <image> <target device> [--expand [rule= s]] [--native-sysroot <path>]
+The first form enumerates all the available 'canned' images.<= /div>
+These are actually just the set of .wks files that have been moved
+into the /scripts/lib/wic/canned-wks directory).
=C2=A0
- This command writes partitioned image to a target device (USB stick,= SD card etc).
-
- See 'wic help write' for more detailed instructions.
+The second form lists the detailed help information for a specific
+'canned' image.
=C2=A0
+The third form enumerates all the available --sources (source
+plugins).=C2=A0 The contents of a given partition are driven by code<= /div>
+defined in 'source plugins'.=C2=A0 Users specify a specific p= lugin via
+the --source parameter of the partition .wks command.=C2=A0 Normally<= /div>
+this is the 'rootfs' plugin but can be any of the more specia= lized
+sources listed by the 'list source-plugins' command.=C2=A0 Us= ers can
+also add their own source plugins - see 'wic help plugins' fo= r
+details.
=C2=A0"""
=C2=A0
-wic_write_help =3D """
=C2=A0
-NAME
- =C2=A0 =C2=A0wic write - write an image to a device
+wic_ls_description =3D """
+This command lists either partitions of the image or directory conten= ts
+of vfat or ext* partitions.
=C2=A0
-SYNOPSIS
- =C2=A0 =C2=A0wic write <image> <target>
- =C2=A0 =C2=A0wic write <image> <target> --expand auto
- =C2=A0 =C2=A0wic write <image> <target> --expand 1:100M-= 2:300M
- =C2=A0 =C2=A0wic write <image> <target> --native-sysroot= <path>
+The first form lists partitions of the image.
+For example:
+ =C2=A0 =C2=A0$ wic ls tmp/deploy/images/qemux86-64/core-image-m= inimal-qemux86-64.wic
+ =C2=A0 =C2=A0Num =C2=A0 =C2=A0 Start =C2=A0 =C2=A0 =C2=A0 =C2=A0End = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Size =C2=A0 =C2=A0 =C2=A0Fstype
+ =C2=A0 =C2=A01 =C2=A0 =C2=A0 =C2=A0 =C2=A01048576 =C2=A0 =C2=A0 2443= 8783 =C2=A0 =C2=A0 23390208 =C2=A0fat16
+ =C2=A0 =C2=A02 =C2=A0 =C2=A0 =C2=A0 25165824 =C2=A0 =C2=A0 50315263 = =C2=A0 =C2=A0 25149440 =C2=A0ext4
=C2=A0
-DESCRIPTION
- =C2=A0 =C2=A0This command writes an image to a target device (USB st= ick, SD card etc)
+The second form lists directory contents of the first partition:
=C2=A0
- =C2=A0 =C2=A0 =C2=A0 =C2=A0$ wic write ./tmp/deploy/images/qemux86-<= wbr>64/core-image-minimal-qemux86-64.wic /dev/sdb
+ =C2=A0 =C2=A0$ wic ls tmp/deploy/images/qemux86-64/core-image-m= inimal-qemux86-64.wic:1/EFI/boot/
+ =C2=A0 =C2=A0Volume in drive : is boot
+ =C2=A0 =C2=A0 Volume Serial Number is 2DF2-5F02
+ =C2=A0 =C2=A0Directory for ::/EFI/boot
=C2=A0
- =C2=A0 =C2=A0The --expand option is used to resize image partitions.=
- =C2=A0 =C2=A0--expand auto expands partitions to occupy all free spa= ce available on the target device.
- =C2=A0 =C2=A0It's also possible to specify expansion rules in a = format
- =C2=A0 =C2=A0<partition>:<size>[-<partition>:= <size>...] for one or more partitions.
- =C2=A0 =C2=A0Specifying size 0 will keep partition unmodified.
- =C2=A0 =C2=A0Note: Resizing boot partition can result in non-bootabl= e image for non-EFI images. It is
- =C2=A0 =C2=A0recommended to use size 0 for boot partition to keep im= age bootable.
+ =C2=A0 =C2=A0. =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<DIR> = =C2=A0 =C2=A0 2017-05-11 =C2=A010:54
+ =C2=A0 =C2=A0.. =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <DIR> =C2= =A0 =C2=A0 2017-05-11 =C2=A010:54
+ =C2=A0 =C2=A0grub =C2=A0 =C2=A0 cfg =C2=A0 =C2=A0 =C2=A0 679 2017-05= -11 =C2=A010:54
+ =C2=A0 =C2=A0bootx64 =C2=A0efi =C2=A0 =C2=A0571392 2017-05-11 =C2=A0= 10:54
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A04 files =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 572 071 bytes
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 15 818 752 bytes free
=C2=A0
- =C2=A0 =C2=A0The --native-sysroot option is used to specify the path= to the native sysroot
- =C2=A0 =C2=A0containing the tools(parted, resize2fs) to use.
=C2=A0"""
=C2=A0
-wic_plugins_help =3D """
-
-NAME
- =C2=A0 =C2=A0wic plugins - Overview and API
-
-DESCRIPTION
- =C2=A0 =C2=A0plugins allow wic functionality to be extended and spec= ialized by
- =C2=A0 =C2=A0users.=C2=A0 This section documents the plugin interfac= e, which is
- =C2=A0 =C2=A0currently restricted to 'source' plugins.
-
- =C2=A0 =C2=A0'Source' plugins provide a mechanism to customi= ze various aspects
- =C2=A0 =C2=A0of the image generation process in wic, mainly the cont= ents of
- =C2=A0 =C2=A0partitions.
-
- =C2=A0 =C2=A0Source plugins provide a mechanism for mapping values s= pecified in
- =C2=A0 =C2=A0.wks files using the --source keyword to a particular p= lugin
- =C2=A0 =C2=A0implementation that populates a corresponding partition= .
-
- =C2=A0 =C2=A0A source plugin is created as a subclass of SourcePlugi= n (see
- =C2=A0 =C2=A0scripts/lib/wic/pluginbase.py) and the plugin file= containing it
- =C2=A0 =C2=A0is added to scripts/lib/wic/plugins/source/ to mak= e the plugin
- =C2=A0 =C2=A0implementation available to the wic implementation.
-
- =C2=A0 =C2=A0Source plugins can also be implemented and added by ext= ernal
- =C2=A0 =C2=A0layers - any plugins found in a scripts/lib/wic/plugins= /source/
- =C2=A0 =C2=A0directory in an external layer will also be made availa= ble.
-
- =C2=A0 =C2=A0When the wic implementation needs to invoke a partition= -specific
- =C2=A0 =C2=A0implementation, it looks for the plugin that has the sa= me name as
- =C2=A0 =C2=A0the --source param given to that partition.=C2=A0 For e= xample, if the
- =C2=A0 =C2=A0partition is set up like this:
-
- =C2=A0 =C2=A0 =C2=A0part /boot --source bootimg-pcbios =C2=A0 ...
-
- =C2=A0 =C2=A0then the methods defined as class members of the plugin= having the
- =C2=A0 =C2=A0matching bootimg-pcbios .name class member would be use= d.
-
- =C2=A0 =C2=A0To be more concrete, here's the plugin definition t= hat would match
- =C2=A0 =C2=A0a '--source bootimg-pcbios' usage, along with a= n example method
- =C2=A0 =C2=A0that would be called by the wic implementation when it = needed to
- =C2=A0 =C2=A0invoke an implementation-specific partition-preparation= function:
-
- =C2=A0 =C2=A0class BootimgPcbiosPlugin(SourcePlugin):
- =C2=A0 =C2=A0 =C2=A0 =C2=A0name =3D 'bootimg-pcbios'
+wic_cp_description =3D """
+This command copies files and directories to the vfat or ext* partiti= on of
+the partitioned image.
=C2=A0
- =C2=A0 =C2=A0@classmethod
- =C2=A0 =C2=A0 =C2=A0 =C2=A0def do_prepare_partition(self, part, ...)=
-
- =C2=A0 =C2=A0If the subclass itself doesn't implement a function= , a 'default'
- =C2=A0 =C2=A0version in a superclass will be located and used, which= is why all
- =C2=A0 =C2=A0plugins must be derived from SourcePlugin.
-
- =C2=A0 =C2=A0The SourcePlugin class defines the following methods, w= hich is the
- =C2=A0 =C2=A0current set of methods that can be implemented/overridd= en by
- =C2=A0 =C2=A0--source plugins.=C2=A0 Any methods not implemented by = a SourcePlugin
- =C2=A0 =C2=A0subclass inherit the implementations present in the Sou= rcePlugin
- =C2=A0 =C2=A0class (see the SourcePlugin source for details):
-
- =C2=A0 =C2=A0 =C2=A0do_prepare_partition()
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Called to do the actual content po= pulation for a
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0partition. In other words, it '= ;prepares' the final partition
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0image which will be incorporated i= nto the disk image.
-
- =C2=A0 =C2=A0 =C2=A0do_configure_partition()
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Called before do_prepare_partition= (), typically used to
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0create custom configuration files = for a partition, for
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0example syslinux or grub config fi= les.
-
- =C2=A0 =C2=A0 =C2=A0do_install_disk()
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Called after all partitions have b= een prepared and assembled
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0into a disk image.=C2=A0 This prov= ides a hook to allow
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0finalization of a disk image, for = example to write an MBR to
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0it.
-
- =C2=A0 =C2=A0 =C2=A0do_stage_partition()
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Special content-staging hook calle= d before
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0do_prepare_partition(), normally e= mpty.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Typically, a partition will just u= se the passed-in
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0parameters, for example the unmodi= fied value of bootimg_dir.
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0In some cases however, things may = need to be more tailored.
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0As an example, certain files may a= dditionally need to be
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0take from bootimg_dir + /boot.=C2= =A0 This hook allows those files
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0to be staged in a customized fashi= on.=C2=A0 Note that
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0get_bitbake_var() allows you to ac= cess non-standard
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0variables that you might want to u= se for these types of
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0situations.
-
- =C2=A0 =C2=A0This scheme is extensible - adding more hooks is a simp= le matter
- =C2=A0 =C2=A0of adding more plugin methods to SourcePlugin and deriv= ed classes.
- =C2=A0 =C2=A0Please see the implementation for details.
+Copies file or directory to the specified directory
+on the partition:
+ =C2=A0 $ wic cp test tmp/deploy/images/qemux86-64/core-image-mi= nimal-qemux86-64.wic:1/efi/
=C2=A0"""
=C2=A0
-wic_overview_help =3D """
-
-NAME
- =C2=A0 =C2=A0wic overview - General overview of wic
-
-DESCRIPTION
- =C2=A0 =C2=A0The 'wic' command generates partitioned images = from existing
- =C2=A0 =C2=A0OpenEmbedded build artifacts.=C2=A0 Image generation is= driven by
- =C2=A0 =C2=A0partitioning commands contained in an 'Openembedded= kickstart'
- =C2=A0 =C2=A0(.wks) file (see 'wic help kickstart') specifie= d either directly
- =C2=A0 =C2=A0on the command-line or as one of a selection of canned = .wks files
- =C2=A0 =C2=A0(see 'wic list images').=C2=A0 When applied to = a given set of build
- =C2=A0 =C2=A0artifacts, the result is an image or set of images that= can be
- =C2=A0 =C2=A0directly written onto media and used on a particular sy= stem.
-
- =C2=A0 =C2=A0The 'wic' command and the infrastructure it'= ;s based on is by
- =C2=A0 =C2=A0definition incomplete - its purpose is to allow the gen= eration of
- =C2=A0 =C2=A0customized images, and as such was designed to be compl= etely
- =C2=A0 =C2=A0extensible via a plugin interface (see 'wic help pl= ugins').
-
- =C2=A0Background and Motivation
-
- =C2=A0 =C2=A0wic is meant to be a completely independent standalone = utility
- =C2=A0 =C2=A0that initially provides easier-to-use and more flexible=
- =C2=A0 =C2=A0replacements for a couple bits of existing functionalit= y in
- =C2=A0 =C2=A0oe-core: directdisk.bbclass and mkefidisk.sh.=C2=A0 The= difference
- =C2=A0 =C2=A0between wic and those examples is that with wic the fun= ctionality
- =C2=A0 =C2=A0of those scripts is implemented by a general-purpose pa= rtitioning
- =C2=A0 =C2=A0'language' based on Redhat kickstart syntax).
-
- =C2=A0 =C2=A0The initial motivation and design considerations that l= ead to the
- =C2=A0 =C2=A0current tool are described exhaustively in Yocto Bug #3= 847
-
- =C2=A0Implementation and Examples
-
- =C2=A0 =C2=A0wic can be used in two different modes, depending on ho= w much
- =C2=A0 =C2=A0control the user needs in specifying the Openembedded b= uild
- =C2=A0 =C2=A0artifacts that will be used in creating the image: '= ;raw' and
- =C2=A0 =C2=A0'cooked'.
-
- =C2=A0 =C2=A0If used in 'raw' mode, artifacts are explicitly= specified via
- =C2=A0 =C2=A0command-line arguments (see example below).
-
- =C2=A0 =C2=A0The more easily usable 'cooked' mode uses the c= urrent MACHINE
- =C2=A0 =C2=A0setting and a specified image name to automatically loc= ate the
- =C2=A0 =C2=A0artifacts used to create the image.
-
- =C2=A0 =C2=A0OE kickstart files (.wks) can of course be specified di= rectly on
- =C2=A0 =C2=A0the command-line, but the user can also choose from a s= et of
- =C2=A0 =C2=A0'canned' .wks files available via the 'wic = list images' command
- =C2=A0 =C2=A0(example below).
-
- =C2=A0 =C2=A0In any case, the prerequisite for generating any image = is to have
- =C2=A0 =C2=A0the build artifacts already available.=C2=A0 The below = examples assume
- =C2=A0 =C2=A0the user has already build a 'core-image-minimal= 9; for a specific
- =C2=A0 =C2=A0machine (future versions won't require this redunda= nt step, but
- =C2=A0 =C2=A0for now that's typically how build artifacts get ge= nerated).
-
- =C2=A0 =C2=A0The other prerequisite is to source the build environme= nt:
-
- =C2=A0 =C2=A0 =C2=A0$ source oe-init-build-env
-
- =C2=A0 =C2=A0To start out with, we'll generate an image from one= of the canned
- =C2=A0 =C2=A0.wks files.=C2=A0 The following generates a list of ava= ilailable
- =C2=A0 =C2=A0images:
-
- =C2=A0 =C2=A0 =C2=A0$ wic list images
- =C2=A0 =C2=A0 =C2=A0 =C2=A0mkefidisk =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 Create an EFI disk image
- =C2=A0 =C2=A0 =C2=A0 =C2=A0directdisk =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0Create a 'pcbios' direct disk image
-
- =C2=A0 =C2=A0You can get more information about any of the available= images by
- =C2=A0 =C2=A0typing 'wic list xxx help', where 'xxx'= is one of the image names:
-
- =C2=A0 =C2=A0 =C2=A0$ wic list mkefidisk help
-
- =C2=A0 =C2=A0Creates a partitioned EFI disk image that the user can = directly dd
- =C2=A0 =C2=A0to boot media.
-
- =C2=A0 =C2=A0At any time, you can get help on the 'wic' comm= and or any
- =C2=A0 =C2=A0subcommand (currently 'list' and 'create= 9;).=C2=A0 For instance, to get
- =C2=A0 =C2=A0the description of 'wic create' command and its= parameters:
-
- =C2=A0 =C2=A0 =C2=A0$ wic create
-
- =C2=A0 =C2=A0 =C2=A0 Usage:
-
- =C2=A0 =C2=A0 =C2=A0 Create a new OpenEmbedded image
-
- =C2=A0 =C2=A0 =C2=A0 usage: wic create <wks file or image name>= ; [-o <DIRNAME> | ...]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[-i <JSON PROPERTY FILE&= gt; | --infile <JSON PROPERTY_FILE>]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[-e | --image-name] [-s, --= skip-build-check] [-D, --debug]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[-r, --rootfs-dir] [-b, --b= ootimg-dir] [-k, --kernel-dir]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[-n, --native-sysroot] [-f,= --build-rootfs]
-
- =C2=A0 =C2=A0 =C2=A0 This command creates an OpenEmbedded image base= d on the 'OE
- =C2=A0 =C2=A0 =C2=A0 kickstart commands' found in the <wks fi= le>.
-
- =C2=A0 =C2=A0 =C2=A0 The -o option can be used to place the image in= a directory
- =C2=A0 =C2=A0 =C2=A0 with a different name and location.
-
- =C2=A0 =C2=A0 =C2=A0 See 'wic help create' for more detailed= instructions.
- =C2=A0 =C2=A0 =C2=A0 ...
-
- =C2=A0 =C2=A0As mentioned in the command, you can get even more deta= iled
- =C2=A0 =C2=A0information by adding 'help' to the above:
-
- =C2=A0 =C2=A0 =C2=A0$ wic help create
-
- =C2=A0 =C2=A0So, the easiest way to create an image is to use the -e= option
- =C2=A0 =C2=A0with a canned .wks file.=C2=A0 To use the -e option, yo= u need to
- =C2=A0 =C2=A0specify the image used to generate the artifacts and yo= u actually
- =C2=A0 =C2=A0need to have the MACHINE used to build them specified i= n your
- =C2=A0 =C2=A0local.conf (these requirements aren't necessary if = you aren't
- =C2=A0 =C2=A0using the -e options.) =C2=A0Below, we generate a direc= tdisk image,
- =C2=A0 =C2=A0pointing the process at the core-image-minimal artifact= s for the
- =C2=A0 =C2=A0current MACHINE:
-
- =C2=A0 =C2=A0 =C2=A0$ wic create directdisk -e core-image-minimal
-
- =C2=A0 =C2=A0 =C2=A0Checking basic build environment...
- =C2=A0 =C2=A0 =C2=A0Done.
-
- =C2=A0 =C2=A0 =C2=A0Creating image(s)...
-
- =C2=A0 =C2=A0 =C2=A0Info: The new image(s) can be found here:
- =C2=A0 =C2=A0 =C2=A0/var/tmp/wic/build/directdisk-201309252350-= sda.direct
-
- =C2=A0 =C2=A0 =C2=A0The following build artifacts were used to creat= e the image(s):
-
- =C2=A0 =C2=A0 =C2=A0ROOTFS_DIR: =C2=A0 =C2=A0 =C2=A0...
- =C2=A0 =C2=A0 =C2=A0BOOTIMG_DIR: =C2=A0 =C2=A0 ...
- =C2=A0 =C2=A0 =C2=A0KERNEL_DIR: =C2=A0 =C2=A0 =C2=A0...
- =C2=A0 =C2=A0 =C2=A0NATIVE_SYSROOT: =C2=A0...
-
- =C2=A0 =C2=A0 =C2=A0The image(s) were created using OE kickstart fil= e:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0.../scripts/lib/wic/canned-wks/direc= tdisk.wks
-
- =C2=A0 =C2=A0The output shows the name and location of the image cre= ated, and
- =C2=A0 =C2=A0so that you know exactly what was used to generate the = image, each
- =C2=A0 =C2=A0of the artifacts and the kickstart file used.
-
- =C2=A0 =C2=A0Similarly, you can create a 'mkefidisk' image i= n the same way
- =C2=A0 =C2=A0(notice that this example uses a different machine - be= cause it's
- =C2=A0 =C2=A0using the -e option, you need to change the MACHINE in = your
- =C2=A0 =C2=A0local.conf):
-
- =C2=A0 =C2=A0 =C2=A0$ wic create mkefidisk -e core-image-minimal
- =C2=A0 =C2=A0 =C2=A0Checking basic build environment...
- =C2=A0 =C2=A0 =C2=A0Done.
-
- =C2=A0 =C2=A0 =C2=A0Creating image(s)...
-
- =C2=A0 =C2=A0 =C2=A0Info: The new image(s) can be found here:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 /var/tmp/wic/build/mkefidisk-201309= 260027-sda.direct
-
- =C2=A0 =C2=A0 =C2=A0...
-
- =C2=A0 =C2=A0Here's an example that doesn't take the easy wa= y out and manually
- =C2=A0 =C2=A0specifies each build artifact, along with a non-canned = .wks file,
- =C2=A0 =C2=A0and also uses the -o option to have wic create the outp= ut
- =C2=A0 =C2=A0somewhere other than the default /var/tmp/wic:
-
- =C2=A0 =C2=A0 =C2=A0$ wic create ./test.wks -o ./out --rootfs-dir
- =C2=A0 =C2=A0 =C2=A0tmp/work/qemux86_64-poky-linux/core-image-m= inimal/1.0-r0/rootfs
- =C2=A0 =C2=A0 =C2=A0--bootimg-dir tmp/sysroots/qemux86-64/usr/s= hare
- =C2=A0 =C2=A0 =C2=A0--kernel-dir tmp/deploy/images/qemux86-64
- =C2=A0 =C2=A0 =C2=A0--native-sysroot tmp/sysroots/x86_64-linux
-
- =C2=A0 =C2=A0 Creating image(s)...
-
- =C2=A0 =C2=A0 Info: The new image(s) can be found here:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 out/build/test-201507211313-= sda.direct
-
- =C2=A0 =C2=A0 The following build artifacts were used to create the = image(s):
- =C2=A0 =C2=A0 =C2=A0 ROOTFS_DIR: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 tmp/work/qemux86_64-poky-linux/core-image-= minimal/1.0-r0/rootfs
- =C2=A0 =C2=A0 =C2=A0 BOOTIMG_DIR: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0tmp/sysroots/qemux86-64/usr/share
- =C2=A0 =C2=A0 =C2=A0 KERNEL_DIR: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 tmp/deploy/images/qemux86-64
- =C2=A0 =C2=A0 =C2=A0 NATIVE_SYSROOT: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 tmp/sysroots/x86_64-linux
-
- =C2=A0 =C2=A0 The image(s) were created using OE kickstart file:
- =C2=A0 =C2=A0 ./test.wks
-
- =C2=A0 =C2=A0 Here is a content of test.wks:
=C2=A0
- =C2=A0 =C2=A0 part /boot --source bootimg-pcbios --ondisk sda --labe= l boot --active --align 1024
- =C2=A0 =C2=A0 part / --source rootfs --ondisk sda --fstype=3Dext3 --= label platform --align 1024
+wic_rm_description =3D """
+This command removes files or directories from the vfat or ext* parti= tion of the
+partitioned image: wic rm <wic image>:<partition><path= >=C2=A0
=C2=A0
- =C2=A0 =C2=A0 bootloader =C2=A0--timeout=3D0 =C2=A0--append=3D"= rootwait rootfstype=3Dext3 video=3Dvesafb vga=3D0x318 console=3Dtty0"<= /div>
+$wic rm ./tmp/deploy/images/qemux86-64/core-image-minimal-qemux8= 6-64.wic:1/libutil.c32=C2=A0
=C2=A0
-
- =C2=A0 =C2=A0Finally, here's an example of the actual partition = language
- =C2=A0 =C2=A0commands used to generate the mkefidisk image i.e. thes= e are the
- =C2=A0 =C2=A0contents of the mkefidisk.wks OE kickstart file:
-
- =C2=A0 =C2=A0 =C2=A0# short-description: Create an EFI disk image
- =C2=A0 =C2=A0 =C2=A0# long-description: Creates a partitioned EFI di= sk image that the user
- =C2=A0 =C2=A0 =C2=A0# can directly dd to boot media.
-
- =C2=A0 =C2=A0 =C2=A0part /boot --source bootimg-efi --ondisk sda --f= stype=3Defi --active
-
- =C2=A0 =C2=A0 =C2=A0part / --source rootfs --ondisk sda --fstype=3De= xt3 --label platform
-
- =C2=A0 =C2=A0 =C2=A0part swap --ondisk sda --size 44 --label swap1 -= -fstype=3Dswap
-
- =C2=A0 =C2=A0 =C2=A0bootloader =C2=A0--timeout=3D10 =C2=A0--append= =3D"rootwait console=3DttyPCH0,115200"
-
- =C2=A0 =C2=A0You can get a complete listing and description of all t= he
- =C2=A0 =C2=A0kickstart commands available for use in .wks files from= 'wic help
- =C2=A0 =C2=A0kickstart'.
=C2=A0"""
=C2=A0
-wic_kickstart_help =3D """
-
-NAME
- =C2=A0 =C2=A0wic kickstart - wic kickstart reference
-
-DESCRIPTION
- =C2=A0 =C2=A0This section provides the definitive reference to the w= ic
- =C2=A0 =C2=A0kickstart language.=C2=A0 It also provides documentatio= n on the list of
- =C2=A0 =C2=A0--source plugins available for use from the 'part&#= 39; command (see
- =C2=A0 =C2=A0the 'Platform-specific Plugins' section below).=
-
- =C2=A0 =C2=A0The current wic implementation supports only the basic = kickstart
- =C2=A0 =C2=A0partitioning commands: partition (or part for short) an= d
- =C2=A0 =C2=A0bootloader.
-
- =C2=A0 =C2=A0The following is a listing of the commands, their synta= x, and
- =C2=A0 =C2=A0meanings. The commands are based on the Fedora kickstar= t
- =C2=A0 =C2=A0documentation but with modifications to reflect wic cap= abilities.
-
-
- =C2=A0Commands
-
- =C2=A0 =C2=A0* 'part' or 'partition'
-
- =C2=A0 =C2=A0 =C2=A0 This command creates a partition on the system = and uses the
- =C2=A0 =C2=A0 =C2=A0 following syntax:
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 part [<mountpoint>]
-
- =C2=A0 =C2=A0 =C2=A0 The <mountpoint> is where the partition w= ill be mounted and
- =C2=A0 =C2=A0 =C2=A0 must take of one of the following forms:
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 /<path>: For example: /, /usr, or = /home
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 swap: The partition will be used as swap= space.
-
- =C2=A0 =C2=A0 =C2=A0 If a <mountpoint> is not specified the pa= rtition will be created
- =C2=A0 =C2=A0 =C2=A0 but will not be mounted.
-
- =C2=A0 =C2=A0 =C2=A0 Partitions with a <mountpoint> specified = will be automatically mounted.
- =C2=A0 =C2=A0 =C2=A0 This is achieved by wic adding entries to the f= stab during image
- =C2=A0 =C2=A0 =C2=A0 generation. In order for a valid fstab to be ge= nerated one of the
- =C2=A0 =C2=A0 =C2=A0 --ondrive, --ondisk or --use-uuid partition opt= ions must be used for
- =C2=A0 =C2=A0 =C2=A0 each partition that specifies a mountpoint.
-
-
- =C2=A0 =C2=A0 =C2=A0 The following are supported 'part' opti= ons:
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --size: The minimum partition size. Spec= ify an integer value
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 such as 500.= Multipliers k, M ang G can be used. If
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 not specifie= d, the size is in MB.
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 You do not n= eed this option if you use --source.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --fixed-size: Exact partition size. Valu= e format is the same
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 as for --size option. This option cannot be
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 specified along with --size. If partition data
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 is larger than --fixed-size and error will be
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 raised when assembling disk image.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --source: This option is a wic-specific = option that names the
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sourc= e of the data that will populate the
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 parti= tion.=C2=A0 The most common value for this option
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 is &#= 39;rootfs', but can be any value which maps to a
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 valid= 'source plugin' (see 'wic help plugins').
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 If &#= 39;--source rootfs' is used, it tells the wic
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comma= nd to create a partition as large as needed
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 and t= o fill it with the contents of the root
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 files= ystem pointed to by the '-r' wic command-line
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 optio= n (or the equivalent rootfs derived from the
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 '= -e' command-line option).=C2=A0 The filesystem type
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 that = will be used to create the partition is driven
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 by th= e value of the --fstype option specified for
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 the p= artition (see --fstype below).
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 If --= source <plugin-name>' is used, it tells the
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 wic c= ommand to create a partition as large as
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 neede= d and to fill with the contents of the
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 parti= tion that will be generated by the specified
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 plugi= n name using the data pointed to by the '-r'
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 wic c= ommand-line option (or the equivalent rootfs
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 deriv= ed from the '-e' command-line option).
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Exact= ly what those contents and filesystem type end
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 up be= ing are dependent on the given plugin
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 imple= mentation.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 If --= source option is not used, the wic command
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 will = create empty partition. --size parameter has
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 to be= used to specify size of empty partition.
+wic_write_description =3D """
+This command writes an image to a target device (USB stick, SD card e= tc)
=C2=A0
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --ondisk or --ondrive: Forces the partit= ion to be created on
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0a particular disk.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --fstype: Sets the file system type for = the partition.=C2=A0 These
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 apply to partitions created using= '--source rootfs' (see
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 --source above).=C2=A0 Valid valu= es are:
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vfat
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 msdos
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ext2
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ext3
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ext4
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 btrfs
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 squashfs
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 swap
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --fsoptions: Specifies a free-form strin= g of options to be
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0used when mounting the filesystem. This string
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0will be copied into the /etc/fstab file of the
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0installed system and should be enclosed in
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0quotes.=C2=A0 If not specified, the default string is
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0"defaults".
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --label label: Specifies the label to gi= ve to the filesystem
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0to be made on the partition. If the given
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0label is already in use by another filesystem,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0a new label is created for the partition.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --active: Marks the partition as active.=
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --align (in KBytes): This option is spec= ific to wic and says
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0to start a partition on an x KBytes
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0boundary.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --no-table: This option is specific to w= ic. Space will be
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 reserved for the partition and it will be
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 populated but it will not be added to the
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 partition table. It may be useful for
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 bootloaders.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --exclude-path: This option is specific = to wic. It excludes the given
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 relative path from the resulting image. If the path
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 ends with a slash, only the content of the directory
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 is omitted, not the directory itself. This option only
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 has an effect with the rootfs source plugin.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --extra-space: This option is specific t= o wic. It adds extra
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0space after the space filled by the content
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0of the partition. The final size can go
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0beyond the size specified by --size.
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0By default, 10MB. This option cannot be used
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0with --fixed-size option.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --overhead-factor: This option is specif= ic to wic. The
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0size of the partition is multiplied by
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0this factor. It has to be greater than or
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0equal to 1. The default value is 1.3.
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0This option cannot be used with --fixed-size=
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0option.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --part-name: This option is specific to = wic. It specifies name for GPT partitions.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --part-type: This option is specific to = wic. It specifies partition
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0type GUID for GPT partitions.
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0List of partition type GUIDS can be found here:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0http://en.wikipedia.org/wiki/GUID_= Partition_Table#Partition_type_GUIDs
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --use-uuid: This option is specific to w= ic. It makes wic to generate
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 random globally unique identifier (GUID) for the partition
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 and use it in bootloader configuration to specify root partition.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --uuid: This option is specific to wic. = It specifies partition UUID.
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 It's use= ful if preconfigured partition UUID is added to kernel command line
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 in bootloade= r configuration before running wic. In this case .wks file can
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 be generated= or modified to set preconfigured parition UUID using this option.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --system-id: This option is specific to = wic. It specifies partition system id. It's useful
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0for the harware that requires non-default partition system ids. T= he parameter
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0in one byte long hex number either with 0x prefix or without it.<= /div>
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 --mkfs-extraopts: This option specifies = extra options to pass to mkfs utility.
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 NOTE, that wic uses default options for some files= ystems, for example
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 '-S 512' for mkfs.fat or '-F -i 8192&#= 39; for mkfs.ext. Those options will
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 not take effect when --mkfs-extraopts is used. Thi= s should be taken into
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 account when using --mkfs-extraopts.
-
- =C2=A0 =C2=A0* bootloader
-
- =C2=A0 =C2=A0 =C2=A0This command allows the user to specify various = bootloader
- =C2=A0 =C2=A0 =C2=A0options.=C2=A0 The following are supported '= bootloader' options:
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0--timeout: Specifies the number of second= s before the
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bootl= oader times out and boots the default option.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0--append: Specifies kernel parameters. Th= ese will be added to
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bootlo= ader command-line - for example, the syslinux
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0APPEND= or grub kernel command line.
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0--configfile: Specifies a user defined co= nfiguration file for
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0the bootloader. This file must be located in the
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0canned-wks folder or could be the full path to the
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0file. Using this option will override any other
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0bootloader option.
-
- =C2=A0 =C2=A0 =C2=A0Note that bootloader functionality and boot part= itions are
- =C2=A0 =C2=A0 =C2=A0implemented by the various --source plugins that= implement
- =C2=A0 =C2=A0 =C2=A0bootloader functionality; the bootloader command= essentially
- =C2=A0 =C2=A0 =C2=A0provides a means of modifying bootloader configu= ration.
-
- =C2=A0 =C2=A0* include
-
- =C2=A0 =C2=A0 =C2=A0This command allows the user to include the cont= ent of .wks file
- =C2=A0 =C2=A0 =C2=A0into original .wks file.
-
- =C2=A0 =C2=A0 =C2=A0Command uses the following syntax:
-
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 include <file>
-
- =C2=A0 =C2=A0 =C2=A0The <file> is either path to the file or i= ts name. If name is
- =C2=A0 =C2=A0 =C2=A0specified wic will try to find file in the direc= tories with canned
- =C2=A0 =C2=A0 =C2=A0.wks files.
-
-"""
+ =C2=A0 =C2=A0$ wic write ./tmp/deploy/images/qemux86-64/core-im= age-minimal-qemux86-64.wic /dev/sdb
=C2=A0
-wic_help_help =3D """
-NAME
- =C2=A0 =C2=A0wic help - display a help topic
+The --expand option is used to resize image partitions.
+--expand auto expands partitions to occupy all free space available o= n the target device.
+It's also possible to specify expansion rules in a format
+<partition>:<size>[-<partition>:<size>..= .] for one or more partitions.
+Specifying size 0 will keep partition unmodified.
+Note: Resizing boot partition can result in non-bootable image for no= n-EFI images. It is
+recommended to use size 0 for boot partition to keep image bootable.<= /div>
=C2=A0
-DESCRIPTION
- =C2=A0 =C2=A0Specify a help topic to display it. Topics are shown ab= ove.
=C2=A0"""
diff --git a/scripts/wic b/scripts/wic
index 097084a..cb348e3 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -106,7 +106,7 @@ class RootfsArgAction(argparse.Action):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0namespace.__dict__['rootfs_= dir'][key] =3D rootfs_dir
=C2=A0
=C2=A0
-def wic_create_subcommand(options, usage_str):
+def wic_create_subcommand(options):
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0Command-line handling for image creation.=C2=A0 Th= e real work is done
=C2=A0 =C2=A0 =C2=A0by image.engine.wic_create()
@@ -177,7 +177,7 @@ def wic_create_subcommand(options, usage_str):
=C2=A0 =C2=A0 =C2=A0wks_file =3D options.wks_file
=C2=A0
=C2=A0 =C2=A0 =C2=A0if not wks_file.endswith(".wks"):
- =C2=A0 =C2=A0 =C2=A0 =C2=A0wks_file =3D engine.find_canned_image(scripts_path, wks_file)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0wks_file =3D engine.find_canned_image(wks= _file)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if not wks_file:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0raise WicError("N= o image named %s found, exiting. =C2=A0(Use 'wic list images' "= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 "to list available images, or specify a fu= lly-qualified OE "
@@ -227,91 +227,44 @@ def wic_create_subcommand(options, usage_str):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0native_sysroot, options)
=C2=A0
=C2=A0
-def wic_list_subcommand(args, usage_str):
+def wic_list_subcommand(args):
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0Command-line handling for listing available images= .
=C2=A0 =C2=A0 =C2=A0The real work is done by image.engine.wic_list()
=C2=A0 =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0if not engine.wic_list(args, scripts_path):
+ =C2=A0 =C2=A0if not engine.wic_list(scripts_path, args):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0raise WicError("Bad list argume= nts, exiting")
=C2=A0
=C2=A0
-def wic_ls_subcommand(args, usage_str):
+def wic_ls_subcommand(args):
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0Command-line handling for list content of images.<= /div>
=C2=A0 =C2=A0 =C2=A0The real work is done by engine.wic_ls()
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0engine.wic_ls(args, args.native_sysroot)
=C2=A0
-def wic_cp_subcommand(args, usage_str):
+def wic_cp_subcommand(args):
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0Command-line handling for copying files/dirs to im= ages.
=C2=A0 =C2=A0 =C2=A0The real work is done by engine.wic_cp()
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0engine.wic_cp(args, args.native_sysroot)
=C2=A0
-def wic_rm_subcommand(args, usage_str):
+def wic_rm_subcommand(args):
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0Command-line handling for removing files/dirs from= images.
=C2=A0 =C2=A0 =C2=A0The real work is done by engine.wic_rm()
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0engine.wic_rm(args, args.native_sysroot)
=C2=A0
-def wic_write_subcommand(args, usage_str):
+def wic_write_subcommand(args):
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0Command-line handling for writing images.
=C2=A0 =C2=A0 =C2=A0The real work is done by engine.wic_write()
=C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0engine.wic_write(args, args.native_sysroot)
=C2=A0
-def wic_help_subcommand(args, usage_str):
- =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0Command-line handling for help subcommand to keep the c= urrent
- =C2=A0 =C2=A0structure of the function definitions.
- =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0pass
-
=C2=A0
-def wic_help_topic_subcommand(usage_str, help_str):
- =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0Display function for help 'sub-subcommands'.
- =C2=A0 =C2=A0"""
- =C2=A0 =C2=A0print(help_str)
- =C2=A0 =C2=A0return
-
-
-wic_help_topic_usage =3D """
-"""
-
-helptopics =3D {
- =C2=A0 =C2=A0"plugins": =C2=A0 [wic_help_topic_subcommand,=
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_he= lp_topic_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_plugins_help],
- =C2=A0 =C2=A0"overview": =C2=A0[wic_help_topic_subcommand,=
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_he= lp_topic_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_overview_help],
- =C2=A0 =C2=A0"kickstart": [wic_help_topic_subcommand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_he= lp_topic_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_kickstart_help],
- =C2=A0 =C2=A0"create": =C2=A0 =C2=A0[wic_help_topic_subcom= mand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_he= lp_topic_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_create_help],
- =C2=A0 =C2=A0"ls": =C2=A0 =C2=A0 =C2=A0 =C2=A0[wic_help_to= pic_subcommand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_he= lp_topic_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_ls_help],
- =C2=A0 =C2=A0"cp": =C2=A0 =C2=A0 =C2=A0 =C2=A0[wic_help_to= pic_subcommand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_he= lp_topic_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_cp_help],
- =C2=A0 =C2=A0"rm": =C2=A0 =C2=A0 =C2=A0 =C2=A0[wic_help_to= pic_subcommand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_he= lp_topic_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_rm_help],
- =C2=A0 =C2=A0"write": =C2=A0 =C2=A0 [wic_help_topic_subcom= mand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_he= lp_topic_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_write_help],
- =C2=A0 =C2=A0"list": =C2=A0 =C2=A0 =C2=A0[wic_help_topic_s= ubcommand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_he= lp_topic_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_list_help]
-}
=C2=A0
=C2=A0
=C2=A0def wic_init_parser_create(subparser):
@@ -333,17 +286,15 @@ def wic_init_parser_create(subparser):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0help=3D"path to the dir containing the kernel to use &quo= t;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 "in the .wks bootimg")
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("-n", "--nat= ive-sysroot", dest=3D"native_sysroot",
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0help=3D"path to the native sysroot containing the tools &quo= t;
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 "to use to build the image")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0help=3D"path to the native sysroot containing the tools (par= ted and mtools) to use.")
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("-s", "--ski= p-build-check", dest=3D"build_check",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0action=3D"store_false", default=3DTrue, help=3D"= ;skip the build check")
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("-f", "--bui= ld-rootfs", action=3D"store_true", help=3D"build rootfs= ")
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("-c", "--com= press-with", choices=3D("gzip", "bzip2", "xz&= quot;),
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0dest=3D'compressor',
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0help=3D"compress image with specified compressor")
- =C2=A0 =C2=A0subparser.add_argument("-m", "--bmap&quo= t;, action=3D"store_true", help=3D"generate .bmap")
- =C2=A0 =C2=A0subparser.add_argument("--no-fstab-update&quo= t; ,action=3D"store_true",
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0help=3D"Do not change fstab file.")
+ =C2=A0 =C2=A0subparser.add_argument("-m", "--bmap&quo= t;, action=3D"store_true", help=3D"used to produce .bmap fil= e for the image."
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 "This file can be used to flash image using b= maptool utility")
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("-v", "--var= s", dest=3D'vars_dir',
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0help=3D"directory with <image>.env files that store= "
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 "bitbake variables")
@@ -357,10 +308,10 @@ def wic_init_parser_list(subparser):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0help=3D"can be 'images' or 'source-plu= gins' "
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "to obtain a list. "
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "If value is a valid .wks image fil= e")
- =C2=A0 =C2=A0subparser.add_argument("help_for", defau= lt=3D[], nargs=3D'*',
+ =C2=A0 =C2=A0subparser.add_argument("info_for", defau= lt=3D[], nargs=3D'*',
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0help=3D"If 'list_type' is a valid .wks ima= ge file "
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "this value can be 'help' to s= how the help information "
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "defined inside the .wks file")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "this value can be 'info' to s= how the image or plugin information ")
+
=C2=A0 =C2=A0 =C2=A0return
=C2=A0
=C2=A0def imgtype(arg):
@@ -385,9 +336,9 @@ def imgtype(arg):
=C2=A0
=C2=A0def wic_init_parser_ls(subparser):
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("path", type= =3Dimgtype,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"image spec: <image>[:<vfat partition= >[<path>]]")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"image spec: <image>[:<partition>[= <path>]]")
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("-n", "--nat= ive-sysroot",
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"path to the native sysroot containing the too= ls")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"path to the native sysroot containing the too= ls (parted and mtools) to use.")
=C2=A0
=C2=A0def imgpathtype(arg):
=C2=A0 =C2=A0 =C2=A0img =3D imgtype(arg)
@@ -399,15 +350,15 @@ def wic_init_parser_cp(subparser):
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("src",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0help=3D"source spec")
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("dest", type= =3Dimgpathtype,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"image spec: <image>:<vfat partition&= gt;[<path>]")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"image spec: <image>:<partition>[&= lt;path>]")
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("-n", "--nat= ive-sysroot",
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"path to the native sysroot containing the too= ls")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"path to the native sysroot containing the too= ls (parted and mtools) to use.")
=C2=A0
=C2=A0def wic_init_parser_rm(subparser):
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("path", type= =3Dimgpathtype,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"path: <image>:<vfat partition><= ;path>")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"image spec: <image>[:<partition>[= <path>]")
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("-n", "--nat= ive-sysroot",
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"path to the native sysroot containing the too= ls")
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"path to the native sysroot containing the too= ls (parted and mtools) to use.")
=C2=A0
=C2=A0def expandtype(rules):
=C2=A0 =C2=A0 =C2=A0"""
@@ -448,59 +399,56 @@ def wic_init_parser_write(subparser):
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("-e", "--exp= and", type=3Dexpandtype,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0help=3D"expand rules: auto or <partition>:&l= t;size>[,<partition>:<size>]")
=C2=A0 =C2=A0 =C2=A0subparser.add_argument("-n", "--nat= ive-sysroot",
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"path to the native sysroot containing the too= ls")
-
-def wic_init_parser_help(subparser):
- =C2=A0 =C2=A0helpparsers =3D subparser.add_subparsers(dest=3D&#= 39;help_topic', help=3Dhlp.wic_usage)
- =C2=A0 =C2=A0for helptopic in helptopics:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0helpparsers.add_parser(helptopic, he= lp=3Dhelptopics[helptopic][2])
- =C2=A0 =C2=A0return
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0help=3D"path to the native sysroot containing the too= ls (parted and mtools) to use.")
=C2=A0
=C2=A0
=C2=A0subcommands =3D {
=C2=A0 =C2=A0 =C2=A0"create": =C2=A0 =C2=A0[wic_create_subco= mmand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_create_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_create_help,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_create],
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_create_description,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_create,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_create_short_description],
=C2=A0 =C2=A0 =C2=A0"list": =C2=A0 =C2=A0 =C2=A0[wic_list_su= bcommand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_list_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_list_help,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_list],
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_list_description,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_list,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_list_short_description],
=C2=A0 =C2=A0 =C2=A0"ls": =C2=A0 =C2=A0 =C2=A0 =C2=A0[wic_ls= _subcommand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_ls_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_ls_help,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_ls],
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_ls_description,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_ls,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_ls_short_description],
=C2=A0 =C2=A0 =C2=A0"cp": =C2=A0 =C2=A0 =C2=A0 =C2=A0[wic_cp= _subcommand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_cp_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_cp_help,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_cp],
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_cp_description,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_cp,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_cp_short_description],
=C2=A0 =C2=A0 =C2=A0"rm": =C2=A0 =C2=A0 =C2=A0 =C2=A0[wic_rm= _subcommand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_rm_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_rm_help,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_rm],
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_rm_description,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_rm,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_rm_short_description],
=C2=A0 =C2=A0 =C2=A0"write": =C2=A0 =C2=A0 [wic_write_subcom= mand,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_write_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_write_help,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_write],
- =C2=A0 =C2=A0"help": =C2=A0 =C2=A0 =C2=A0[wic_help_subcomm= and,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_he= lp_topic_usage,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_help_help,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_help]
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_write_description,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wic_in= it_parser_write,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlp.wi= c_write_short_description],
=C2=A0}
=C2=A0
+def invoke_subcommand(args, parser, main_command_usage, subcommands):=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0subcmd =3D subcommands.get(args.command, = subcommand_error)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0usage =3D subcmd[1]
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0subcmd[0](args, usage)
+
=C2=A0
=C2=A0def init_parser(parser):
=C2=A0 =C2=A0 =C2=A0parser.add_argument("--version", ac= tion=3D"version",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0version=3D"%(prog)s {version}&q= uot;.format(version=3D__version__))
- =C2=A0 =C2=A0subparsers =3D parser.add_subparsers(dest=3D'c= ommand', help=3Dhlp.wic_usage)
+ =C2=A0 =C2=A0subparsers =3D parser.add_subparsers(dest=3D'c= ommand')
+ =C2=A0 =C2=A0helpparser =3D subparsers.add_parser("help", = help=3D"Display usages")
=C2=A0 =C2=A0 =C2=A0for subcmd in subcommands:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0subparser =3D subparsers.add_parser(subcm= d, help=3Dsubcommands[subcmd][2])
- =C2=A0 =C2=A0 =C2=A0 =C2=A0subcommands[subcmd][3](subparser)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0subparser =3D subparsers.add_parser(subcm= d, help=3Dsubcommands[subcmd][3], formatter_class=3Dargparse.RawDescri= ptionHelpFormatter, description=3Dsubcommands[subcmd][1])
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0subcommands[subcmd][2](subparser)
+
=C2=A0
=C2=A0
=C2=A0def main(argv):
=C2=A0 =C2=A0 =C2=A0parser =3D argparse.ArgumentParser(
- =C2=A0 =C2=A0 =C2=A0 =C2=A0description=3D"wic version %s" = % __version__)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0description=3D"Create a customized O= penEmbedded image. Wic version %s" % __version__)
=C2=A0
=C2=A0 =C2=A0 =C2=A0init_parser(parser)
=C2=A0
@@ -508,22 +456,15 @@ def main(argv):
=C2=A0
=C2=A0 =C2=A0 =C2=A0if "command" in vars(args):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if args.command =3D=3D "help&qu= ot;:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if args.help_topic is None:=
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0parser.print_= help()
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print()
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print("P= lease specify a help topic")
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0elif args.help_topic in hel= ptopics:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlpt =3D help= topics[args.help_topic]
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hlpt[0](hlpt[= 1], hlpt[2])
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0
-
- =C2=A0 =C2=A0return hlp.invoke_subcommand(args, parser, hlp.wic_help= _usage, subcommands)
-
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0parser.print_help()
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print()
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0else:
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0subcmd =3D subcommands.get(= args.command)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0subcmd[0](args)
=C2=A0
=C2=A0if __name__ =3D=3D "__main__":
=C2=A0 =C2=A0 =C2=A0try:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sys.exit(main(sys.argv[1:]))
=C2=A0 =C2=A0 =C2=A0except WicError as err:
- =C2=A0 =C2=A0 =C2=A0 =C2=A0print()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0logger.error(err)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sys.exit(1)
--=C2=A0
2.7.4


--
_______________________________________________
Openembedded-core mailing list
Openembedded-co= re@lists.openembedded.org
http://lists.openembedded.org/m= ailman/listinfo/openembedded-core


--001a114387b8b3019c0560234a2c--