xref: /OK3568_Linux_fs/yocto/poky/scripts/lib/wic/help.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# Copyright (c) 2013, Intel Corporation.
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0-only
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun# DESCRIPTION
6*4882a593Smuzhiyun# This module implements some basic help invocation functions along
7*4882a593Smuzhiyun# with the bulk of the help topic text for the OE Core Image Tools.
8*4882a593Smuzhiyun#
9*4882a593Smuzhiyun# AUTHORS
10*4882a593Smuzhiyun# Tom Zanussi <tom.zanussi (at] linux.intel.com>
11*4882a593Smuzhiyun#
12*4882a593Smuzhiyun
13*4882a593Smuzhiyunimport subprocess
14*4882a593Smuzhiyunimport logging
15*4882a593Smuzhiyun
16*4882a593Smuzhiyunfrom wic.pluginbase import PluginMgr, PLUGIN_TYPES
17*4882a593Smuzhiyun
18*4882a593Smuzhiyunlogger = logging.getLogger('wic')
19*4882a593Smuzhiyun
20*4882a593Smuzhiyundef subcommand_error(args):
21*4882a593Smuzhiyun    logger.info("invalid subcommand %s", args[0])
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun
24*4882a593Smuzhiyundef display_help(subcommand, subcommands):
25*4882a593Smuzhiyun    """
26*4882a593Smuzhiyun    Display help for subcommand.
27*4882a593Smuzhiyun    """
28*4882a593Smuzhiyun    if subcommand not in subcommands:
29*4882a593Smuzhiyun        return False
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun    hlp = subcommands.get(subcommand, subcommand_error)[2]
32*4882a593Smuzhiyun    if callable(hlp):
33*4882a593Smuzhiyun        hlp = hlp()
34*4882a593Smuzhiyun    pager = subprocess.Popen('less', stdin=subprocess.PIPE)
35*4882a593Smuzhiyun    pager.communicate(hlp.encode('utf-8'))
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun    return True
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun
40*4882a593Smuzhiyundef wic_help(args, usage_str, subcommands):
41*4882a593Smuzhiyun    """
42*4882a593Smuzhiyun    Subcommand help dispatcher.
43*4882a593Smuzhiyun    """
44*4882a593Smuzhiyun    if args.help_topic == None or not display_help(args.help_topic, subcommands):
45*4882a593Smuzhiyun        print(usage_str)
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun
48*4882a593Smuzhiyundef get_wic_plugins_help():
49*4882a593Smuzhiyun    """
50*4882a593Smuzhiyun    Combine wic_plugins_help with the help for every known
51*4882a593Smuzhiyun    source plugin.
52*4882a593Smuzhiyun    """
53*4882a593Smuzhiyun    result = wic_plugins_help
54*4882a593Smuzhiyun    for plugin_type in PLUGIN_TYPES:
55*4882a593Smuzhiyun        result += '\n\n%s PLUGINS\n\n' % plugin_type.upper()
56*4882a593Smuzhiyun        for name, plugin in PluginMgr.get_plugins(plugin_type).items():
57*4882a593Smuzhiyun            result += "\n %s plugin:\n" % name
58*4882a593Smuzhiyun            if plugin.__doc__:
59*4882a593Smuzhiyun                result += plugin.__doc__
60*4882a593Smuzhiyun            else:
61*4882a593Smuzhiyun                result += "\n    %s is missing docstring\n" % plugin
62*4882a593Smuzhiyun    return result
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun
65*4882a593Smuzhiyundef invoke_subcommand(args, parser, main_command_usage, subcommands):
66*4882a593Smuzhiyun    """
67*4882a593Smuzhiyun    Dispatch to subcommand handler borrowed from combo-layer.
68*4882a593Smuzhiyun    Should use argparse, but has to work in 2.6.
69*4882a593Smuzhiyun    """
70*4882a593Smuzhiyun    if not args.command:
71*4882a593Smuzhiyun        logger.error("No subcommand specified, exiting")
72*4882a593Smuzhiyun        parser.print_help()
73*4882a593Smuzhiyun        return 1
74*4882a593Smuzhiyun    elif args.command == "help":
75*4882a593Smuzhiyun        wic_help(args, main_command_usage, subcommands)
76*4882a593Smuzhiyun    elif args.command not in subcommands:
77*4882a593Smuzhiyun        logger.error("Unsupported subcommand %s, exiting\n", args.command)
78*4882a593Smuzhiyun        parser.print_help()
79*4882a593Smuzhiyun        return 1
80*4882a593Smuzhiyun    else:
81*4882a593Smuzhiyun        subcmd = subcommands.get(args.command, subcommand_error)
82*4882a593Smuzhiyun        usage = subcmd[1]
83*4882a593Smuzhiyun        subcmd[0](args, usage)
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun##
87*4882a593Smuzhiyun# wic help and usage strings
88*4882a593Smuzhiyun##
89*4882a593Smuzhiyun
90*4882a593Smuzhiyunwic_usage = """
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun Create a customized OpenEmbedded image
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun usage: wic [--version] | [--help] | [COMMAND [ARGS]]
95*4882a593Smuzhiyun
96*4882a593Smuzhiyun Current 'wic' commands are:
97*4882a593Smuzhiyun    help              Show help for command or one of the topics (see below)
98*4882a593Smuzhiyun    create            Create a new OpenEmbedded image
99*4882a593Smuzhiyun    list              List available canned images and source plugins
100*4882a593Smuzhiyun
101*4882a593Smuzhiyun Help topics:
102*4882a593Smuzhiyun    overview          wic overview - General overview of wic
103*4882a593Smuzhiyun    plugins           wic plugins - Overview and API
104*4882a593Smuzhiyun    kickstart         wic kickstart - wic kickstart reference
105*4882a593Smuzhiyun"""
106*4882a593Smuzhiyun
107*4882a593Smuzhiyunwic_help_usage = """
108*4882a593Smuzhiyun
109*4882a593Smuzhiyun usage: wic help <subcommand>
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun This command displays detailed help for the specified subcommand.
112*4882a593Smuzhiyun"""
113*4882a593Smuzhiyun
114*4882a593Smuzhiyunwic_create_usage = """
115*4882a593Smuzhiyun
116*4882a593Smuzhiyun Create a new OpenEmbedded image
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun usage: wic create <wks file or image name> [-o <DIRNAME> | --outdir <DIRNAME>]
119*4882a593Smuzhiyun            [-e | --image-name] [-s, --skip-build-check] [-D, --debug]
120*4882a593Smuzhiyun            [-r, --rootfs-dir] [-b, --bootimg-dir]
121*4882a593Smuzhiyun            [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs]
122*4882a593Smuzhiyun            [-c, --compress-with] [-m, --bmap]
123*4882a593Smuzhiyun
124*4882a593Smuzhiyun This command creates an OpenEmbedded image based on the 'OE kickstart
125*4882a593Smuzhiyun commands' found in the <wks file>.
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun The -o option can be used to place the image in a directory with a
128*4882a593Smuzhiyun different name and location.
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun See 'wic help create' for more detailed instructions.
131*4882a593Smuzhiyun"""
132*4882a593Smuzhiyun
133*4882a593Smuzhiyunwic_create_help = """
134*4882a593Smuzhiyun
135*4882a593SmuzhiyunNAME
136*4882a593Smuzhiyun    wic create - Create a new OpenEmbedded image
137*4882a593Smuzhiyun
138*4882a593SmuzhiyunSYNOPSIS
139*4882a593Smuzhiyun    wic create <wks file or image name> [-o <DIRNAME> | --outdir <DIRNAME>]
140*4882a593Smuzhiyun        [-e | --image-name] [-s, --skip-build-check] [-D, --debug]
141*4882a593Smuzhiyun        [-r, --rootfs-dir] [-b, --bootimg-dir]
142*4882a593Smuzhiyun        [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs]
143*4882a593Smuzhiyun        [-c, --compress-with] [-m, --bmap] [--no-fstab-update]
144*4882a593Smuzhiyun
145*4882a593SmuzhiyunDESCRIPTION
146*4882a593Smuzhiyun    This command creates an OpenEmbedded image based on the 'OE
147*4882a593Smuzhiyun    kickstart commands' found in the <wks file>.
148*4882a593Smuzhiyun
149*4882a593Smuzhiyun    In order to do this, wic needs to know the locations of the
150*4882a593Smuzhiyun    various build artifacts required to build the image.
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun    Users can explicitly specify the build artifact locations using
153*4882a593Smuzhiyun    the -r, -b, -k, and -n options.  See below for details on where
154*4882a593Smuzhiyun    the corresponding artifacts are typically found in a normal
155*4882a593Smuzhiyun    OpenEmbedded build.
156*4882a593Smuzhiyun
157*4882a593Smuzhiyun    Alternatively, users can use the -e option to have 'wic' determine
158*4882a593Smuzhiyun    those locations for a given image.  If the -e option is used, the
159*4882a593Smuzhiyun    user needs to have set the appropriate MACHINE variable in
160*4882a593Smuzhiyun    local.conf, and have sourced the build environment.
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun    The -e option is used to specify the name of the image to use the
163*4882a593Smuzhiyun    artifacts from e.g. core-image-sato.
164*4882a593Smuzhiyun
165*4882a593Smuzhiyun    The -r option is used to specify the path to the /rootfs dir to
166*4882a593Smuzhiyun    use as the .wks rootfs source.
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun    The -b option is used to specify the path to the dir containing
169*4882a593Smuzhiyun    the boot artifacts (e.g. /EFI or /syslinux dirs) to use as the
170*4882a593Smuzhiyun    .wks bootimg source.
171*4882a593Smuzhiyun
172*4882a593Smuzhiyun    The -k option is used to specify the path to the dir containing
173*4882a593Smuzhiyun    the kernel to use in the .wks bootimg.
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun    The -n option is used to specify the path to the native sysroot
176*4882a593Smuzhiyun    containing the tools to use to build the image.
177*4882a593Smuzhiyun
178*4882a593Smuzhiyun    The -f option is used to build rootfs by running "bitbake <image>"
179*4882a593Smuzhiyun
180*4882a593Smuzhiyun    The -s option is used to skip the build check.  The build check is
181*4882a593Smuzhiyun    a simple sanity check used to determine whether the user has
182*4882a593Smuzhiyun    sourced the build environment so that the -e option can operate
183*4882a593Smuzhiyun    correctly.  If the user has specified the build artifact locations
184*4882a593Smuzhiyun    explicitly, 'wic' assumes the user knows what he or she is doing
185*4882a593Smuzhiyun    and skips the build check.
186*4882a593Smuzhiyun
187*4882a593Smuzhiyun    The -D option is used to display debug information detailing
188*4882a593Smuzhiyun    exactly what happens behind the scenes when a create request is
189*4882a593Smuzhiyun    fulfilled (or not, as the case may be).  It enumerates and
190*4882a593Smuzhiyun    displays the command sequence used, and should be included in any
191*4882a593Smuzhiyun    bug report describing unexpected results.
192*4882a593Smuzhiyun
193*4882a593Smuzhiyun    When 'wic -e' is used, the locations for the build artifacts
194*4882a593Smuzhiyun    values are determined by 'wic -e' from the output of the 'bitbake
195*4882a593Smuzhiyun    -e' command given an image name e.g. 'core-image-minimal' and a
196*4882a593Smuzhiyun    given machine set in local.conf.  In that case, the image is
197*4882a593Smuzhiyun    created as if the following 'bitbake -e' variables were used:
198*4882a593Smuzhiyun
199*4882a593Smuzhiyun    -r:        IMAGE_ROOTFS
200*4882a593Smuzhiyun    -k:        STAGING_KERNEL_DIR
201*4882a593Smuzhiyun    -n:        STAGING_DIR_NATIVE
202*4882a593Smuzhiyun    -b:        empty (plugin-specific handlers must determine this)
203*4882a593Smuzhiyun
204*4882a593Smuzhiyun    If 'wic -e' is not used, the user needs to select the appropriate
205*4882a593Smuzhiyun    value for -b (as well as -r, -k, and -n).
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun    The -o option can be used to place the image in a directory with a
208*4882a593Smuzhiyun    different name and location.
209*4882a593Smuzhiyun
210*4882a593Smuzhiyun    The -c option is used to specify compressor utility to compress
211*4882a593Smuzhiyun    an image. gzip, bzip2 and xz compressors are supported.
212*4882a593Smuzhiyun
213*4882a593Smuzhiyun    The -m option is used to produce .bmap file for the image. This file
214*4882a593Smuzhiyun    can be used to flash image using bmaptool utility.
215*4882a593Smuzhiyun
216*4882a593Smuzhiyun    The --no-fstab-update option is used to doesn't change fstab file. When
217*4882a593Smuzhiyun    using this option the final fstab file will be same that in rootfs and
218*4882a593Smuzhiyun    wic doesn't update file, e.g adding a new mount point. User can control
219*4882a593Smuzhiyun    the fstab file content in base-files recipe.
220*4882a593Smuzhiyun"""
221*4882a593Smuzhiyun
222*4882a593Smuzhiyunwic_list_usage = """
223*4882a593Smuzhiyun
224*4882a593Smuzhiyun List available OpenEmbedded images and source plugins
225*4882a593Smuzhiyun
226*4882a593Smuzhiyun usage: wic list images
227*4882a593Smuzhiyun        wic list <image> help
228*4882a593Smuzhiyun        wic list source-plugins
229*4882a593Smuzhiyun
230*4882a593Smuzhiyun This command enumerates the set of available canned images as well as
231*4882a593Smuzhiyun help for those images.  It also can be used to list of available source
232*4882a593Smuzhiyun plugins.
233*4882a593Smuzhiyun
234*4882a593Smuzhiyun The first form enumerates all the available 'canned' images.
235*4882a593Smuzhiyun
236*4882a593Smuzhiyun The second form lists the detailed help information for a specific
237*4882a593Smuzhiyun 'canned' image.
238*4882a593Smuzhiyun
239*4882a593Smuzhiyun The third form enumerates all the available --sources (source
240*4882a593Smuzhiyun plugins).
241*4882a593Smuzhiyun
242*4882a593Smuzhiyun See 'wic help list' for more details.
243*4882a593Smuzhiyun"""
244*4882a593Smuzhiyun
245*4882a593Smuzhiyunwic_list_help = """
246*4882a593Smuzhiyun
247*4882a593SmuzhiyunNAME
248*4882a593Smuzhiyun    wic list - List available OpenEmbedded images and source plugins
249*4882a593Smuzhiyun
250*4882a593SmuzhiyunSYNOPSIS
251*4882a593Smuzhiyun    wic list images
252*4882a593Smuzhiyun    wic list <image> help
253*4882a593Smuzhiyun    wic list source-plugins
254*4882a593Smuzhiyun
255*4882a593SmuzhiyunDESCRIPTION
256*4882a593Smuzhiyun    This command enumerates the set of available canned images as well
257*4882a593Smuzhiyun    as help for those images.  It also can be used to list available
258*4882a593Smuzhiyun    source plugins.
259*4882a593Smuzhiyun
260*4882a593Smuzhiyun    The first form enumerates all the available 'canned' images.
261*4882a593Smuzhiyun    These are actually just the set of .wks files that have been moved
262*4882a593Smuzhiyun    into the /scripts/lib/wic/canned-wks directory).
263*4882a593Smuzhiyun
264*4882a593Smuzhiyun    The second form lists the detailed help information for a specific
265*4882a593Smuzhiyun    'canned' image.
266*4882a593Smuzhiyun
267*4882a593Smuzhiyun    The third form enumerates all the available --sources (source
268*4882a593Smuzhiyun    plugins).  The contents of a given partition are driven by code
269*4882a593Smuzhiyun    defined in 'source plugins'.  Users specify a specific plugin via
270*4882a593Smuzhiyun    the --source parameter of the partition .wks command.  Normally
271*4882a593Smuzhiyun    this is the 'rootfs' plugin but can be any of the more specialized
272*4882a593Smuzhiyun    sources listed by the 'list source-plugins' command.  Users can
273*4882a593Smuzhiyun    also add their own source plugins - see 'wic help plugins' for
274*4882a593Smuzhiyun    details.
275*4882a593Smuzhiyun"""
276*4882a593Smuzhiyun
277*4882a593Smuzhiyunwic_ls_usage = """
278*4882a593Smuzhiyun
279*4882a593Smuzhiyun List content of a partitioned image
280*4882a593Smuzhiyun
281*4882a593Smuzhiyun usage: wic ls <image>[:<partition>[<path>]] [--native-sysroot <path>]
282*4882a593Smuzhiyun
283*4882a593Smuzhiyun This command  outputs either list of image partitions or directory contents
284*4882a593Smuzhiyun of vfat and ext* partitions.
285*4882a593Smuzhiyun
286*4882a593Smuzhiyun See 'wic help ls' for more detailed instructions.
287*4882a593Smuzhiyun
288*4882a593Smuzhiyun"""
289*4882a593Smuzhiyun
290*4882a593Smuzhiyunwic_ls_help = """
291*4882a593Smuzhiyun
292*4882a593SmuzhiyunNAME
293*4882a593Smuzhiyun    wic ls - List contents of partitioned image or partition
294*4882a593Smuzhiyun
295*4882a593SmuzhiyunSYNOPSIS
296*4882a593Smuzhiyun    wic ls <image>
297*4882a593Smuzhiyun    wic ls <image>:<vfat or ext* partition>
298*4882a593Smuzhiyun    wic ls <image>:<vfat or ext* partition><path>
299*4882a593Smuzhiyun    wic ls <image>:<vfat or ext* partition><path> --native-sysroot <path>
300*4882a593Smuzhiyun
301*4882a593SmuzhiyunDESCRIPTION
302*4882a593Smuzhiyun    This command lists either partitions of the image or directory contents
303*4882a593Smuzhiyun    of vfat or ext* partitions.
304*4882a593Smuzhiyun
305*4882a593Smuzhiyun    The first form it lists partitions of the image.
306*4882a593Smuzhiyun    For example:
307*4882a593Smuzhiyun        $ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic
308*4882a593Smuzhiyun        Num     Start        End          Size      Fstype
309*4882a593Smuzhiyun        1        1048576     24438783     23390208  fat16
310*4882a593Smuzhiyun        2       25165824     50315263     25149440  ext4
311*4882a593Smuzhiyun
312*4882a593Smuzhiyun    Second and third form list directory content of the partition:
313*4882a593Smuzhiyun        $ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1
314*4882a593Smuzhiyun        Volume in drive : is boot
315*4882a593Smuzhiyun         Volume Serial Number is 2DF2-5F02
316*4882a593Smuzhiyun        Directory for ::/
317*4882a593Smuzhiyun
318*4882a593Smuzhiyun        efi          <DIR>     2017-05-11  10:54
319*4882a593Smuzhiyun        startup  nsh        26 2017-05-11  10:54
320*4882a593Smuzhiyun        vmlinuz        6922288 2017-05-11  10:54
321*4882a593Smuzhiyun                3 files           6 922 314 bytes
322*4882a593Smuzhiyun                                 15 818 752 bytes free
323*4882a593Smuzhiyun
324*4882a593Smuzhiyun
325*4882a593Smuzhiyun        $ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1/EFI/boot/
326*4882a593Smuzhiyun        Volume in drive : is boot
327*4882a593Smuzhiyun         Volume Serial Number is 2DF2-5F02
328*4882a593Smuzhiyun        Directory for ::/EFI/boot
329*4882a593Smuzhiyun
330*4882a593Smuzhiyun        .            <DIR>     2017-05-11  10:54
331*4882a593Smuzhiyun        ..           <DIR>     2017-05-11  10:54
332*4882a593Smuzhiyun        grub     cfg       679 2017-05-11  10:54
333*4882a593Smuzhiyun        bootx64  efi    571392 2017-05-11  10:54
334*4882a593Smuzhiyun                4 files             572 071 bytes
335*4882a593Smuzhiyun                                 15 818 752 bytes free
336*4882a593Smuzhiyun
337*4882a593Smuzhiyun    The -n option is used to specify the path to the native sysroot
338*4882a593Smuzhiyun    containing the tools(parted and mtools) to use.
339*4882a593Smuzhiyun
340*4882a593Smuzhiyun"""
341*4882a593Smuzhiyun
342*4882a593Smuzhiyunwic_cp_usage = """
343*4882a593Smuzhiyun
344*4882a593Smuzhiyun Copy files and directories to/from the vfat or ext* partition
345*4882a593Smuzhiyun
346*4882a593Smuzhiyun usage: wic cp <src> <dest> [--native-sysroot <path>]
347*4882a593Smuzhiyun
348*4882a593Smuzhiyun source/destination image in format <image>:<partition>[<path>]
349*4882a593Smuzhiyun
350*4882a593Smuzhiyun This command copies files or directories either
351*4882a593Smuzhiyun  - from local to vfat or ext* partitions of partitioned image
352*4882a593Smuzhiyun  - from vfat or ext* partitions of partitioned image to local
353*4882a593Smuzhiyun
354*4882a593Smuzhiyun See 'wic help cp' for more detailed instructions.
355*4882a593Smuzhiyun
356*4882a593Smuzhiyun"""
357*4882a593Smuzhiyun
358*4882a593Smuzhiyunwic_cp_help = """
359*4882a593Smuzhiyun
360*4882a593SmuzhiyunNAME
361*4882a593Smuzhiyun    wic cp - copy files and directories to/from the vfat or ext* partitions
362*4882a593Smuzhiyun
363*4882a593SmuzhiyunSYNOPSIS
364*4882a593Smuzhiyun    wic cp <src> <dest>:<partition>
365*4882a593Smuzhiyun    wic cp <src>:<partition> <dest>
366*4882a593Smuzhiyun    wic cp <src> <dest-image>:<partition><path>
367*4882a593Smuzhiyun    wic cp <src> <dest-image>:<partition><path> --native-sysroot <path>
368*4882a593Smuzhiyun
369*4882a593SmuzhiyunDESCRIPTION
370*4882a593Smuzhiyun    This command copies files or directories either
371*4882a593Smuzhiyun      - from local to vfat or ext* partitions of partitioned image
372*4882a593Smuzhiyun      - from vfat or ext* partitions of partitioned image to local
373*4882a593Smuzhiyun
374*4882a593Smuzhiyun    The first form of it copies file or directory to the root directory of
375*4882a593Smuzhiyun    the partition:
376*4882a593Smuzhiyun        $ wic cp test.wks tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1
377*4882a593Smuzhiyun        $ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1
378*4882a593Smuzhiyun        Volume in drive : is boot
379*4882a593Smuzhiyun         Volume Serial Number is DB4C-FD4C
380*4882a593Smuzhiyun        Directory for ::/
381*4882a593Smuzhiyun
382*4882a593Smuzhiyun        efi          <DIR>     2017-05-24  18:15
383*4882a593Smuzhiyun        loader       <DIR>     2017-05-24  18:15
384*4882a593Smuzhiyun        startup  nsh        26 2017-05-24  18:15
385*4882a593Smuzhiyun        vmlinuz        6926384 2017-05-24  18:15
386*4882a593Smuzhiyun        test     wks       628 2017-05-24  21:22
387*4882a593Smuzhiyun                5 files           6 927 038 bytes
388*4882a593Smuzhiyun                                 15 677 440 bytes free
389*4882a593Smuzhiyun
390*4882a593Smuzhiyun    The second form of the command copies file or directory to the specified directory
391*4882a593Smuzhiyun    on the partition:
392*4882a593Smuzhiyun       $ wic cp test tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1/efi/
393*4882a593Smuzhiyun       $ wic ls tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1/efi/
394*4882a593Smuzhiyun       Volume in drive : is boot
395*4882a593Smuzhiyun        Volume Serial Number is DB4C-FD4C
396*4882a593Smuzhiyun       Directory for ::/efi
397*4882a593Smuzhiyun
398*4882a593Smuzhiyun       .            <DIR>     2017-05-24  18:15
399*4882a593Smuzhiyun       ..           <DIR>     2017-05-24  18:15
400*4882a593Smuzhiyun       boot         <DIR>     2017-05-24  18:15
401*4882a593Smuzhiyun       test         <DIR>     2017-05-24  21:27
402*4882a593Smuzhiyun               4 files                   0 bytes
403*4882a593Smuzhiyun                                15 675 392 bytes free
404*4882a593Smuzhiyun
405*4882a593Smuzhiyun    The third form of the command copies file or directory from the specified directory
406*4882a593Smuzhiyun    on the partition to local:
407*4882a593Smuzhiyun       $ wic cp tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1/vmlinuz test
408*4882a593Smuzhiyun
409*4882a593Smuzhiyun    The -n option is used to specify the path to the native sysroot
410*4882a593Smuzhiyun    containing the tools(parted and mtools) to use.
411*4882a593Smuzhiyun"""
412*4882a593Smuzhiyun
413*4882a593Smuzhiyunwic_rm_usage = """
414*4882a593Smuzhiyun
415*4882a593Smuzhiyun Remove files or directories from the vfat or ext* partitions
416*4882a593Smuzhiyun
417*4882a593Smuzhiyun usage: wic rm <image>:<partition><path> [--native-sysroot <path>]
418*4882a593Smuzhiyun
419*4882a593Smuzhiyun This command  removes files or directories from the vfat or ext* partitions of
420*4882a593Smuzhiyun the partitioned image.
421*4882a593Smuzhiyun
422*4882a593Smuzhiyun See 'wic help rm' for more detailed instructions.
423*4882a593Smuzhiyun
424*4882a593Smuzhiyun"""
425*4882a593Smuzhiyun
426*4882a593Smuzhiyunwic_rm_help = """
427*4882a593Smuzhiyun
428*4882a593SmuzhiyunNAME
429*4882a593Smuzhiyun    wic rm - remove files or directories from the vfat or ext* partitions
430*4882a593Smuzhiyun
431*4882a593SmuzhiyunSYNOPSIS
432*4882a593Smuzhiyun    wic rm <src> <image>:<partition><path>
433*4882a593Smuzhiyun    wic rm <src> <image>:<partition><path> --native-sysroot <path>
434*4882a593Smuzhiyun    wic rm -r <image>:<partition><path>
435*4882a593Smuzhiyun
436*4882a593SmuzhiyunDESCRIPTION
437*4882a593Smuzhiyun    This command removes files or directories from the vfat or ext* partition of the
438*4882a593Smuzhiyun    partitioned image:
439*4882a593Smuzhiyun
440*4882a593Smuzhiyun        $ wic ls ./tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1
441*4882a593Smuzhiyun        Volume in drive : is boot
442*4882a593Smuzhiyun         Volume Serial Number is 11D0-DE21
443*4882a593Smuzhiyun        Directory for ::/
444*4882a593Smuzhiyun
445*4882a593Smuzhiyun        libcom32 c32    186500 2017-06-02  15:15
446*4882a593Smuzhiyun        libutil  c32     24148 2017-06-02  15:15
447*4882a593Smuzhiyun        syslinux cfg       209 2017-06-02  15:15
448*4882a593Smuzhiyun        vesamenu c32     27104 2017-06-02  15:15
449*4882a593Smuzhiyun        vmlinuz        6926384 2017-06-02  15:15
450*4882a593Smuzhiyun                5 files           7 164 345 bytes
451*4882a593Smuzhiyun                                 16 582 656 bytes free
452*4882a593Smuzhiyun
453*4882a593Smuzhiyun        $ wic rm ./tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1/libutil.c32
454*4882a593Smuzhiyun
455*4882a593Smuzhiyun        $ wic ls ./tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic:1
456*4882a593Smuzhiyun        Volume in drive : is boot
457*4882a593Smuzhiyun         Volume Serial Number is 11D0-DE21
458*4882a593Smuzhiyun        Directory for ::/
459*4882a593Smuzhiyun
460*4882a593Smuzhiyun        libcom32 c32    186500 2017-06-02  15:15
461*4882a593Smuzhiyun        syslinux cfg       209 2017-06-02  15:15
462*4882a593Smuzhiyun        vesamenu c32     27104 2017-06-02  15:15
463*4882a593Smuzhiyun        vmlinuz        6926384 2017-06-02  15:15
464*4882a593Smuzhiyun                4 files           7 140 197 bytes
465*4882a593Smuzhiyun                                 16 607 232 bytes free
466*4882a593Smuzhiyun
467*4882a593Smuzhiyun    The -n option is used to specify the path to the native sysroot
468*4882a593Smuzhiyun    containing the tools(parted and mtools) to use.
469*4882a593Smuzhiyun
470*4882a593Smuzhiyun    The -r option is used to remove directories and their contents
471*4882a593Smuzhiyun    recursively,this only applies to ext* partition.
472*4882a593Smuzhiyun"""
473*4882a593Smuzhiyun
474*4882a593Smuzhiyunwic_write_usage = """
475*4882a593Smuzhiyun
476*4882a593Smuzhiyun Write image to a device
477*4882a593Smuzhiyun
478*4882a593Smuzhiyun usage: wic write <image> <target device> [--expand [rules]] [--native-sysroot <path>]
479*4882a593Smuzhiyun
480*4882a593Smuzhiyun This command writes partitioned image to a target device (USB stick, SD card etc).
481*4882a593Smuzhiyun
482*4882a593Smuzhiyun See 'wic help write' for more detailed instructions.
483*4882a593Smuzhiyun
484*4882a593Smuzhiyun"""
485*4882a593Smuzhiyun
486*4882a593Smuzhiyunwic_write_help = """
487*4882a593Smuzhiyun
488*4882a593SmuzhiyunNAME
489*4882a593Smuzhiyun    wic write - write an image to a device
490*4882a593Smuzhiyun
491*4882a593SmuzhiyunSYNOPSIS
492*4882a593Smuzhiyun    wic write <image> <target>
493*4882a593Smuzhiyun    wic write <image> <target> --expand auto
494*4882a593Smuzhiyun    wic write <image> <target> --expand 1:100M,2:300M
495*4882a593Smuzhiyun    wic write <image> <target> --native-sysroot <path>
496*4882a593Smuzhiyun
497*4882a593SmuzhiyunDESCRIPTION
498*4882a593Smuzhiyun    This command writes an image to a target device (USB stick, SD card etc)
499*4882a593Smuzhiyun
500*4882a593Smuzhiyun        $ wic write ./tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic /dev/sdb
501*4882a593Smuzhiyun
502*4882a593Smuzhiyun    The --expand option is used to resize image partitions.
503*4882a593Smuzhiyun    --expand auto expands partitions to occupy all free space available on the target device.
504*4882a593Smuzhiyun    It's also possible to specify expansion rules in a format
505*4882a593Smuzhiyun    <partition>:<size>[,<partition>:<size>...] for one or more partitions.
506*4882a593Smuzhiyun    Specifying size 0 will keep partition unmodified.
507*4882a593Smuzhiyun    Note: Resizing boot partition can result in non-bootable image for non-EFI images. It is
508*4882a593Smuzhiyun    recommended to use size 0 for boot partition to keep image bootable.
509*4882a593Smuzhiyun
510*4882a593Smuzhiyun    The --native-sysroot option is used to specify the path to the native sysroot
511*4882a593Smuzhiyun    containing the tools(parted, resize2fs) to use.
512*4882a593Smuzhiyun"""
513*4882a593Smuzhiyun
514*4882a593Smuzhiyunwic_plugins_help = """
515*4882a593Smuzhiyun
516*4882a593SmuzhiyunNAME
517*4882a593Smuzhiyun    wic plugins - Overview and API
518*4882a593Smuzhiyun
519*4882a593SmuzhiyunDESCRIPTION
520*4882a593Smuzhiyun    plugins allow wic functionality to be extended and specialized by
521*4882a593Smuzhiyun    users.  This section documents the plugin interface, which is
522*4882a593Smuzhiyun    currently restricted to 'source' plugins.
523*4882a593Smuzhiyun
524*4882a593Smuzhiyun    'Source' plugins provide a mechanism to customize various aspects
525*4882a593Smuzhiyun    of the image generation process in wic, mainly the contents of
526*4882a593Smuzhiyun    partitions.
527*4882a593Smuzhiyun
528*4882a593Smuzhiyun    Source plugins provide a mechanism for mapping values specified in
529*4882a593Smuzhiyun    .wks files using the --source keyword to a particular plugin
530*4882a593Smuzhiyun    implementation that populates a corresponding partition.
531*4882a593Smuzhiyun
532*4882a593Smuzhiyun    A source plugin is created as a subclass of SourcePlugin (see
533*4882a593Smuzhiyun    scripts/lib/wic/pluginbase.py) and the plugin file containing it
534*4882a593Smuzhiyun    is added to scripts/lib/wic/plugins/source/ to make the plugin
535*4882a593Smuzhiyun    implementation available to the wic implementation.
536*4882a593Smuzhiyun
537*4882a593Smuzhiyun    Source plugins can also be implemented and added by external
538*4882a593Smuzhiyun    layers - any plugins found in a scripts/lib/wic/plugins/source/
539*4882a593Smuzhiyun    or lib/wic/plugins/source/ directory in an external layer will
540*4882a593Smuzhiyun    also be made available.
541*4882a593Smuzhiyun
542*4882a593Smuzhiyun    When the wic implementation needs to invoke a partition-specific
543*4882a593Smuzhiyun    implementation, it looks for the plugin that has the same name as
544*4882a593Smuzhiyun    the --source param given to that partition.  For example, if the
545*4882a593Smuzhiyun    partition is set up like this:
546*4882a593Smuzhiyun
547*4882a593Smuzhiyun      part /boot --source bootimg-pcbios   ...
548*4882a593Smuzhiyun
549*4882a593Smuzhiyun    then the methods defined as class members of the plugin having the
550*4882a593Smuzhiyun    matching bootimg-pcbios .name class member would be used.
551*4882a593Smuzhiyun
552*4882a593Smuzhiyun    To be more concrete, here's the plugin definition that would match
553*4882a593Smuzhiyun    a '--source bootimg-pcbios' usage, along with an example method
554*4882a593Smuzhiyun    that would be called by the wic implementation when it needed to
555*4882a593Smuzhiyun    invoke an implementation-specific partition-preparation function:
556*4882a593Smuzhiyun
557*4882a593Smuzhiyun    class BootimgPcbiosPlugin(SourcePlugin):
558*4882a593Smuzhiyun        name = 'bootimg-pcbios'
559*4882a593Smuzhiyun
560*4882a593Smuzhiyun    @classmethod
561*4882a593Smuzhiyun        def do_prepare_partition(self, part, ...)
562*4882a593Smuzhiyun
563*4882a593Smuzhiyun    If the subclass itself doesn't implement a function, a 'default'
564*4882a593Smuzhiyun    version in a superclass will be located and used, which is why all
565*4882a593Smuzhiyun    plugins must be derived from SourcePlugin.
566*4882a593Smuzhiyun
567*4882a593Smuzhiyun    The SourcePlugin class defines the following methods, which is the
568*4882a593Smuzhiyun    current set of methods that can be implemented/overridden by
569*4882a593Smuzhiyun    --source plugins.  Any methods not implemented by a SourcePlugin
570*4882a593Smuzhiyun    subclass inherit the implementations present in the SourcePlugin
571*4882a593Smuzhiyun    class (see the SourcePlugin source for details):
572*4882a593Smuzhiyun
573*4882a593Smuzhiyun      do_prepare_partition()
574*4882a593Smuzhiyun          Called to do the actual content population for a
575*4882a593Smuzhiyun          partition. In other words, it 'prepares' the final partition
576*4882a593Smuzhiyun          image which will be incorporated into the disk image.
577*4882a593Smuzhiyun
578*4882a593Smuzhiyun      do_post_partition()
579*4882a593Smuzhiyun          Called after the partition is created. It is useful to add post
580*4882a593Smuzhiyun          operations e.g. signing the partition.
581*4882a593Smuzhiyun
582*4882a593Smuzhiyun      do_configure_partition()
583*4882a593Smuzhiyun          Called before do_prepare_partition(), typically used to
584*4882a593Smuzhiyun          create custom configuration files for a partition, for
585*4882a593Smuzhiyun          example syslinux or grub config files.
586*4882a593Smuzhiyun
587*4882a593Smuzhiyun      do_install_disk()
588*4882a593Smuzhiyun          Called after all partitions have been prepared and assembled
589*4882a593Smuzhiyun          into a disk image.  This provides a hook to allow
590*4882a593Smuzhiyun          finalization of a disk image, for example to write an MBR to
591*4882a593Smuzhiyun          it.
592*4882a593Smuzhiyun
593*4882a593Smuzhiyun      do_stage_partition()
594*4882a593Smuzhiyun          Special content-staging hook called before
595*4882a593Smuzhiyun          do_prepare_partition(), normally empty.
596*4882a593Smuzhiyun
597*4882a593Smuzhiyun          Typically, a partition will just use the passed-in
598*4882a593Smuzhiyun          parameters, for example the unmodified value of bootimg_dir.
599*4882a593Smuzhiyun          In some cases however, things may need to be more tailored.
600*4882a593Smuzhiyun          As an example, certain files may additionally need to be
601*4882a593Smuzhiyun          take from bootimg_dir + /boot.  This hook allows those files
602*4882a593Smuzhiyun          to be staged in a customized fashion.  Note that
603*4882a593Smuzhiyun          get_bitbake_var() allows you to access non-standard
604*4882a593Smuzhiyun          variables that you might want to use for these types of
605*4882a593Smuzhiyun          situations.
606*4882a593Smuzhiyun
607*4882a593Smuzhiyun    This scheme is extensible - adding more hooks is a simple matter
608*4882a593Smuzhiyun    of adding more plugin methods to SourcePlugin and derived classes.
609*4882a593Smuzhiyun    Please see the implementation for details.
610*4882a593Smuzhiyun"""
611*4882a593Smuzhiyun
612*4882a593Smuzhiyunwic_overview_help = """
613*4882a593Smuzhiyun
614*4882a593SmuzhiyunNAME
615*4882a593Smuzhiyun    wic overview - General overview of wic
616*4882a593Smuzhiyun
617*4882a593SmuzhiyunDESCRIPTION
618*4882a593Smuzhiyun    The 'wic' command generates partitioned images from existing
619*4882a593Smuzhiyun    OpenEmbedded build artifacts.  Image generation is driven by
620*4882a593Smuzhiyun    partitioning commands contained in an 'Openembedded kickstart'
621*4882a593Smuzhiyun    (.wks) file (see 'wic help kickstart') specified either directly
622*4882a593Smuzhiyun    on the command-line or as one of a selection of canned .wks files
623*4882a593Smuzhiyun    (see 'wic list images').  When applied to a given set of build
624*4882a593Smuzhiyun    artifacts, the result is an image or set of images that can be
625*4882a593Smuzhiyun    directly written onto media and used on a particular system.
626*4882a593Smuzhiyun
627*4882a593Smuzhiyun    The 'wic' command and the infrastructure it's based on is by
628*4882a593Smuzhiyun    definition incomplete - its purpose is to allow the generation of
629*4882a593Smuzhiyun    customized images, and as such was designed to be completely
630*4882a593Smuzhiyun    extensible via a plugin interface (see 'wic help plugins').
631*4882a593Smuzhiyun
632*4882a593Smuzhiyun  Background and Motivation
633*4882a593Smuzhiyun
634*4882a593Smuzhiyun    wic is meant to be a completely independent standalone utility
635*4882a593Smuzhiyun    that initially provides easier-to-use and more flexible
636*4882a593Smuzhiyun    replacements for a couple bits of existing functionality in
637*4882a593Smuzhiyun    oe-core: directdisk.bbclass and mkefidisk.sh.  The difference
638*4882a593Smuzhiyun    between wic and those examples is that with wic the functionality
639*4882a593Smuzhiyun    of those scripts is implemented by a general-purpose partitioning
640*4882a593Smuzhiyun    'language' based on Red Hat kickstart syntax).
641*4882a593Smuzhiyun
642*4882a593Smuzhiyun    The initial motivation and design considerations that lead to the
643*4882a593Smuzhiyun    current tool are described exhaustively in Yocto Bug #3847
644*4882a593Smuzhiyun    (https://bugzilla.yoctoproject.org/show_bug.cgi?id=3847).
645*4882a593Smuzhiyun
646*4882a593Smuzhiyun  Implementation and Examples
647*4882a593Smuzhiyun
648*4882a593Smuzhiyun    wic can be used in two different modes, depending on how much
649*4882a593Smuzhiyun    control the user needs in specifying the Openembedded build
650*4882a593Smuzhiyun    artifacts that will be used in creating the image: 'raw' and
651*4882a593Smuzhiyun    'cooked'.
652*4882a593Smuzhiyun
653*4882a593Smuzhiyun    If used in 'raw' mode, artifacts are explicitly specified via
654*4882a593Smuzhiyun    command-line arguments (see example below).
655*4882a593Smuzhiyun
656*4882a593Smuzhiyun    The more easily usable 'cooked' mode uses the current MACHINE
657*4882a593Smuzhiyun    setting and a specified image name to automatically locate the
658*4882a593Smuzhiyun    artifacts used to create the image.
659*4882a593Smuzhiyun
660*4882a593Smuzhiyun    OE kickstart files (.wks) can of course be specified directly on
661*4882a593Smuzhiyun    the command-line, but the user can also choose from a set of
662*4882a593Smuzhiyun    'canned' .wks files available via the 'wic list images' command
663*4882a593Smuzhiyun    (example below).
664*4882a593Smuzhiyun
665*4882a593Smuzhiyun    In any case, the prerequisite for generating any image is to have
666*4882a593Smuzhiyun    the build artifacts already available.  The below examples assume
667*4882a593Smuzhiyun    the user has already build a 'core-image-minimal' for a specific
668*4882a593Smuzhiyun    machine (future versions won't require this redundant step, but
669*4882a593Smuzhiyun    for now that's typically how build artifacts get generated).
670*4882a593Smuzhiyun
671*4882a593Smuzhiyun    The other prerequisite is to source the build environment:
672*4882a593Smuzhiyun
673*4882a593Smuzhiyun      $ source oe-init-build-env
674*4882a593Smuzhiyun
675*4882a593Smuzhiyun    To start out with, we'll generate an image from one of the canned
676*4882a593Smuzhiyun    .wks files.  The following generates a list of availailable
677*4882a593Smuzhiyun    images:
678*4882a593Smuzhiyun
679*4882a593Smuzhiyun      $ wic list images
680*4882a593Smuzhiyun        mkefidisk             Create an EFI disk image
681*4882a593Smuzhiyun        directdisk            Create a 'pcbios' direct disk image
682*4882a593Smuzhiyun
683*4882a593Smuzhiyun    You can get more information about any of the available images by
684*4882a593Smuzhiyun    typing 'wic list xxx help', where 'xxx' is one of the image names:
685*4882a593Smuzhiyun
686*4882a593Smuzhiyun      $ wic list mkefidisk help
687*4882a593Smuzhiyun
688*4882a593Smuzhiyun    Creates a partitioned EFI disk image that the user can directly dd
689*4882a593Smuzhiyun    to boot media.
690*4882a593Smuzhiyun
691*4882a593Smuzhiyun    At any time, you can get help on the 'wic' command or any
692*4882a593Smuzhiyun    subcommand (currently 'list' and 'create').  For instance, to get
693*4882a593Smuzhiyun    the description of 'wic create' command and its parameters:
694*4882a593Smuzhiyun
695*4882a593Smuzhiyun      $ wic create
696*4882a593Smuzhiyun
697*4882a593Smuzhiyun       Usage:
698*4882a593Smuzhiyun
699*4882a593Smuzhiyun       Create a new OpenEmbedded image
700*4882a593Smuzhiyun
701*4882a593Smuzhiyun       usage: wic create <wks file or image name> [-o <DIRNAME> | ...]
702*4882a593Smuzhiyun            [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
703*4882a593Smuzhiyun            [-e | --image-name] [-s, --skip-build-check] [-D, --debug]
704*4882a593Smuzhiyun            [-r, --rootfs-dir] [-b, --bootimg-dir] [-k, --kernel-dir]
705*4882a593Smuzhiyun            [-n, --native-sysroot] [-f, --build-rootfs]
706*4882a593Smuzhiyun
707*4882a593Smuzhiyun       This command creates an OpenEmbedded image based on the 'OE
708*4882a593Smuzhiyun       kickstart commands' found in the <wks file>.
709*4882a593Smuzhiyun
710*4882a593Smuzhiyun       The -o option can be used to place the image in a directory
711*4882a593Smuzhiyun       with a different name and location.
712*4882a593Smuzhiyun
713*4882a593Smuzhiyun       See 'wic help create' for more detailed instructions.
714*4882a593Smuzhiyun       ...
715*4882a593Smuzhiyun
716*4882a593Smuzhiyun    As mentioned in the command, you can get even more detailed
717*4882a593Smuzhiyun    information by adding 'help' to the above:
718*4882a593Smuzhiyun
719*4882a593Smuzhiyun      $ wic help create
720*4882a593Smuzhiyun
721*4882a593Smuzhiyun    So, the easiest way to create an image is to use the -e option
722*4882a593Smuzhiyun    with a canned .wks file.  To use the -e option, you need to
723*4882a593Smuzhiyun    specify the image used to generate the artifacts and you actually
724*4882a593Smuzhiyun    need to have the MACHINE used to build them specified in your
725*4882a593Smuzhiyun    local.conf (these requirements aren't necessary if you aren't
726*4882a593Smuzhiyun    using the -e options.)  Below, we generate a directdisk image,
727*4882a593Smuzhiyun    pointing the process at the core-image-minimal artifacts for the
728*4882a593Smuzhiyun    current MACHINE:
729*4882a593Smuzhiyun
730*4882a593Smuzhiyun      $ wic create directdisk -e core-image-minimal
731*4882a593Smuzhiyun
732*4882a593Smuzhiyun      Checking basic build environment...
733*4882a593Smuzhiyun      Done.
734*4882a593Smuzhiyun
735*4882a593Smuzhiyun      Creating image(s)...
736*4882a593Smuzhiyun
737*4882a593Smuzhiyun      Info: The new image(s) can be found here:
738*4882a593Smuzhiyun      /var/tmp/wic/build/directdisk-201309252350-sda.direct
739*4882a593Smuzhiyun
740*4882a593Smuzhiyun      The following build artifacts were used to create the image(s):
741*4882a593Smuzhiyun
742*4882a593Smuzhiyun      ROOTFS_DIR:      ...
743*4882a593Smuzhiyun      BOOTIMG_DIR:     ...
744*4882a593Smuzhiyun      KERNEL_DIR:      ...
745*4882a593Smuzhiyun      NATIVE_SYSROOT:  ...
746*4882a593Smuzhiyun
747*4882a593Smuzhiyun      The image(s) were created using OE kickstart file:
748*4882a593Smuzhiyun        .../scripts/lib/wic/canned-wks/directdisk.wks
749*4882a593Smuzhiyun
750*4882a593Smuzhiyun    The output shows the name and location of the image created, and
751*4882a593Smuzhiyun    so that you know exactly what was used to generate the image, each
752*4882a593Smuzhiyun    of the artifacts and the kickstart file used.
753*4882a593Smuzhiyun
754*4882a593Smuzhiyun    Similarly, you can create a 'mkefidisk' image in the same way
755*4882a593Smuzhiyun    (notice that this example uses a different machine - because it's
756*4882a593Smuzhiyun    using the -e option, you need to change the MACHINE in your
757*4882a593Smuzhiyun    local.conf):
758*4882a593Smuzhiyun
759*4882a593Smuzhiyun      $ wic create mkefidisk -e core-image-minimal
760*4882a593Smuzhiyun      Checking basic build environment...
761*4882a593Smuzhiyun      Done.
762*4882a593Smuzhiyun
763*4882a593Smuzhiyun      Creating image(s)...
764*4882a593Smuzhiyun
765*4882a593Smuzhiyun      Info: The new image(s) can be found here:
766*4882a593Smuzhiyun         /var/tmp/wic/build/mkefidisk-201309260027-sda.direct
767*4882a593Smuzhiyun
768*4882a593Smuzhiyun      ...
769*4882a593Smuzhiyun
770*4882a593Smuzhiyun    Here's an example that doesn't take the easy way out and manually
771*4882a593Smuzhiyun    specifies each build artifact, along with a non-canned .wks file,
772*4882a593Smuzhiyun    and also uses the -o option to have wic create the output
773*4882a593Smuzhiyun    somewhere other than the default /var/tmp/wic:
774*4882a593Smuzhiyun
775*4882a593Smuzhiyun      $ wic create ./test.wks -o ./out --rootfs-dir
776*4882a593Smuzhiyun      tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs
777*4882a593Smuzhiyun      --bootimg-dir tmp/sysroots/qemux86-64/usr/share
778*4882a593Smuzhiyun      --kernel-dir tmp/deploy/images/qemux86-64
779*4882a593Smuzhiyun      --native-sysroot tmp/sysroots/x86_64-linux
780*4882a593Smuzhiyun
781*4882a593Smuzhiyun     Creating image(s)...
782*4882a593Smuzhiyun
783*4882a593Smuzhiyun     Info: The new image(s) can be found here:
784*4882a593Smuzhiyun           out/build/test-201507211313-sda.direct
785*4882a593Smuzhiyun
786*4882a593Smuzhiyun     The following build artifacts were used to create the image(s):
787*4882a593Smuzhiyun       ROOTFS_DIR:                   tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs
788*4882a593Smuzhiyun       BOOTIMG_DIR:                  tmp/sysroots/qemux86-64/usr/share
789*4882a593Smuzhiyun       KERNEL_DIR:                   tmp/deploy/images/qemux86-64
790*4882a593Smuzhiyun       NATIVE_SYSROOT:               tmp/sysroots/x86_64-linux
791*4882a593Smuzhiyun
792*4882a593Smuzhiyun     The image(s) were created using OE kickstart file:
793*4882a593Smuzhiyun     ./test.wks
794*4882a593Smuzhiyun
795*4882a593Smuzhiyun     Here is a content of test.wks:
796*4882a593Smuzhiyun
797*4882a593Smuzhiyun     part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024
798*4882a593Smuzhiyun     part / --source rootfs --ondisk sda --fstype=ext3 --label platform --align 1024
799*4882a593Smuzhiyun
800*4882a593Smuzhiyun     bootloader  --timeout=0  --append="rootwait rootfstype=ext3 video=vesafb vga=0x318 console=tty0"
801*4882a593Smuzhiyun
802*4882a593Smuzhiyun
803*4882a593Smuzhiyun    Finally, here's an example of the actual partition language
804*4882a593Smuzhiyun    commands used to generate the mkefidisk image i.e. these are the
805*4882a593Smuzhiyun    contents of the mkefidisk.wks OE kickstart file:
806*4882a593Smuzhiyun
807*4882a593Smuzhiyun      # short-description: Create an EFI disk image
808*4882a593Smuzhiyun      # long-description: Creates a partitioned EFI disk image that the user
809*4882a593Smuzhiyun      # can directly dd to boot media.
810*4882a593Smuzhiyun
811*4882a593Smuzhiyun      part /boot --source bootimg-efi --ondisk sda --fstype=efi --active
812*4882a593Smuzhiyun
813*4882a593Smuzhiyun      part / --source rootfs --ondisk sda --fstype=ext3 --label platform
814*4882a593Smuzhiyun
815*4882a593Smuzhiyun      part swap --ondisk sda --size 44 --label swap1 --fstype=swap
816*4882a593Smuzhiyun
817*4882a593Smuzhiyun      bootloader  --timeout=10  --append="rootwait console=ttyPCH0,115200"
818*4882a593Smuzhiyun
819*4882a593Smuzhiyun    You can get a complete listing and description of all the
820*4882a593Smuzhiyun    kickstart commands available for use in .wks files from 'wic help
821*4882a593Smuzhiyun    kickstart'.
822*4882a593Smuzhiyun"""
823*4882a593Smuzhiyun
824*4882a593Smuzhiyunwic_kickstart_help = """
825*4882a593Smuzhiyun
826*4882a593SmuzhiyunNAME
827*4882a593Smuzhiyun    wic kickstart - wic kickstart reference
828*4882a593Smuzhiyun
829*4882a593SmuzhiyunDESCRIPTION
830*4882a593Smuzhiyun    This section provides the definitive reference to the wic
831*4882a593Smuzhiyun    kickstart language.  It also provides documentation on the list of
832*4882a593Smuzhiyun    --source plugins available for use from the 'part' command (see
833*4882a593Smuzhiyun    the 'Platform-specific Plugins' section below).
834*4882a593Smuzhiyun
835*4882a593Smuzhiyun    The current wic implementation supports only the basic kickstart
836*4882a593Smuzhiyun    partitioning commands: partition (or part for short) and
837*4882a593Smuzhiyun    bootloader.
838*4882a593Smuzhiyun
839*4882a593Smuzhiyun    The following is a listing of the commands, their syntax, and
840*4882a593Smuzhiyun    meanings. The commands are based on the Fedora kickstart
841*4882a593Smuzhiyun    documentation but with modifications to reflect wic capabilities.
842*4882a593Smuzhiyun
843*4882a593Smuzhiyun      https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#part-or-partition
844*4882a593Smuzhiyun      https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#bootloader
845*4882a593Smuzhiyun
846*4882a593Smuzhiyun  Commands
847*4882a593Smuzhiyun
848*4882a593Smuzhiyun    * 'part' or 'partition'
849*4882a593Smuzhiyun
850*4882a593Smuzhiyun       This command creates a partition on the system and uses the
851*4882a593Smuzhiyun       following syntax:
852*4882a593Smuzhiyun
853*4882a593Smuzhiyun         part [<mountpoint>]
854*4882a593Smuzhiyun
855*4882a593Smuzhiyun       The <mountpoint> is where the partition will be mounted and
856*4882a593Smuzhiyun       must take of one of the following forms:
857*4882a593Smuzhiyun
858*4882a593Smuzhiyun         /<path>: For example: /, /usr, or /home
859*4882a593Smuzhiyun
860*4882a593Smuzhiyun         swap: The partition will be used as swap space.
861*4882a593Smuzhiyun
862*4882a593Smuzhiyun       If a <mountpoint> is not specified the partition will be created
863*4882a593Smuzhiyun       but will not be mounted.
864*4882a593Smuzhiyun
865*4882a593Smuzhiyun       Partitions with a <mountpoint> specified will be automatically mounted.
866*4882a593Smuzhiyun       This is achieved by wic adding entries to the fstab during image
867*4882a593Smuzhiyun       generation. In order for a valid fstab to be generated one of the
868*4882a593Smuzhiyun       --ondrive, --ondisk, --use-uuid or --use-label partition options must
869*4882a593Smuzhiyun       be used for each partition that specifies a mountpoint.  Note that with
870*4882a593Smuzhiyun       --use-{uuid,label} and non-root <mountpoint>, including swap, the mount
871*4882a593Smuzhiyun       program must understand the PARTUUID or LABEL syntax.  This currently
872*4882a593Smuzhiyun       excludes the busybox versions of these applications.
873*4882a593Smuzhiyun
874*4882a593Smuzhiyun
875*4882a593Smuzhiyun       The following are supported 'part' options:
876*4882a593Smuzhiyun
877*4882a593Smuzhiyun         --size: The minimum partition size. Specify an integer value
878*4882a593Smuzhiyun                 such as 500. Multipliers k, M ang G can be used. If
879*4882a593Smuzhiyun                 not specified, the size is in MB.
880*4882a593Smuzhiyun                 You do not need this option if you use --source.
881*4882a593Smuzhiyun
882*4882a593Smuzhiyun         --fixed-size: Exact partition size. Value format is the same
883*4882a593Smuzhiyun                       as for --size option. This option cannot be
884*4882a593Smuzhiyun                       specified along with --size. If partition data
885*4882a593Smuzhiyun                       is larger than --fixed-size and error will be
886*4882a593Smuzhiyun                       raised when assembling disk image.
887*4882a593Smuzhiyun
888*4882a593Smuzhiyun         --source: This option is a wic-specific option that names the
889*4882a593Smuzhiyun                   source of the data that will populate the
890*4882a593Smuzhiyun                   partition.  The most common value for this option
891*4882a593Smuzhiyun                   is 'rootfs', but can be any value which maps to a
892*4882a593Smuzhiyun                   valid 'source plugin' (see 'wic help plugins').
893*4882a593Smuzhiyun
894*4882a593Smuzhiyun                   If '--source rootfs' is used, it tells the wic
895*4882a593Smuzhiyun                   command to create a partition as large as needed
896*4882a593Smuzhiyun                   and to fill it with the contents of the root
897*4882a593Smuzhiyun                   filesystem pointed to by the '-r' wic command-line
898*4882a593Smuzhiyun                   option (or the equivalent rootfs derived from the
899*4882a593Smuzhiyun                   '-e' command-line option).  The filesystem type
900*4882a593Smuzhiyun                   that will be used to create the partition is driven
901*4882a593Smuzhiyun                   by the value of the --fstype option specified for
902*4882a593Smuzhiyun                   the partition (see --fstype below).
903*4882a593Smuzhiyun
904*4882a593Smuzhiyun                   If --source <plugin-name>' is used, it tells the
905*4882a593Smuzhiyun                   wic command to create a partition as large as
906*4882a593Smuzhiyun                   needed and to fill with the contents of the
907*4882a593Smuzhiyun                   partition that will be generated by the specified
908*4882a593Smuzhiyun                   plugin name using the data pointed to by the '-r'
909*4882a593Smuzhiyun                   wic command-line option (or the equivalent rootfs
910*4882a593Smuzhiyun                   derived from the '-e' command-line option).
911*4882a593Smuzhiyun                   Exactly what those contents and filesystem type end
912*4882a593Smuzhiyun                   up being are dependent on the given plugin
913*4882a593Smuzhiyun                   implementation.
914*4882a593Smuzhiyun
915*4882a593Smuzhiyun                   If --source option is not used, the wic command
916*4882a593Smuzhiyun                   will create empty partition. --size parameter has
917*4882a593Smuzhiyun                   to be used to specify size of empty partition.
918*4882a593Smuzhiyun
919*4882a593Smuzhiyun         --ondisk or --ondrive: Forces the partition to be created on
920*4882a593Smuzhiyun                                a particular disk.
921*4882a593Smuzhiyun
922*4882a593Smuzhiyun         --fstype: Sets the file system type for the partition.  These
923*4882a593Smuzhiyun           apply to partitions created using '--source rootfs' (see
924*4882a593Smuzhiyun           --source above).  Valid values are:
925*4882a593Smuzhiyun
926*4882a593Smuzhiyun             vfat
927*4882a593Smuzhiyun             msdos
928*4882a593Smuzhiyun             ext2
929*4882a593Smuzhiyun             ext3
930*4882a593Smuzhiyun             ext4
931*4882a593Smuzhiyun             btrfs
932*4882a593Smuzhiyun             squashfs
933*4882a593Smuzhiyun             erofs
934*4882a593Smuzhiyun             swap
935*4882a593Smuzhiyun
936*4882a593Smuzhiyun         --fsoptions: Specifies a free-form string of options to be
937*4882a593Smuzhiyun                      used when mounting the filesystem. This string
938*4882a593Smuzhiyun                      will be copied into the /etc/fstab file of the
939*4882a593Smuzhiyun                      installed system and should be enclosed in
940*4882a593Smuzhiyun                      quotes.  If not specified, the default string is
941*4882a593Smuzhiyun                      "defaults".
942*4882a593Smuzhiyun
943*4882a593Smuzhiyun         --label label: Specifies the label to give to the filesystem
944*4882a593Smuzhiyun                        to be made on the partition. If the given
945*4882a593Smuzhiyun                        label is already in use by another filesystem,
946*4882a593Smuzhiyun                        a new label is created for the partition.
947*4882a593Smuzhiyun
948*4882a593Smuzhiyun         --use-label: This option is specific to wic. It makes wic to use the
949*4882a593Smuzhiyun                      label in /etc/fstab to specify a partition. If the
950*4882a593Smuzhiyun                      --use-label and --use-uuid are used at the same time,
951*4882a593Smuzhiyun                      we prefer the uuid because it is less likely to cause
952*4882a593Smuzhiyun                      name confliction. We don't support using this parameter
953*4882a593Smuzhiyun                      on the root partition since it requires an initramfs to
954*4882a593Smuzhiyun                      parse this value and we do not currently support that.
955*4882a593Smuzhiyun
956*4882a593Smuzhiyun         --active: Marks the partition as active.
957*4882a593Smuzhiyun
958*4882a593Smuzhiyun         --align (in KBytes): This option is specific to wic and says
959*4882a593Smuzhiyun                              to start a partition on an x KBytes
960*4882a593Smuzhiyun                              boundary.
961*4882a593Smuzhiyun
962*4882a593Smuzhiyun         --no-table: This option is specific to wic. Space will be
963*4882a593Smuzhiyun                     reserved for the partition and it will be
964*4882a593Smuzhiyun                     populated but it will not be added to the
965*4882a593Smuzhiyun                     partition table. It may be useful for
966*4882a593Smuzhiyun                     bootloaders.
967*4882a593Smuzhiyun
968*4882a593Smuzhiyun         --exclude-path: This option is specific to wic. It excludes the given
969*4882a593Smuzhiyun                         relative path from the resulting image. If the path
970*4882a593Smuzhiyun                         ends with a slash, only the content of the directory
971*4882a593Smuzhiyun                         is omitted, not the directory itself. This option only
972*4882a593Smuzhiyun                         has an effect with the rootfs source plugin.
973*4882a593Smuzhiyun
974*4882a593Smuzhiyun         --include-path: This option is specific to wic. It adds the contents
975*4882a593Smuzhiyun                         of the given path or a rootfs to the resulting image.
976*4882a593Smuzhiyun                         The option contains two fields, the origin and the
977*4882a593Smuzhiyun                         destination. When the origin is a rootfs, it follows
978*4882a593Smuzhiyun                         the same logic as the rootfs-dir argument and the
979*4882a593Smuzhiyun                         permissions and owners are kept. When the origin is a
980*4882a593Smuzhiyun                         path, it is relative to the directory in which wic is
981*4882a593Smuzhiyun                         running not the rootfs itself so use of an absolute
982*4882a593Smuzhiyun                         path is recommended, and the owner and group is set to
983*4882a593Smuzhiyun                         root:root. If no destination is given it is
984*4882a593Smuzhiyun                         automatically set to the root of the rootfs. This
985*4882a593Smuzhiyun                         option only has an effect with the rootfs source
986*4882a593Smuzhiyun                         plugin.
987*4882a593Smuzhiyun
988*4882a593Smuzhiyun         --change-directory: This option is specific to wic. It changes to the
989*4882a593Smuzhiyun                             given directory before copying the files. This
990*4882a593Smuzhiyun                             option is useful when we want to split a rootfs in
991*4882a593Smuzhiyun                             multiple partitions and we want to keep the right
992*4882a593Smuzhiyun                             permissions and usernames in all the partitions.
993*4882a593Smuzhiyun
994*4882a593Smuzhiyun         --no-fstab-update: This option is specific to wic. It does not update the
995*4882a593Smuzhiyun                            '/etc/fstab' stock file for the given partition.
996*4882a593Smuzhiyun
997*4882a593Smuzhiyun         --extra-space: This option is specific to wic. It adds extra
998*4882a593Smuzhiyun                        space after the space filled by the content
999*4882a593Smuzhiyun                        of the partition. The final size can go
1000*4882a593Smuzhiyun                        beyond the size specified by --size.
1001*4882a593Smuzhiyun                        By default, 10MB. This option cannot be used
1002*4882a593Smuzhiyun                        with --fixed-size option.
1003*4882a593Smuzhiyun
1004*4882a593Smuzhiyun         --overhead-factor: This option is specific to wic. The
1005*4882a593Smuzhiyun                            size of the partition is multiplied by
1006*4882a593Smuzhiyun                            this factor. It has to be greater than or
1007*4882a593Smuzhiyun                            equal to 1. The default value is 1.3.
1008*4882a593Smuzhiyun                            This option cannot be used with --fixed-size
1009*4882a593Smuzhiyun                            option.
1010*4882a593Smuzhiyun
1011*4882a593Smuzhiyun         --part-name: This option is specific to wic. It specifies name for GPT partitions.
1012*4882a593Smuzhiyun
1013*4882a593Smuzhiyun         --part-type: This option is specific to wic. It specifies partition
1014*4882a593Smuzhiyun                      type GUID for GPT partitions.
1015*4882a593Smuzhiyun                      List of partition type GUIDS can be found here:
1016*4882a593Smuzhiyun                      http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
1017*4882a593Smuzhiyun
1018*4882a593Smuzhiyun         --use-uuid: This option is specific to wic. It makes wic to generate
1019*4882a593Smuzhiyun                     random globally unique identifier (GUID) for the partition
1020*4882a593Smuzhiyun                     and use it in bootloader configuration to specify root partition.
1021*4882a593Smuzhiyun
1022*4882a593Smuzhiyun         --uuid: This option is specific to wic. It specifies partition UUID.
1023*4882a593Smuzhiyun                 It's useful if preconfigured partition UUID is added to kernel command line
1024*4882a593Smuzhiyun                 in bootloader configuration before running wic. In this case .wks file can
1025*4882a593Smuzhiyun                 be generated or modified to set preconfigured parition UUID using this option.
1026*4882a593Smuzhiyun
1027*4882a593Smuzhiyun         --fsuuid: This option is specific to wic. It specifies filesystem UUID.
1028*4882a593Smuzhiyun                   It's useful if preconfigured filesystem UUID is added to kernel command line
1029*4882a593Smuzhiyun                   in bootloader configuration before running wic. In this case .wks file can
1030*4882a593Smuzhiyun                   be generated or modified to set preconfigured filesystem UUID using this option.
1031*4882a593Smuzhiyun
1032*4882a593Smuzhiyun         --system-id: This option is specific to wic. It specifies partition system id. It's useful
1033*4882a593Smuzhiyun                      for the harware that requires non-default partition system ids. The parameter
1034*4882a593Smuzhiyun                      in one byte long hex number either with 0x prefix or without it.
1035*4882a593Smuzhiyun
1036*4882a593Smuzhiyun         --mkfs-extraopts: This option specifies extra options to pass to mkfs utility.
1037*4882a593Smuzhiyun                           NOTE, that wic uses default options for some filesystems, for example
1038*4882a593Smuzhiyun                           '-S 512' for mkfs.fat or '-F -i 8192' for mkfs.ext. Those options will
1039*4882a593Smuzhiyun                           not take effect when --mkfs-extraopts is used. This should be taken into
1040*4882a593Smuzhiyun                           account when using --mkfs-extraopts.
1041*4882a593Smuzhiyun
1042*4882a593Smuzhiyun    * bootloader
1043*4882a593Smuzhiyun
1044*4882a593Smuzhiyun      This command allows the user to specify various bootloader
1045*4882a593Smuzhiyun      options.  The following are supported 'bootloader' options:
1046*4882a593Smuzhiyun
1047*4882a593Smuzhiyun        --timeout: Specifies the number of seconds before the
1048*4882a593Smuzhiyun                   bootloader times out and boots the default option.
1049*4882a593Smuzhiyun
1050*4882a593Smuzhiyun        --append: Specifies kernel parameters. These will be added to
1051*4882a593Smuzhiyun                  bootloader command-line - for example, the syslinux
1052*4882a593Smuzhiyun                  APPEND or grub kernel command line.
1053*4882a593Smuzhiyun
1054*4882a593Smuzhiyun        --configfile: Specifies a user defined configuration file for
1055*4882a593Smuzhiyun                      the bootloader. This file must be located in the
1056*4882a593Smuzhiyun                      canned-wks folder or could be the full path to the
1057*4882a593Smuzhiyun                      file. Using this option will override any other
1058*4882a593Smuzhiyun                      bootloader option.
1059*4882a593Smuzhiyun
1060*4882a593Smuzhiyun      Note that bootloader functionality and boot partitions are
1061*4882a593Smuzhiyun      implemented by the various --source plugins that implement
1062*4882a593Smuzhiyun      bootloader functionality; the bootloader command essentially
1063*4882a593Smuzhiyun      provides a means of modifying bootloader configuration.
1064*4882a593Smuzhiyun
1065*4882a593Smuzhiyun    * include
1066*4882a593Smuzhiyun
1067*4882a593Smuzhiyun      This command allows the user to include the content of .wks file
1068*4882a593Smuzhiyun      into original .wks file.
1069*4882a593Smuzhiyun
1070*4882a593Smuzhiyun      Command uses the following syntax:
1071*4882a593Smuzhiyun
1072*4882a593Smuzhiyun         include <file>
1073*4882a593Smuzhiyun
1074*4882a593Smuzhiyun      The <file> is either path to the file or its name. If name is
1075*4882a593Smuzhiyun      specified wic will try to find file in the directories with canned
1076*4882a593Smuzhiyun      .wks files.
1077*4882a593Smuzhiyun
1078*4882a593Smuzhiyun"""
1079*4882a593Smuzhiyun
1080*4882a593Smuzhiyunwic_help_help = """
1081*4882a593SmuzhiyunNAME
1082*4882a593Smuzhiyun    wic help - display a help topic
1083*4882a593Smuzhiyun
1084*4882a593SmuzhiyunDESCRIPTION
1085*4882a593Smuzhiyun    Specify a help topic to display it. Topics are shown above.
1086*4882a593Smuzhiyun"""
1087*4882a593Smuzhiyun
1088*4882a593Smuzhiyun
1089*4882a593Smuzhiyunwic_help = """
1090*4882a593SmuzhiyunCreates a customized OpenEmbedded image.
1091*4882a593Smuzhiyun
1092*4882a593SmuzhiyunUsage:  wic [--version]
1093*4882a593Smuzhiyun        wic help [COMMAND or TOPIC]
1094*4882a593Smuzhiyun        wic COMMAND [ARGS]
1095*4882a593Smuzhiyun
1096*4882a593Smuzhiyun    usage 1: Returns the current version of Wic
1097*4882a593Smuzhiyun    usage 2: Returns detailed help for a COMMAND or TOPIC
1098*4882a593Smuzhiyun    usage 3: Executes COMMAND
1099*4882a593Smuzhiyun
1100*4882a593Smuzhiyun
1101*4882a593SmuzhiyunCOMMAND:
1102*4882a593Smuzhiyun
1103*4882a593Smuzhiyun    list   -   List available canned images and source plugins
1104*4882a593Smuzhiyun    ls     -   List contents of partitioned image or partition
1105*4882a593Smuzhiyun    rm     -   Remove files or directories from the vfat or ext* partitions
1106*4882a593Smuzhiyun    help   -   Show help for a wic COMMAND or TOPIC
1107*4882a593Smuzhiyun    write  -   Write an image to a device
1108*4882a593Smuzhiyun    cp     -   Copy files and directories to the vfat or ext* partitions
1109*4882a593Smuzhiyun    create -   Create a new OpenEmbedded image
1110*4882a593Smuzhiyun
1111*4882a593Smuzhiyun
1112*4882a593SmuzhiyunTOPIC:
1113*4882a593Smuzhiyun    overview  - Presents an overall overview of Wic
1114*4882a593Smuzhiyun    plugins   - Presents an overview and API for Wic plugins
1115*4882a593Smuzhiyun    kickstart - Presents a Wic kicstart file reference
1116*4882a593Smuzhiyun
1117*4882a593Smuzhiyun
1118*4882a593SmuzhiyunExamples:
1119*4882a593Smuzhiyun
1120*4882a593Smuzhiyun    $ wic --version
1121*4882a593Smuzhiyun
1122*4882a593Smuzhiyun    Returns the current version of Wic
1123*4882a593Smuzhiyun
1124*4882a593Smuzhiyun
1125*4882a593Smuzhiyun    $ wic help cp
1126*4882a593Smuzhiyun
1127*4882a593Smuzhiyun    Returns the SYNOPSIS and DESCRIPTION for the Wic "cp" command.
1128*4882a593Smuzhiyun
1129*4882a593Smuzhiyun
1130*4882a593Smuzhiyun    $ wic list images
1131*4882a593Smuzhiyun
1132*4882a593Smuzhiyun    Returns the list of canned images (i.e. *.wks files located in
1133*4882a593Smuzhiyun    the /scripts/lib/wic/canned-wks directory.
1134*4882a593Smuzhiyun
1135*4882a593Smuzhiyun
1136*4882a593Smuzhiyun    $ wic create mkefidisk -e core-image-minimal
1137*4882a593Smuzhiyun
1138*4882a593Smuzhiyun    Creates an EFI disk image from artifacts used in a previous
1139*4882a593Smuzhiyun    core-image-minimal build in standard BitBake locations
1140*4882a593Smuzhiyun    (e.g. Cooked Mode).
1141*4882a593Smuzhiyun
1142*4882a593Smuzhiyun"""
1143