help.py 31 KB

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