blob: d6e027d25360940847d38d3fda9b9b1bcdae8035 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001# ex:ts=4:sw=4:sts=4:et
2# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
3#
4# Copyright (c) 2013, Intel Corporation.
5# All rights reserved.
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19#
20# DESCRIPTION
21# This module implements some basic help invocation functions along
22# with the bulk of the help topic text for the OE Core Image Tools.
23#
24# AUTHORS
25# Tom Zanussi <tom.zanussi (at] linux.intel.com>
26#
27
28import subprocess
29import logging
30
Brad Bishop6e60e8b2018-02-01 10:27:11 -050031from wic.pluginbase import PluginMgr, PLUGIN_TYPES
32
33logger = logging.getLogger('wic')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034
35def subcommand_error(args):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050036 logger.info("invalid subcommand %s", args[0])
Patrick Williamsc124f4f2015-09-15 14:41:29 -050037
38
39def display_help(subcommand, subcommands):
40 """
41 Display help for subcommand.
42 """
43 if subcommand not in subcommands:
44 return False
45
46 hlp = subcommands.get(subcommand, subcommand_error)[2]
47 if callable(hlp):
48 hlp = hlp()
49 pager = subprocess.Popen('less', stdin=subprocess.PIPE)
Patrick Williamsc0f7c042017-02-23 20:41:17 -060050 pager.communicate(hlp.encode('utf-8'))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051
52 return True
53
54
55def wic_help(args, usage_str, subcommands):
56 """
57 Subcommand help dispatcher.
58 """
59 if len(args) == 1 or not display_help(args[1], subcommands):
Patrick Williamsc0f7c042017-02-23 20:41:17 -060060 print(usage_str)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061
62
63def get_wic_plugins_help():
64 """
65 Combine wic_plugins_help with the help for every known
66 source plugin.
67 """
68 result = wic_plugins_help
69 for plugin_type in PLUGIN_TYPES:
70 result += '\n\n%s PLUGINS\n\n' % plugin_type.upper()
Brad Bishop6e60e8b2018-02-01 10:27:11 -050071 for name, plugin in PluginMgr.get_plugins(plugin_type).items():
Patrick Williamsc124f4f2015-09-15 14:41:29 -050072 result += "\n %s plugin:\n" % name
73 if plugin.__doc__:
74 result += plugin.__doc__
75 else:
76 result += "\n %s is missing docstring\n" % plugin
77 return result
78
79
80def invoke_subcommand(args, parser, main_command_usage, subcommands):
81 """
82 Dispatch to subcommand handler borrowed from combo-layer.
83 Should use argparse, but has to work in 2.6.
84 """
85 if not args:
Brad Bishop6e60e8b2018-02-01 10:27:11 -050086 logger.error("No subcommand specified, exiting")
Patrick Williamsc124f4f2015-09-15 14:41:29 -050087 parser.print_help()
88 return 1
89 elif args[0] == "help":
90 wic_help(args, main_command_usage, subcommands)
91 elif args[0] not in subcommands:
Brad Bishop6e60e8b2018-02-01 10:27:11 -050092 logger.error("Unsupported subcommand %s, exiting\n", args[0])
Patrick Williamsc124f4f2015-09-15 14:41:29 -050093 parser.print_help()
94 return 1
95 else:
96 usage = subcommands.get(args[0], subcommand_error)[1]
97 subcommands.get(args[0], subcommand_error)[0](args[1:], usage)
98
99
100##
101# wic help and usage strings
102##
103
104wic_usage = """
105
106 Create a customized OpenEmbedded image
107
108 usage: wic [--version] | [--help] | [COMMAND [ARGS]]
109
110 Current 'wic' commands are:
111 help Show help for command or one of the topics (see below)
112 create Create a new OpenEmbedded image
113 list List available canned images and source plugins
114
115 Help topics:
116 overview wic overview - General overview of wic
117 plugins wic plugins - Overview and API
118 kickstart wic kickstart - wic kickstart reference
119"""
120
121wic_help_usage = """
122
123 usage: wic help <subcommand>
124
125 This command displays detailed help for the specified subcommand.
126"""
127
128wic_create_usage = """
129
130 Create a new OpenEmbedded image
131
132 usage: wic create <wks file or image name> [-o <DIRNAME> | --outdir <DIRNAME>]
133 [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
134 [-e | --image-name] [-s, --skip-build-check] [-D, --debug]
135 [-r, --rootfs-dir] [-b, --bootimg-dir]
136 [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs]
137
138 This command creates an OpenEmbedded image based on the 'OE kickstart
139 commands' found in the <wks file>.
140
141 The -o option can be used to place the image in a directory with a
142 different name and location.
143
144 See 'wic help create' for more detailed instructions.
145"""
146
147wic_create_help = """
148
149NAME
150 wic create - Create a new OpenEmbedded image
151
152SYNOPSIS
153 wic create <wks file or image name> [-o <DIRNAME> | --outdir <DIRNAME>]
154 [-e | --image-name] [-s, --skip-build-check] [-D, --debug]
155 [-r, --rootfs-dir] [-b, --bootimg-dir]
156 [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs]
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600157 [-c, --compress-with] [-m, --bmap]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500158
159DESCRIPTION
160 This command creates an OpenEmbedded image based on the 'OE
161 kickstart commands' found in the <wks file>.
162
163 In order to do this, wic needs to know the locations of the
164 various build artifacts required to build the image.
165
166 Users can explicitly specify the build artifact locations using
167 the -r, -b, -k, and -n options. See below for details on where
168 the corresponding artifacts are typically found in a normal
169 OpenEmbedded build.
170
171 Alternatively, users can use the -e option to have 'wic' determine
172 those locations for a given image. If the -e option is used, the
173 user needs to have set the appropriate MACHINE variable in
174 local.conf, and have sourced the build environment.
175
176 The -e option is used to specify the name of the image to use the
177 artifacts from e.g. core-image-sato.
178
179 The -r option is used to specify the path to the /rootfs dir to
180 use as the .wks rootfs source.
181
182 The -b option is used to specify the path to the dir containing
183 the boot artifacts (e.g. /EFI or /syslinux dirs) to use as the
184 .wks bootimg source.
185
186 The -k option is used to specify the path to the dir containing
187 the kernel to use in the .wks bootimg.
188
189 The -n option is used to specify the path to the native sysroot
190 containing the tools to use to build the image.
191
192 The -f option is used to build rootfs by running "bitbake <image>"
193
194 The -s option is used to skip the build check. The build check is
195 a simple sanity check used to determine whether the user has
196 sourced the build environment so that the -e option can operate
197 correctly. If the user has specified the build artifact locations
198 explicitly, 'wic' assumes the user knows what he or she is doing
199 and skips the build check.
200
201 The -D option is used to display debug information detailing
202 exactly what happens behind the scenes when a create request is
203 fulfilled (or not, as the case may be). It enumerates and
204 displays the command sequence used, and should be included in any
205 bug report describing unexpected results.
206
207 When 'wic -e' is used, the locations for the build artifacts
208 values are determined by 'wic -e' from the output of the 'bitbake
209 -e' command given an image name e.g. 'core-image-minimal' and a
210 given machine set in local.conf. In that case, the image is
211 created as if the following 'bitbake -e' variables were used:
212
213 -r: IMAGE_ROOTFS
214 -k: STAGING_KERNEL_DIR
215 -n: STAGING_DIR_NATIVE
216 -b: empty (plugin-specific handlers must determine this)
217
218 If 'wic -e' is not used, the user needs to select the appropriate
219 value for -b (as well as -r, -k, and -n).
220
221 The -o option can be used to place the image in a directory with a
222 different name and location.
223
224 The -c option is used to specify compressor utility to compress
225 an image. gzip, bzip2 and xz compressors are supported.
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600226
227 The -m option is used to produce .bmap file for the image. This file
228 can be used to flash image using bmaptool utility.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500229"""
230
231wic_list_usage = """
232
233 List available OpenEmbedded images and source plugins
234
235 usage: wic list images
236 wic list <image> help
237 wic list source-plugins
238
239 This command enumerates the set of available canned images as well as
240 help for those images. It also can be used to list of available source
241 plugins.
242
243 The first form enumerates all the available 'canned' images.
244
245 The second form lists the detailed help information for a specific
246 'canned' image.
247
248 The third form enumerates all the available --sources (source
249 plugins).
250
251 See 'wic help list' for more details.
252"""
253
254wic_list_help = """
255
256NAME
257 wic list - List available OpenEmbedded images and source plugins
258
259SYNOPSIS
260 wic list images
261 wic list <image> help
262 wic list source-plugins
263
264DESCRIPTION
265 This command enumerates the set of available canned images as well
266 as help for those images. It also can be used to list available
267 source plugins.
268
269 The first form enumerates all the available 'canned' images.
270 These are actually just the set of .wks files that have been moved
271 into the /scripts/lib/wic/canned-wks directory).
272
273 The second form lists the detailed help information for a specific
274 'canned' image.
275
276 The third form enumerates all the available --sources (source
277 plugins). The contents of a given partition are driven by code
278 defined in 'source plugins'. Users specify a specific plugin via
279 the --source parameter of the partition .wks command. Normally
280 this is the 'rootfs' plugin but can be any of the more specialized
281 sources listed by the 'list source-plugins' command. Users can
282 also add their own source plugins - see 'wic help plugins' for
283 details.
284"""
285
286wic_plugins_help = """
287
288NAME
289 wic plugins - Overview and API
290
291DESCRIPTION
292 plugins allow wic functionality to be extended and specialized by
293 users. This section documents the plugin interface, which is
294 currently restricted to 'source' plugins.
295
296 'Source' plugins provide a mechanism to customize various aspects
297 of the image generation process in wic, mainly the contents of
298 partitions.
299
300 Source plugins provide a mechanism for mapping values specified in
301 .wks files using the --source keyword to a particular plugin
302 implementation that populates a corresponding partition.
303
304 A source plugin is created as a subclass of SourcePlugin (see
305 scripts/lib/wic/pluginbase.py) and the plugin file containing it
306 is added to scripts/lib/wic/plugins/source/ to make the plugin
307 implementation available to the wic implementation.
308
309 Source plugins can also be implemented and added by external
310 layers - any plugins found in a scripts/lib/wic/plugins/source/
311 directory in an external layer will also be made available.
312
313 When the wic implementation needs to invoke a partition-specific
314 implementation, it looks for the plugin that has the same name as
315 the --source param given to that partition. For example, if the
316 partition is set up like this:
317
318 part /boot --source bootimg-pcbios ...
319
320 then the methods defined as class members of the plugin having the
321 matching bootimg-pcbios .name class member would be used.
322
323 To be more concrete, here's the plugin definition that would match
324 a '--source bootimg-pcbios' usage, along with an example method
325 that would be called by the wic implementation when it needed to
326 invoke an implementation-specific partition-preparation function:
327
328 class BootimgPcbiosPlugin(SourcePlugin):
329 name = 'bootimg-pcbios'
330
331 @classmethod
332 def do_prepare_partition(self, part, ...)
333
334 If the subclass itself doesn't implement a function, a 'default'
335 version in a superclass will be located and used, which is why all
336 plugins must be derived from SourcePlugin.
337
338 The SourcePlugin class defines the following methods, which is the
339 current set of methods that can be implemented/overridden by
340 --source plugins. Any methods not implemented by a SourcePlugin
341 subclass inherit the implementations present in the SourcePlugin
342 class (see the SourcePlugin source for details):
343
344 do_prepare_partition()
345 Called to do the actual content population for a
346 partition. In other words, it 'prepares' the final partition
347 image which will be incorporated into the disk image.
348
349 do_configure_partition()
350 Called before do_prepare_partition(), typically used to
351 create custom configuration files for a partition, for
352 example syslinux or grub config files.
353
354 do_install_disk()
355 Called after all partitions have been prepared and assembled
356 into a disk image. This provides a hook to allow
357 finalization of a disk image, for example to write an MBR to
358 it.
359
360 do_stage_partition()
361 Special content-staging hook called before
362 do_prepare_partition(), normally empty.
363
364 Typically, a partition will just use the passed-in
365 parameters, for example the unmodified value of bootimg_dir.
366 In some cases however, things may need to be more tailored.
367 As an example, certain files may additionally need to be
368 take from bootimg_dir + /boot. This hook allows those files
369 to be staged in a customized fashion. Note that
370 get_bitbake_var() allows you to access non-standard
371 variables that you might want to use for these types of
372 situations.
373
374 This scheme is extensible - adding more hooks is a simple matter
375 of adding more plugin methods to SourcePlugin and derived classes.
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500376 Please see the implementation for details.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500377"""
378
379wic_overview_help = """
380
381NAME
382 wic overview - General overview of wic
383
384DESCRIPTION
385 The 'wic' command generates partitioned images from existing
386 OpenEmbedded build artifacts. Image generation is driven by
387 partitioning commands contained in an 'Openembedded kickstart'
388 (.wks) file (see 'wic help kickstart') specified either directly
389 on the command-line or as one of a selection of canned .wks files
390 (see 'wic list images'). When applied to a given set of build
391 artifacts, the result is an image or set of images that can be
392 directly written onto media and used on a particular system.
393
394 The 'wic' command and the infrastructure it's based on is by
395 definition incomplete - its purpose is to allow the generation of
396 customized images, and as such was designed to be completely
397 extensible via a plugin interface (see 'wic help plugins').
398
399 Background and Motivation
400
401 wic is meant to be a completely independent standalone utility
402 that initially provides easier-to-use and more flexible
403 replacements for a couple bits of existing functionality in
404 oe-core: directdisk.bbclass and mkefidisk.sh. The difference
405 between wic and those examples is that with wic the functionality
406 of those scripts is implemented by a general-purpose partitioning
407 'language' based on Redhat kickstart syntax).
408
409 The initial motivation and design considerations that lead to the
410 current tool are described exhaustively in Yocto Bug #3847
411 (https://bugzilla.yoctoproject.org/show_bug.cgi?id=3847).
412
413 Implementation and Examples
414
415 wic can be used in two different modes, depending on how much
416 control the user needs in specifying the Openembedded build
417 artifacts that will be used in creating the image: 'raw' and
418 'cooked'.
419
420 If used in 'raw' mode, artifacts are explicitly specified via
421 command-line arguments (see example below).
422
423 The more easily usable 'cooked' mode uses the current MACHINE
424 setting and a specified image name to automatically locate the
425 artifacts used to create the image.
426
427 OE kickstart files (.wks) can of course be specified directly on
428 the command-line, but the user can also choose from a set of
429 'canned' .wks files available via the 'wic list images' command
430 (example below).
431
432 In any case, the prerequisite for generating any image is to have
433 the build artifacts already available. The below examples assume
434 the user has already build a 'core-image-minimal' for a specific
435 machine (future versions won't require this redundant step, but
436 for now that's typically how build artifacts get generated).
437
438 The other prerequisite is to source the build environment:
439
440 $ source oe-init-build-env
441
442 To start out with, we'll generate an image from one of the canned
443 .wks files. The following generates a list of availailable
444 images:
445
446 $ wic list images
447 mkefidisk Create an EFI disk image
448 directdisk Create a 'pcbios' direct disk image
449
450 You can get more information about any of the available images by
451 typing 'wic list xxx help', where 'xxx' is one of the image names:
452
453 $ wic list mkefidisk help
454
455 Creates a partitioned EFI disk image that the user can directly dd
456 to boot media.
457
458 At any time, you can get help on the 'wic' command or any
459 subcommand (currently 'list' and 'create'). For instance, to get
460 the description of 'wic create' command and its parameters:
461
462 $ wic create
463
464 Usage:
465
466 Create a new OpenEmbedded image
467
468 usage: wic create <wks file or image name> [-o <DIRNAME> | ...]
469 [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
470 [-e | --image-name] [-s, --skip-build-check] [-D, --debug]
471 [-r, --rootfs-dir] [-b, --bootimg-dir] [-k, --kernel-dir]
472 [-n, --native-sysroot] [-f, --build-rootfs]
473
474 This command creates an OpenEmbedded image based on the 'OE
475 kickstart commands' found in the <wks file>.
476
477 The -o option can be used to place the image in a directory
478 with a different name and location.
479
480 See 'wic help create' for more detailed instructions.
481 ...
482
483 As mentioned in the command, you can get even more detailed
484 information by adding 'help' to the above:
485
486 $ wic help create
487
488 So, the easiest way to create an image is to use the -e option
489 with a canned .wks file. To use the -e option, you need to
490 specify the image used to generate the artifacts and you actually
491 need to have the MACHINE used to build them specified in your
492 local.conf (these requirements aren't necessary if you aren't
493 using the -e options.) Below, we generate a directdisk image,
494 pointing the process at the core-image-minimal artifacts for the
495 current MACHINE:
496
497 $ wic create directdisk -e core-image-minimal
498
499 Checking basic build environment...
500 Done.
501
502 Creating image(s)...
503
504 Info: The new image(s) can be found here:
505 /var/tmp/wic/build/directdisk-201309252350-sda.direct
506
507 The following build artifacts were used to create the image(s):
508
509 ROOTFS_DIR: ...
510 BOOTIMG_DIR: ...
511 KERNEL_DIR: ...
512 NATIVE_SYSROOT: ...
513
514 The image(s) were created using OE kickstart file:
515 .../scripts/lib/wic/canned-wks/directdisk.wks
516
517 The output shows the name and location of the image created, and
518 so that you know exactly what was used to generate the image, each
519 of the artifacts and the kickstart file used.
520
521 Similarly, you can create a 'mkefidisk' image in the same way
522 (notice that this example uses a different machine - because it's
523 using the -e option, you need to change the MACHINE in your
524 local.conf):
525
526 $ wic create mkefidisk -e core-image-minimal
527 Checking basic build environment...
528 Done.
529
530 Creating image(s)...
531
532 Info: The new image(s) can be found here:
533 /var/tmp/wic/build/mkefidisk-201309260027-sda.direct
534
535 ...
536
537 Here's an example that doesn't take the easy way out and manually
538 specifies each build artifact, along with a non-canned .wks file,
539 and also uses the -o option to have wic create the output
540 somewhere other than the default /var/tmp/wic:
541
542 $ wic create ./test.wks -o ./out --rootfs-dir
543 tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs
544 --bootimg-dir tmp/sysroots/qemux86-64/usr/share
545 --kernel-dir tmp/deploy/images/qemux86-64
546 --native-sysroot tmp/sysroots/x86_64-linux
547
548 Creating image(s)...
549
550 Info: The new image(s) can be found here:
551 out/build/test-201507211313-sda.direct
552
553 The following build artifacts were used to create the image(s):
554 ROOTFS_DIR: tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs
555 BOOTIMG_DIR: tmp/sysroots/qemux86-64/usr/share
556 KERNEL_DIR: tmp/deploy/images/qemux86-64
557 NATIVE_SYSROOT: tmp/sysroots/x86_64-linux
558
559 The image(s) were created using OE kickstart file:
560 ./test.wks
561
562 Here is a content of test.wks:
563
564 part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024
565 part / --source rootfs --ondisk sda --fstype=ext3 --label platform --align 1024
566
567 bootloader --timeout=0 --append="rootwait rootfstype=ext3 video=vesafb vga=0x318 console=tty0"
568
569
570 Finally, here's an example of the actual partition language
571 commands used to generate the mkefidisk image i.e. these are the
572 contents of the mkefidisk.wks OE kickstart file:
573
574 # short-description: Create an EFI disk image
575 # long-description: Creates a partitioned EFI disk image that the user
576 # can directly dd to boot media.
577
578 part /boot --source bootimg-efi --ondisk sda --fstype=efi --active
579
580 part / --source rootfs --ondisk sda --fstype=ext3 --label platform
581
582 part swap --ondisk sda --size 44 --label swap1 --fstype=swap
583
584 bootloader --timeout=10 --append="rootwait console=ttyPCH0,115200"
585
586 You can get a complete listing and description of all the
587 kickstart commands available for use in .wks files from 'wic help
588 kickstart'.
589"""
590
591wic_kickstart_help = """
592
593NAME
594 wic kickstart - wic kickstart reference
595
596DESCRIPTION
597 This section provides the definitive reference to the wic
598 kickstart language. It also provides documentation on the list of
599 --source plugins available for use from the 'part' command (see
600 the 'Platform-specific Plugins' section below).
601
602 The current wic implementation supports only the basic kickstart
603 partitioning commands: partition (or part for short) and
604 bootloader.
605
606 The following is a listing of the commands, their syntax, and
607 meanings. The commands are based on the Fedora kickstart
608 documentation but with modifications to reflect wic capabilities.
609
610 http://fedoraproject.org/wiki/Anaconda/Kickstart#part_or_partition
611 http://fedoraproject.org/wiki/Anaconda/Kickstart#bootloader
612
613 Commands
614
615 * 'part' or 'partition'
616
617 This command creates a partition on the system and uses the
618 following syntax:
619
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500620 part [<mountpoint>]
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500621
622 The <mountpoint> is where the partition will be mounted and
623 must take of one of the following forms:
624
625 /<path>: For example: /, /usr, or /home
626
627 swap: The partition will be used as swap space.
628
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500629 If a <mountpoint> is not specified the partition will be created
630 but will not be mounted.
631
632 Partitions with a <mountpoint> specified will be automatically mounted.
633 This is achieved by wic adding entries to the fstab during image
634 generation. In order for a valid fstab to be generated one of the
635 --ondrive, --ondisk or --use-uuid partition options must be used for
636 each partition that specifies a mountpoint.
637
638
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500639 The following are supported 'part' options:
640
641 --size: The minimum partition size. Specify an integer value
642 such as 500. Multipliers k, M ang G can be used. If
643 not specified, the size is in MB.
644 You do not need this option if you use --source.
645
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500646 --fixed-size: Exact partition size. Value format is the same
647 as for --size option. This option cannot be
648 specified along with --size. If partition data
649 is larger than --fixed-size and error will be
650 raised when assembling disk image.
651
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500652 --source: This option is a wic-specific option that names the
653 source of the data that will populate the
654 partition. The most common value for this option
655 is 'rootfs', but can be any value which maps to a
656 valid 'source plugin' (see 'wic help plugins').
657
658 If '--source rootfs' is used, it tells the wic
659 command to create a partition as large as needed
660 and to fill it with the contents of the root
661 filesystem pointed to by the '-r' wic command-line
662 option (or the equivalent rootfs derived from the
663 '-e' command-line option). The filesystem type
664 that will be used to create the partition is driven
665 by the value of the --fstype option specified for
666 the partition (see --fstype below).
667
668 If --source <plugin-name>' is used, it tells the
669 wic command to create a partition as large as
670 needed and to fill with the contents of the
671 partition that will be generated by the specified
672 plugin name using the data pointed to by the '-r'
673 wic command-line option (or the equivalent rootfs
674 derived from the '-e' command-line option).
675 Exactly what those contents and filesystem type end
676 up being are dependent on the given plugin
677 implementation.
678
679 If --source option is not used, the wic command
680 will create empty partition. --size parameter has
681 to be used to specify size of empty partition.
682
683 --ondisk or --ondrive: Forces the partition to be created on
684 a particular disk.
685
686 --fstype: Sets the file system type for the partition. These
687 apply to partitions created using '--source rootfs' (see
688 --source above). Valid values are:
689
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500690 vfat
691 msdos
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500692 ext2
693 ext3
694 ext4
695 btrfs
696 squashfs
697 swap
698
699 --fsoptions: Specifies a free-form string of options to be
700 used when mounting the filesystem. This string
701 will be copied into the /etc/fstab file of the
702 installed system and should be enclosed in
703 quotes. If not specified, the default string is
704 "defaults".
705
706 --label label: Specifies the label to give to the filesystem
707 to be made on the partition. If the given
708 label is already in use by another filesystem,
709 a new label is created for the partition.
710
711 --active: Marks the partition as active.
712
713 --align (in KBytes): This option is specific to wic and says
714 to start a partition on an x KBytes
715 boundary.
716
717 --no-table: This option is specific to wic. Space will be
718 reserved for the partition and it will be
719 populated but it will not be added to the
720 partition table. It may be useful for
721 bootloaders.
722
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500723 --exclude-path: This option is specific to wic. It excludes the given
724 relative path from the resulting image. If the path
725 ends with a slash, only the content of the directory
726 is omitted, not the directory itself. This option only
727 has an effect with the rootfs source plugin.
728
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500729 --extra-space: This option is specific to wic. It adds extra
730 space after the space filled by the content
731 of the partition. The final size can go
732 beyond the size specified by --size.
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500733 By default, 10MB. This option cannot be used
734 with --fixed-size option.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500735
736 --overhead-factor: This option is specific to wic. The
737 size of the partition is multiplied by
738 this factor. It has to be greater than or
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500739 equal to 1. The default value is 1.3.
740 This option cannot be used with --fixed-size
741 option.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500742
743 --part-type: This option is specific to wic. It specifies partition
744 type GUID for GPT partitions.
745 List of partition type GUIDS can be found here:
746 http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
747
748 --use-uuid: This option is specific to wic. It makes wic to generate
749 random globally unique identifier (GUID) for the partition
750 and use it in bootloader configuration to specify root partition.
751
752 --uuid: This option is specific to wic. It specifies partition UUID.
753 It's useful if preconfigured partition UUID is added to kernel command line
754 in bootloader configuration before running wic. In this case .wks file can
755 be generated or modified to set preconfigured parition UUID using this option.
756
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600757 --system-id: This option is specific to wic. It specifies partition system id. It's useful
758 for the harware that requires non-default partition system ids. The parameter
759 in one byte long hex number either with 0x prefix or without it.
760
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500761 * bootloader
762
763 This command allows the user to specify various bootloader
764 options. The following are supported 'bootloader' options:
765
766 --timeout: Specifies the number of seconds before the
767 bootloader times out and boots the default option.
768
769 --append: Specifies kernel parameters. These will be added to
770 bootloader command-line - for example, the syslinux
771 APPEND or grub kernel command line.
772
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500773 --configfile: Specifies a user defined configuration file for
774 the bootloader. This file must be located in the
775 canned-wks folder or could be the full path to the
776 file. Using this option will override any other
777 bootloader option.
778
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500779 Note that bootloader functionality and boot partitions are
780 implemented by the various --source plugins that implement
781 bootloader functionality; the bootloader command essentially
782 provides a means of modifying bootloader configuration.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500783
784 * include
785
786 This command allows the user to include the content of .wks file
787 into original .wks file.
788
789 Command uses the following syntax:
790
791 include <file>
792
793 The <file> is either path to the file or its name. If name is
794 specified wic will try to find file in the directories with canned
795 .wks files.
796
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500797"""