diff options
| author | Tom Zanussi <tom.zanussi@linux.intel.com> | 2014-07-07 16:05:44 -0500 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-10 17:38:34 +0100 |
| commit | d8ef35557e2ff9ac80cbfa471c675405ead9c69c (patch) | |
| tree | 7813c8fecd615449a8cefcaf5effe4de7ee0c98e /scripts/lib/image/help.py | |
| parent | f2ab61968129c6c15b0a61968a7761ccce5a469a (diff) | |
| download | poky-d8ef35557e2ff9ac80cbfa471c675405ead9c69c.tar.gz | |
wic: Add general 'plugins' help topic
Add a category for help topics with an initial help topic discussing
source plugins.
(From OE-Core rev: a3dbe46dd28a6fd9e6c21f6bbb6a12578df9dff3)
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/image/help.py')
| -rw-r--r-- | scripts/lib/image/help.py | 101 |
1 files changed, 100 insertions, 1 deletions
diff --git a/scripts/lib/image/help.py b/scripts/lib/image/help.py index 6de7ab023e..a4f27ab68e 100644 --- a/scripts/lib/image/help.py +++ b/scripts/lib/image/help.py | |||
| @@ -87,7 +87,11 @@ wic_usage = """ | |||
| 87 | create Create a new OpenEmbedded image | 87 | create Create a new OpenEmbedded image |
| 88 | list List available values for options and image properties | 88 | list List available values for options and image properties |
| 89 | 89 | ||
| 90 | See 'wic help COMMAND' for more information on a specific command. | 90 | Help topics: |
| 91 | plugins wic plugins - Overview and API | ||
| 92 | |||
| 93 | See 'wic help <COMMAND or HELP TOPIC>' for more information on a specific | ||
| 94 | command or help topic. | ||
| 91 | """ | 95 | """ |
| 92 | 96 | ||
| 93 | wic_help_usage = """ | 97 | wic_help_usage = """ |
| @@ -323,3 +327,98 @@ DESCRIPTION | |||
| 323 | ["offset", "offset of the partition within the image"] | 327 | ["offset", "offset of the partition within the image"] |
| 324 | 328 | ||
| 325 | """ | 329 | """ |
| 330 | |||
| 331 | wic_plugins_help = """ | ||
| 332 | |||
| 333 | NAME | ||
| 334 | wic plugins - Overview and API | ||
| 335 | |||
| 336 | DESCRIPTION | ||
| 337 | plugins allow wic functionality to be extended and specialized by | ||
| 338 | users. This section documents the plugin interface, which is | ||
| 339 | currently restricted to 'source' plugins. | ||
| 340 | |||
| 341 | 'Source' plugins provide a mechanism to customize various aspects | ||
| 342 | of the image generation process in wic, mainly the contents of | ||
| 343 | partitions. | ||
| 344 | |||
| 345 | Source plugins provide a mechanism for mapping values specified in | ||
| 346 | .wks files using the --source keyword to a particular plugin | ||
| 347 | implementation that populates a corresponding partition. | ||
| 348 | |||
| 349 | A source plugin is created as a subclass of SourcePlugin (see | ||
| 350 | scripts/lib/mic/pluginbase.py) and the plugin file containing it | ||
| 351 | is added to scripts/lib/mic/plugins/source/ to make the plugin | ||
| 352 | implementation available to the wic implementation. | ||
| 353 | |||
| 354 | Source plugins can also be implemented and added by external | ||
| 355 | layers - any plugins found in a scripts/lib/mic/plugins/source/ | ||
| 356 | directory in an external layer will also be made available. | ||
| 357 | |||
| 358 | When the wic implementation needs to invoke a partition-specific | ||
| 359 | implementation, it looks for the plugin that has the same name as | ||
| 360 | the --source param given to that partition. For example, if the | ||
| 361 | partition is set up like this: | ||
| 362 | |||
| 363 | part /boot --source bootimg-pcbios ... | ||
| 364 | |||
| 365 | then the methods defined as class members of the plugin having the | ||
| 366 | matching bootimg-pcbios .name class member would be used. | ||
| 367 | |||
| 368 | To be more concrete, here's the plugin definition that would match | ||
| 369 | a '--source bootimg-pcbios' usage, along with an example method | ||
| 370 | that would be called by the wic implementation when it needed to | ||
| 371 | invoke an implementation-specific partition-preparation function: | ||
| 372 | |||
| 373 | class BootimgPcbiosPlugin(SourcePlugin): | ||
| 374 | name = 'bootimg-pcbios' | ||
| 375 | |||
| 376 | @classmethod | ||
| 377 | def do_prepare_partition(self, part, ...) | ||
| 378 | |||
| 379 | If the subclass itself doesn't implement a function, a 'default' | ||
| 380 | version in a superclass will be located and used, which is why all | ||
| 381 | plugins must be derived from SourcePlugin. | ||
| 382 | |||
| 383 | The SourcePlugin class defines the following methods, which is the | ||
| 384 | current set of methods that can be implemented/overridden by | ||
| 385 | --source plugins. Any methods not implemented by a SourcePlugin | ||
| 386 | subclass inherit the implementations present in the SourcePlugin | ||
| 387 | class (see the SourcePlugin source for details): | ||
| 388 | |||
| 389 | do_prepare_partition() | ||
| 390 | Called to do the actual content population for a partition | ||
| 391 | i.e. it 'prepares' the final partition image which will be | ||
| 392 | incorporated into the disk image. | ||
| 393 | |||
| 394 | do_configure_partition() | ||
| 395 | Called before do_prepare_partition(), typically used to | ||
| 396 | create custom configuration files for a partition, for | ||
| 397 | example syslinux or grub config files. | ||
| 398 | |||
| 399 | do_install_disk() | ||
| 400 | Called after all partitions have been prepared and assembled | ||
| 401 | into a disk image. This provides a hook to allow | ||
| 402 | finalization of a disk image e.g. to write an MBR to it. | ||
| 403 | |||
| 404 | do_stage_partition() | ||
| 405 | Special content staging hook called before | ||
| 406 | do_prepare_partition(), normally empty. | ||
| 407 | |||
| 408 | Typically, a partition will just use the passed-in parame | ||
| 409 | e.g straight bootimg_dir, etc, but in some cases, things | ||
| 410 | need to be more tailored e.g. to use a deploy dir + /boot, | ||
| 411 | etc. This hook allows those files to be staged in a | ||
| 412 | customized fashion. Not that get_bitbake_var() allows you | ||
| 413 | to acces non-standard variables that you might want to use | ||
| 414 | for this. | ||
| 415 | |||
| 416 | This scheme is extensible - adding more hooks is a simple matter | ||
| 417 | of adding more plugin methods to SourcePlugin and derived classes. | ||
| 418 | The code that then needs to call the plugin methods the uses | ||
| 419 | plugin.get_source_plugin_methods() to find the method(s) needed by | ||
| 420 | the call; this is done by filling up a dict with keys containing | ||
| 421 | the method names of interest - on success, these will be filled in | ||
| 422 | with the actual methods. Please see the implementation for | ||
| 423 | examples and details. | ||
| 424 | """ | ||
