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