diff options
| author | Tom Zanussi <tom.zanussi@linux.intel.com> | 2014-07-10 20:50:31 -0500 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-16 10:20:48 +0100 |
| commit | d8b65a55d204763d67cb8bff8fd449ea2323a856 (patch) | |
| tree | e12e2813540d06509fa7008bcc3dce60af72f318 /scripts/lib/image/help.py | |
| parent | 83e5c09d2fa9209e11b312126571a6653c330eea (diff) | |
| download | poky-d8b65a55d204763d67cb8bff8fd449ea2323a856.tar.gz | |
wic: Add wic overview to help system
Add a general overview of wic to the help system as 'wic overview',
along with some introductory examples.
(From OE-Core rev: fa108caaa53878152e4856d32ce1ab7fe3802287)
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 | 209 |
1 files changed, 209 insertions, 0 deletions
diff --git a/scripts/lib/image/help.py b/scripts/lib/image/help.py index a4f27ab68e..bf2f773266 100644 --- a/scripts/lib/image/help.py +++ b/scripts/lib/image/help.py | |||
| @@ -88,6 +88,7 @@ wic_usage = """ | |||
| 88 | list List available values for options and image properties | 88 | list List available values for options and image properties |
| 89 | 89 | ||
| 90 | Help topics: | 90 | Help topics: |
| 91 | overview wic overview - General overview of wic | ||
| 91 | plugins wic plugins - Overview and API | 92 | plugins wic plugins - Overview and API |
| 92 | 93 | ||
| 93 | See 'wic help <COMMAND or HELP TOPIC>' for more information on a specific | 94 | See 'wic help <COMMAND or HELP TOPIC>' for more information on a specific |
| @@ -422,3 +423,211 @@ DESCRIPTION | |||
| 422 | with the actual methods. Please see the implementation for | 423 | with the actual methods. Please see the implementation for |
| 423 | examples and details. | 424 | examples and details. |
| 424 | """ | 425 | """ |
| 426 | |||
| 427 | wic_overview_help = """ | ||
| 428 | |||
| 429 | NAME | ||
| 430 | wic overview - General overview of wic | ||
| 431 | |||
| 432 | DESCRIPTION | ||
| 433 | The 'wic' command generates partitioned images from existing | ||
| 434 | OpenEmbedded build artifacts. Image generation is driven by | ||
| 435 | partitioning commands contained in an 'Openembedded kickstart' | ||
| 436 | (.wks) file (see 'wic help kickstart') specified either directly | ||
| 437 | on the command-line or as one of a selection of canned .wks files | ||
| 438 | (see 'wic list images'). When applied to a given set of build | ||
| 439 | artifacts, the result is an image or set of images that can be | ||
| 440 | directly written onto media and used on a particular system. | ||
| 441 | |||
| 442 | The 'wic' command and the infrastructure it's based is by | ||
| 443 | definition incomplete - it's designed to allow the generation of | ||
| 444 | customized images, and as such was designed to be completely | ||
| 445 | extensible via a plugin interface (see 'wic help plugins'). | ||
| 446 | |||
| 447 | Background and Motivation | ||
| 448 | |||
| 449 | wic is meant to be a completely independent standalone utility | ||
| 450 | that initially provides easier-to-use and more flexible | ||
| 451 | replacements for a couple bits of existing functionality in | ||
| 452 | oe-core: directdisk.bbclass and mkefidisk.sh. The difference | ||
| 453 | between wic and those examples is that with wic the functionality | ||
| 454 | of those scripts is implemented by a general-purpose partitioning | ||
| 455 | 'language' based on Redhat kickstart syntax (with the underlying | ||
| 456 | code borrowed from Tizen mic, which in turn was borrowed from | ||
| 457 | Meego mic, in turn borrowed from Fedora livecd, etc.). | ||
| 458 | |||
| 459 | The initial motivation and design considerations that lead to the | ||
| 460 | current tool are described exhaustively in Yocto Bug #3847 | ||
| 461 | (https://bugzilla.yoctoproject.org/show_bug.cgi?id=3847). | ||
| 462 | |||
| 463 | Though the current wic tool only uses the kickstart syntax related | ||
| 464 | to partitioning and bootloaders and only for creating images, | ||
| 465 | because the code is based on the mic/pykickstart code, future | ||
| 466 | deployment efforts such as those partially described by Yocto Bug | ||
| 467 | #4106 (https://bugzilla.yoctoproject.org/show_bug.cgi?id=4106), | ||
| 468 | but also others including package selection (from e.g. binary | ||
| 469 | feeds) and deployment configuration of users/network/services, | ||
| 470 | etc, could be implemented under this framework, considering that | ||
| 471 | all of those are implemented in some form by the base system. | ||
| 472 | |||
| 473 | Implementation and Examples | ||
| 474 | |||
| 475 | wic can be used in two different modes, depending on how much | ||
| 476 | control the user needs in specifying the Openembedded build | ||
| 477 | artifacts that will be used in creating the image: 'raw' and | ||
| 478 | 'cooked'. | ||
| 479 | |||
| 480 | If used in 'raw' mode, artifacts are explicitly specified via | ||
| 481 | command-line arguments (see example below). | ||
| 482 | |||
| 483 | The more easily usable 'cooked' mode uses the current MACHINE | ||
| 484 | setting and a specified image name to automatically locate the | ||
| 485 | artifacts used to create the image. | ||
| 486 | |||
| 487 | OE kickstart files (.wks) can of course be specified directly on | ||
| 488 | the command-line, but the user can also choose from a set of | ||
| 489 | 'canned' .wks files available via the 'wic list images' command | ||
| 490 | (example below). | ||
| 491 | |||
| 492 | In any case, the prerequisite for generating any image is to have | ||
| 493 | the build artifacts already available. The below examples assume | ||
| 494 | the user has already build a 'core-image-minimal' for a specific | ||
| 495 | machine (future versions won't require this redundant step, but | ||
| 496 | for now that's typically how build artifacts get generated). | ||
| 497 | |||
| 498 | The other prerequisite is to source the build environment: | ||
| 499 | |||
| 500 | $ source oe-init-build-env | ||
| 501 | |||
| 502 | To start out with, we'll generate an image from one of the canned | ||
| 503 | .wks files. The following generates a list of availailable | ||
| 504 | images: | ||
| 505 | |||
| 506 | $ wic list images | ||
| 507 | mkefidisk Create an EFI disk image | ||
| 508 | directdisk Create a 'pcbios' direct disk image | ||
| 509 | |||
| 510 | You can get more information about any of the available images by | ||
| 511 | typing 'wic list xxx help', where 'xxx' is one of the image names: | ||
| 512 | |||
| 513 | $ wic list mkefidisk help | ||
| 514 | |||
| 515 | Creates a partitioned EFI disk image that the user can directly dd | ||
| 516 | to boot media. | ||
| 517 | |||
| 518 | At any time, you can get help on the 'wic' command or any | ||
| 519 | subcommand (currently 'list' and 'create'). For instance, to get | ||
| 520 | the description of 'wic create' command and its parameters: | ||
| 521 | |||
| 522 | $ wic create | ||
| 523 | |||
| 524 | Usage: | ||
| 525 | |||
| 526 | Create a new OpenEmbedded image | ||
| 527 | |||
| 528 | usage: wic create <wks file or image name> [-o <DIRNAME> | ...] | ||
| 529 | [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>] | ||
| 530 | [-e | --image-name] [-r, --rootfs-dir] [-b, --bootimg-dir] | ||
| 531 | [-k, --kernel-dir] [-n, --native-sysroot] [-s, --skip-build-check] | ||
| 532 | |||
| 533 | This command creates an OpenEmbedded image based on the 'OE | ||
| 534 | kickstart commands' found in the <wks file>. | ||
| 535 | |||
| 536 | The -o option can be used to place the image in a directory | ||
| 537 | with a different name and location. | ||
| 538 | |||
| 539 | See 'wic help create' for more detailed instructions. | ||
| 540 | ... | ||
| 541 | |||
| 542 | As mentioned in the command, you can get even more detailed | ||
| 543 | information by adding 'help' to the above: | ||
| 544 | |||
| 545 | $ wic help create | ||
| 546 | |||
| 547 | So, the easiest way to create an image is to use the -e option | ||
| 548 | with a canned .wks file. To use the -e option, you need to | ||
| 549 | specify the image used to generate the artifacts and you actually | ||
| 550 | need to have the MACHINE used to build them specified in your | ||
| 551 | local.conf (these requirements aren't necessary if you aren't | ||
| 552 | using the -e options.) Below, we generate a directdisk image, | ||
| 553 | pointing the process at the core-image-minimal artifacts for the | ||
| 554 | current MACHINE: | ||
| 555 | |||
| 556 | $ wic create directdisk -e core-image-minimal | ||
| 557 | |||
| 558 | Checking basic build environment... | ||
| 559 | Done. | ||
| 560 | |||
| 561 | Creating image(s)... | ||
| 562 | |||
| 563 | Info: The new image(s) can be found here: | ||
| 564 | /var/tmp/wic/build/directdisk-201309252350-sda.direct | ||
| 565 | |||
| 566 | The following build artifacts were used to create the image(s): | ||
| 567 | |||
| 568 | ROOTFS_DIR: ... | ||
| 569 | BOOTIMG_DIR: ... | ||
| 570 | KERNEL_DIR: ... | ||
| 571 | NATIVE_SYSROOT: ... | ||
| 572 | |||
| 573 | The image(s) were created using OE kickstart file: | ||
| 574 | .../scripts/lib/image/canned-wks/directdisk.wks | ||
| 575 | |||
| 576 | The output shows the name and location of the image created, and | ||
| 577 | so that you know exactly what was used to generate the image, each | ||
| 578 | of the artifacts and the kickstart file used. | ||
| 579 | |||
| 580 | Similarly, you can create a 'mkefidisk' image in the same way | ||
| 581 | (notice that this example uses a different machine - because it's | ||
| 582 | using the -e option, you need to change the MACHINE in your | ||
| 583 | local.conf): | ||
| 584 | |||
| 585 | $ wic create mkefidisk -e core-image-minimal | ||
| 586 | Checking basic build environment... | ||
| 587 | Done. | ||
| 588 | |||
| 589 | Creating image(s)... | ||
| 590 | |||
| 591 | Info: The new image(s) can be found here: | ||
| 592 | /var/tmp/wic/build/mkefidisk-201309260027-sda.direct | ||
| 593 | |||
| 594 | ... | ||
| 595 | |||
| 596 | Here's an example that doesn't take the easy way out and manually | ||
| 597 | specifies each build artifact, along with a non-canned .wks file, | ||
| 598 | and also uses the -o option to have wic create the output | ||
| 599 | somewhere other than the default /var/tmp/wic: | ||
| 600 | |||
| 601 | $ wic create ~/test.wks -o /home/trz/testwic --rootfs-dir | ||
| 602 | /home/trz/yocto/build/tmp/work/crownbay/core-image-minimal/1.0-r0/rootfs | ||
| 603 | --bootimg-dir /home/trz/yocto/build/tmp/sysroots/crownbay/usr/share | ||
| 604 | --kernel-dir /home/trz/yocto/build/tmp/sysroots/crownbay/usr/src/kernel | ||
| 605 | --native-sysroot /home/trz/yocto/build/tmp/sysroots/x86_64-linux | ||
| 606 | |||
| 607 | Creating image(s)... | ||
| 608 | |||
| 609 | Info: The new image(s) can be found here: | ||
| 610 | /home/trz/testwic/build/test-201309260032-sda.direct | ||
| 611 | |||
| 612 | ... | ||
| 613 | |||
| 614 | Finally, here's an example of the actual partition language | ||
| 615 | commands used to generate the mkefidisk image i.e. these are the | ||
| 616 | contents of the mkefidisk.wks OE kickstart file: | ||
| 617 | |||
| 618 | # short-description: Create an EFI disk image | ||
| 619 | # long-description: Creates a partitioned EFI disk image that the user | ||
| 620 | # can directly dd to boot media. | ||
| 621 | |||
| 622 | part /boot --source bootimg-efi --ondisk sda --fstype=efi --active | ||
| 623 | |||
| 624 | part / --source rootfs --ondisk sda --fstype=ext3 --label platform | ||
| 625 | |||
| 626 | part swap --ondisk sda --size 44 --label swap1 --fstype=swap | ||
| 627 | |||
| 628 | bootloader --timeout=10 --append="rootwait console=ttyPCH0,115200" | ||
| 629 | |||
| 630 | You can get a complete listing and description of all the | ||
| 631 | kickstart commands available for use in .wks files from 'wic help | ||
| 632 | kickstart'. | ||
| 633 | """ | ||
