help.py 31 KB

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