diff options
author | Scott Rifenbark <scott.m.rifenbark@intel.com> | 2014-07-23 09:28:16 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-23 10:02:13 +0100 |
commit | 5ba68f32a86a20b3f3544903fea2a24f2e59afbf (patch) | |
tree | 96190417d26028293cc18f40ee71e3810dc6e031 /documentation | |
parent | b72dc514a57fcce254252f1ea0ebb4c98ff5ffaa (diff) | |
download | poky-5ba68f32a86a20b3f3544903fea2a24f2e59afbf.tar.gz |
dev-manual: Added the section on "Creating Partitioned Images"
This is the section on 'wic'. I have dropped in the same exact
section from the 1.5.3 (dora branch) release as a starting point
for Tom Zanussi to scrub and update for the master branch.
(From yocto-docs rev: e189992bff4249664ba959b1c440541e0b84e03d)
Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/dev-manual/dev-manual-common-tasks.xml | 726 |
1 files changed, 726 insertions, 0 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index 6aabdf4877..c4c3d9fc3e 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml | |||
@@ -3348,6 +3348,732 @@ | |||
3348 | </section> | 3348 | </section> |
3349 | </section> | 3349 | </section> |
3350 | 3350 | ||
3351 | <section id='creating-partitioned-images'> | ||
3352 | <title>Creating Partitioned Images</title> | ||
3353 | |||
3354 | <para> | ||
3355 | Creating an image for a particular hardware target using the | ||
3356 | OpenEmbedded build system does not necessarily mean you can boot | ||
3357 | that image as is on your device. | ||
3358 | Physical devices accept and boot images in various ways depending | ||
3359 | on the specifics of the device. | ||
3360 | Usually, information about the hardware can tell you what image | ||
3361 | format the device requires. | ||
3362 | Should your device require multiple partitions on an SD card, flash, | ||
3363 | or an HDD, you can use the OpenEmbedded Image Creator | ||
3364 | to create the properly partitioned image. | ||
3365 | </para> | ||
3366 | |||
3367 | <para> | ||
3368 | The <filename>wic</filename> command generates partitioned images | ||
3369 | from existing OpenEmbedded build artifacts. | ||
3370 | Image generation is driven by partitioning commands contained | ||
3371 | in an Openembedded kickstart file (<filename>.wks</filename>) | ||
3372 | specified either directly on the command-line or as one of a | ||
3373 | selection of canned <filename>.wks</filename> files as shown | ||
3374 | with the <filename>wic list images</filename> command in the | ||
3375 | "<link linkend='using-a-provided-kickstart_file'>Using a Provided Kickstart File</link>" | ||
3376 | section. | ||
3377 | When applied to a given set of build artifacts, the result is an | ||
3378 | image or set of images that can be directly written onto media and | ||
3379 | used on a particular system. | ||
3380 | </para> | ||
3381 | |||
3382 | <para> | ||
3383 | This section provides some background information on | ||
3384 | <filename>wic</filename>, describes what you need to have in | ||
3385 | place to run the tool, provides instruction on how to use | ||
3386 | <filename>wic</filename>, and provides several examples. | ||
3387 | </para> | ||
3388 | |||
3389 | <section id='wic-background'> | ||
3390 | <title>Background</title> | ||
3391 | |||
3392 | <para> | ||
3393 | This section provides some background on the | ||
3394 | <filename>wic</filename> utility. | ||
3395 | While none of this information is required to use | ||
3396 | <filename>wic</filename>, you might find it interesting. | ||
3397 | <itemizedlist> | ||
3398 | <listitem><para> | ||
3399 | The name "wic" is derived from OpenEmbedded | ||
3400 | Image Creator (oeic). | ||
3401 | The "oe" diphthong in "oeic" was promoted to the | ||
3402 | letter "w", because "oeic" is both difficult to remember and | ||
3403 | pronounce.</para></listitem> | ||
3404 | <listitem><para> | ||
3405 | <filename>wic</filename> is loosely based on the | ||
3406 | Meego Image Creator (<filename>mic</filename>) | ||
3407 | framework. | ||
3408 | The <filename>wic</filename> implementation has been | ||
3409 | heavily modified to make direct use of OpenEmbedded | ||
3410 | build artifacts instead of package installation and | ||
3411 | configuration, which are already incorporated within | ||
3412 | the OpenEmbedded artifacts.</para></listitem> | ||
3413 | <listitem><para> | ||
3414 | <filename>wic</filename> is a completely independent | ||
3415 | standalone utility that initially provides | ||
3416 | easier-to-use and more flexible replacements for a | ||
3417 | couple bits of existing functionality in OE Core's | ||
3418 | <filename>directdisk.bbclass</filename> and | ||
3419 | <filename>mkefidisk.sh</filename> script. | ||
3420 | The replaced scripts are implemented by a | ||
3421 | general-purpose partitioning language based on Red Hat | ||
3422 | kickstart syntax. | ||
3423 | Underlying code for <filename>wic</filename> succeeded | ||
3424 | from several projects over time.</para></listitem> | ||
3425 | </itemizedlist> | ||
3426 | </para> | ||
3427 | </section> | ||
3428 | |||
3429 | <section id='wic-requirements'> | ||
3430 | <title>Requirements</title> | ||
3431 | |||
3432 | <para> | ||
3433 | In order to use the <filename>wic</filename> utility with the | ||
3434 | OpenEmbedded Build system, you need to meet the following | ||
3435 | requirements: | ||
3436 | <itemizedlist> | ||
3437 | <listitem><para>The Linux distribution on your | ||
3438 | development host must support the Yocto Project. | ||
3439 | See the | ||
3440 | "<ulink url='&YOCTO_DOCS_REF_URL;#detailed-supported-distros'>Supported Linux Distributions</ulink>" | ||
3441 | section in the Yocto Project Reference Manual for this | ||
3442 | list of distributions.</para></listitem> | ||
3443 | <listitem><para> | ||
3444 | The standard system utilities, such as | ||
3445 | <filename>cp</filename>, must be installed on your | ||
3446 | development host system. | ||
3447 | </para></listitem> | ||
3448 | <listitem><para> | ||
3449 | The | ||
3450 | <ulink url='http://www.gnu.org/software/parted/'>GNU Parted</ulink> | ||
3451 | package must be installed on your development host | ||
3452 | system. | ||
3453 | </para></listitem> | ||
3454 | <listitem><para> | ||
3455 | Have the build artifacts already available. | ||
3456 | You must already have created an image using the | ||
3457 | Openembedded build system (e.g. | ||
3458 | <filename>core-image-minimal</filename>. | ||
3459 | It might seem redundant to generate an image in order | ||
3460 | to create an image using <filename>wic</filename>, | ||
3461 | but the artifacts are needed and they are generated | ||
3462 | with the build system.</para></listitem> | ||
3463 | <listitem><para> | ||
3464 | You must have sourced one of the build environment | ||
3465 | setup scripts (i.e. | ||
3466 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink> | ||
3467 | or | ||
3468 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-memres-core-script'><filename>oe-init-build-env-memres</filename></ulink>) | ||
3469 | found in the | ||
3470 | <link linkend='build-directory'>Build Directory</link>. | ||
3471 | </para></listitem> | ||
3472 | </itemizedlist> | ||
3473 | </para> | ||
3474 | </section> | ||
3475 | |||
3476 | <section id='wic-getting-help'> | ||
3477 | <title>Getting Help</title> | ||
3478 | |||
3479 | <para> | ||
3480 | You can get general help for the <filename>wic</filename> | ||
3481 | by entering the <filename>wic</filename> command by itself | ||
3482 | or by entering the command with a help argument as follows: | ||
3483 | <literallayout class='monospaced'> | ||
3484 | $ wic -h | ||
3485 | $ wic --help | ||
3486 | </literallayout> | ||
3487 | </para> | ||
3488 | |||
3489 | <para> | ||
3490 | Currently, <filename>wic</filename> supports two commands: | ||
3491 | <filename>create</filename> and <filename>list</filename>. | ||
3492 | You can get help for these commands as follows: | ||
3493 | <literallayout class='monospaced'> | ||
3494 | $ wic help <command> | ||
3495 | </literallayout> | ||
3496 | </para> | ||
3497 | |||
3498 | <para> | ||
3499 | You can find more out about the images | ||
3500 | <filename>wic</filename> creates using the provided | ||
3501 | kickstart files with the following form of the command: | ||
3502 | <literallayout class='monospaced'> | ||
3503 | $ wic list <image> help | ||
3504 | </literallayout> | ||
3505 | Where <filename><image></filename> is either | ||
3506 | <filename>directdisk</filename> or | ||
3507 | <filename>mkefidisk</filename>. | ||
3508 | </para> | ||
3509 | </section> | ||
3510 | |||
3511 | <section id='operational-modes'> | ||
3512 | <title>Operational Modes</title> | ||
3513 | |||
3514 | <para> | ||
3515 | You can run <filename>wic</filename> in two modes: Raw and | ||
3516 | Cooked: | ||
3517 | <itemizedlist> | ||
3518 | <listitem><para><emphasis>Raw Mode:</emphasis> | ||
3519 | You explicitly specify build artifacts through | ||
3520 | command-line arguments.</para></listitem> | ||
3521 | <listitem><para><emphasis>Cooked Mode:</emphasis> | ||
3522 | The current | ||
3523 | <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> | ||
3524 | setting and image name are used to automatically locate | ||
3525 | and provide the build artifacts.</para></listitem> | ||
3526 | </itemizedlist> | ||
3527 | </para> | ||
3528 | |||
3529 | <para> | ||
3530 | Regardless of the mode you use, you need to have the build | ||
3531 | artifacts ready and available. | ||
3532 | Additionally, the environment must be set up using the | ||
3533 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink> | ||
3534 | or | ||
3535 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-memres-core-script'><filename>oe-init-build-env-memres</filename></ulink> | ||
3536 | script found in the | ||
3537 | <link linkend='build-directory'>Build Directory</link>. | ||
3538 | </para> | ||
3539 | |||
3540 | <section id='raw-mode'> | ||
3541 | <title>Raw Mode</title> | ||
3542 | |||
3543 | <para> | ||
3544 | The general form of the 'wic' command in raw mode is: | ||
3545 | <literallayout class='monospaced'> | ||
3546 | $ wic create <replaceable>image_name</replaceable>.wks [<replaceable>options</replaceable>] [...] | ||
3547 | |||
3548 | Where: | ||
3549 | |||
3550 | <replaceable>image_name</replaceable>.wks | ||
3551 | An an OpenEmbedded kickstart file. You can provide | ||
3552 | your own custom file or use a file from a set of | ||
3553 | provided files as described by further options. | ||
3554 | |||
3555 | -o <replaceable>OUTDIR</replaceable>, --outdir=<replaceable>OUTDIR</replaceable> | ||
3556 | The name of a directory in which to create image. | ||
3557 | |||
3558 | -i <replaceable>PROPERTIES_FILE</replaceable>, --infile=<replaceable>PROPERTIES_FILE</replaceable> | ||
3559 | The name of a file containing the values for image | ||
3560 | properties as a JSON file. | ||
3561 | |||
3562 | -e <replaceable>IMAGE_NAME</replaceable>, --image-name=<replaceable>IMAGE_NAME</replaceable> | ||
3563 | The name of the image from which to use the artifacts | ||
3564 | (e.g. <filename>core-image-sato</filename>). | ||
3565 | |||
3566 | -r <replaceable>ROOTFS_DIR</replaceable>, --rootfs-dir=<replaceable>ROOTFS_DIR</replaceable> | ||
3567 | The path to the <filename>/rootfs</filename> directory to use as the | ||
3568 | <filename>.wks</filename> rootfs source. | ||
3569 | |||
3570 | -b <replaceable>BOOTIMG_DIR</replaceable>, --bootimg-dir=<replaceable>BOOTIMG_DIR</replaceable> | ||
3571 | The path to the directory containing the boot artifacts | ||
3572 | (e.g. <filename>/EFI</filename> or <filename>/syslinux</filename>) to use as the <filename>.wks</filename> bootimg | ||
3573 | source. | ||
3574 | |||
3575 | -k <replaceable>KERNEL_DIR</replaceable>, --kernel-dir=<replaceable>KERNEL_DIR</replaceable> | ||
3576 | The path to the directory containing the kernel to use | ||
3577 | in the <filename>.wks</filename> boot image. | ||
3578 | |||
3579 | -n <replaceable>NATIVE_SYSROOT</replaceable>, --native-sysroot=<replaceable>NATIVE_SYSROOT</replaceable> | ||
3580 | The path to the native sysroot containing the tools to use | ||
3581 | to build the image. | ||
3582 | |||
3583 | -p, --skip-build-check | ||
3584 | Skips the build check. | ||
3585 | |||
3586 | -D, --debug | ||
3587 | Output debug information. | ||
3588 | </literallayout> | ||
3589 | <note> | ||
3590 | You do not need root privileges to run | ||
3591 | <filename>wic</filename>. | ||
3592 | In fact, you should not run as root when using the | ||
3593 | utility. | ||
3594 | </note> | ||
3595 | </para> | ||
3596 | </section> | ||
3597 | |||
3598 | <section id='cooked-mode'> | ||
3599 | <title>Cooked Mode</title> | ||
3600 | |||
3601 | <para> | ||
3602 | The general form of the <filename>wic</filename> command | ||
3603 | using Cooked Mode is: | ||
3604 | <literallayout class='monospaced'> | ||
3605 | $ wic create <replaceable>kickstart_file</replaceable> -e <replaceable>image_name</replaceable> | ||
3606 | |||
3607 | Where: | ||
3608 | |||
3609 | <replaceable>kickstart_file</replaceable> | ||
3610 | An OpenEmbedded kickstart file. You can provide your own | ||
3611 | custom file or supplied file. | ||
3612 | |||
3613 | <replaceable>image_name</replaceable> | ||
3614 | Specifies the image built using the OpenEmbedded build | ||
3615 | system. | ||
3616 | </literallayout> | ||
3617 | This form is the simplest and most user-friendly, as it | ||
3618 | does not require specifying all individual parameters. | ||
3619 | All you need to provide is your own | ||
3620 | <filename>.wks</filename> file or one provided with the | ||
3621 | release. | ||
3622 | </para> | ||
3623 | </section> | ||
3624 | </section> | ||
3625 | |||
3626 | <section id='using-a-provided-kickstart_file'> | ||
3627 | <title>Using a Provided Kickstart File</title> | ||
3628 | |||
3629 | <para> | ||
3630 | If you do not want to create your own | ||
3631 | <filename>.wks</filename> file, you can use a provided | ||
3632 | file. | ||
3633 | Use the following command to list the available files: | ||
3634 | <literallayout class='monospaced'> | ||
3635 | $ wic list images | ||
3636 | directdisk Create a 'pcbios' direct disk image | ||
3637 | mkefidisk Create an EFI disk image | ||
3638 | </literallayout> | ||
3639 | When you use a provided file, you do not have to use the | ||
3640 | <filename>.wks</filename> extension. | ||
3641 | Here is an example in Raw Mode that uses the | ||
3642 | <filename>directdisk</filename> file: | ||
3643 | <literallayout class='monospaced'> | ||
3644 | $ wic create directdisk -r <replaceable>rootfs_dir</replaceable> -b <replaceable>bootimg_dir</replaceable> \ | ||
3645 | -k <replaceable>kernel_dir</replaceable> -n <replaceable>native_sysroot</replaceable> | ||
3646 | </literallayout> | ||
3647 | </para> | ||
3648 | |||
3649 | <para> | ||
3650 | Here are the actual partition language commands | ||
3651 | used in the <filename>mkefidisk.wks</filename> file to generate | ||
3652 | an image: | ||
3653 | <literallayout class='monospaced'> | ||
3654 | # short-description: Create an EFI disk image | ||
3655 | # long-description: Creates a partitioned EFI disk image that the user | ||
3656 | # can directly dd to boot media. | ||
3657 | |||
3658 | part /boot ‐‐source bootimg-efi ‐‐ondisk sda ‐‐fstype=efi ‐‐active | ||
3659 | |||
3660 | part / ‐‐source rootfs ‐‐ondisk sda ‐‐fstype=ext3 ‐‐label platform | ||
3661 | |||
3662 | part swap ‐‐ondisk sda ‐‐size 44 ‐‐label swap1 ‐‐fstype=swap | ||
3663 | |||
3664 | bootloader ‐‐timeout=10 ‐‐append="rootwait console=ttyPCH0,115200" | ||
3665 | </literallayout> | ||
3666 | </para> | ||
3667 | </section> | ||
3668 | |||
3669 | <section id='wic-usage-examples'> | ||
3670 | <title>Examples</title> | ||
3671 | |||
3672 | <para> | ||
3673 | This section provides several examples that show how to use | ||
3674 | the <filename>wic</filename> utility. | ||
3675 | All the examples assume the list of requirements in the | ||
3676 | "<link linkend='wic-requirements'>Requirements</link>" section | ||
3677 | have been met. | ||
3678 | The examples assume the previously generated image is | ||
3679 | <filename>core-image-minimal</filename>. | ||
3680 | </para> | ||
3681 | |||
3682 | <section id='generate-an-image-using-a-provided-kickstart-file'> | ||
3683 | <title>Generate an Image using a Provided Kickstart File</title> | ||
3684 | |||
3685 | <para> | ||
3686 | This example runs in Cooked Mode and uses the | ||
3687 | <filename>mkefidisk</filename> kickstart file: | ||
3688 | <literallayout class='monospaced'> | ||
3689 | $ wic create mkefidisk -e core-image-minimal | ||
3690 | Checking basic build environment... | ||
3691 | Done. | ||
3692 | |||
3693 | Creating image(s)... | ||
3694 | |||
3695 | Info: The new image(s) can be found here: | ||
3696 | /var/tmp/wic/build/mkefidisk-201310230946-sda.direct | ||
3697 | |||
3698 | The following build artifacts were used to create the image(s): | ||
3699 | ROOTFS_DIR: /home/trz/yocto/yocto-image/build/tmp/work/minnow-poky-linux/core-image-minimal/1.0-r0/rootfs | ||
3700 | BOOTIMG_DIR: /home/trz/yocto/yocto-image/build/tmp/work/minnow-poky-linux/core-image-minimal/1.0-r0/core-image-minimal-1.0/hddimg | ||
3701 | KERNEL_DIR: /home/trz/yocto/yocto-image/build/tmp/sysroots/minnow/usr/src/kernel | ||
3702 | NATIVE_SYSROOT: /home/trz/yocto/yocto-image/build/tmp/sysroots/x86_64-linux | ||
3703 | |||
3704 | |||
3705 | The image(s) were created using OE kickstart file: | ||
3706 | /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/mkefidisk.wks | ||
3707 | </literallayout> | ||
3708 | This example shows the easiest way to create an image | ||
3709 | by running in Cooked Mode and using the | ||
3710 | <filename>-e</filename> option with a provided kickstart | ||
3711 | file. | ||
3712 | All that is necessary is to specify the image used to | ||
3713 | generate the artifacts. | ||
3714 | Your <filename>local.conf</filename> needs to have the | ||
3715 | <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> | ||
3716 | variable set to the machine you are using, which is | ||
3717 | "minnow" in this example. | ||
3718 | </para> | ||
3719 | |||
3720 | <para> | ||
3721 | The output specifies exactly which image was | ||
3722 | created as well as where it was created. | ||
3723 | The output also names the artifacts used and the exact | ||
3724 | <filename>.wks</filename> script that was used to generate | ||
3725 | the image. | ||
3726 | <note> | ||
3727 | You should always verify the details provided in the | ||
3728 | output to make sure that the image was indeed created | ||
3729 | exactly as expected. | ||
3730 | </note> | ||
3731 | </para> | ||
3732 | |||
3733 | <para> | ||
3734 | Continuing with the example, you can now directly | ||
3735 | <filename>dd</filename> the image to a USB stick, or | ||
3736 | whatever media for which you built your image, | ||
3737 | and boot the resulting media: | ||
3738 | <literallayout class='monospaced'> | ||
3739 | $ sudo dd if=/var/tmp/wic/build/mkefidisk-201310230946-sda.direct of=/dev/sdb | ||
3740 | [sudo] password for trz: | ||
3741 | 182274+0 records in | ||
3742 | 182274+0 records out | ||
3743 | 93324288 bytes (93 MB) copied, 14.4777 s, 6.4 MB/s | ||
3744 | [trz@empanada ~]$ sudo eject /dev/sdb | ||
3745 | </literallayout> | ||
3746 | </para> | ||
3747 | </section> | ||
3748 | |||
3749 | <section id='using-a-modified-kickstart-file'> | ||
3750 | <title>Using a Modified Kickstart File</title> | ||
3751 | |||
3752 | <para> | ||
3753 | Because <filename>wic</filename> image creation is driven | ||
3754 | by the kickstart file, it is easy to affect image creation | ||
3755 | by changing the parameters in the file. | ||
3756 | This next example demonstrates that through modification | ||
3757 | of the <filename>directdisk</filename> kickstart file. | ||
3758 | </para> | ||
3759 | |||
3760 | <para> | ||
3761 | As mentioned earlier, you can use the command | ||
3762 | <filename>wic list images</filename> to show the list | ||
3763 | of provided kickstart files. | ||
3764 | The directory in which these files reside is | ||
3765 | <filename>scripts/lib/image/canned-wks/</filename> | ||
3766 | located in the | ||
3767 | <link linkend='source-directory'>Source Directory</link>. | ||
3768 | Because the available files reside in this directory, you | ||
3769 | can create and add your own custom files to the directory. | ||
3770 | Subsequent use of the <filename>wic list images</filename> | ||
3771 | command would then include your kickstart files. | ||
3772 | </para> | ||
3773 | |||
3774 | <para> | ||
3775 | In this example, the existing | ||
3776 | <filename>directdisk</filename> file already does most | ||
3777 | of what is needed. | ||
3778 | However, for the hardware in this example, the image will | ||
3779 | need to boot from <filename>sdb</filename> instead of | ||
3780 | <filename>sda</filename>, which is what the | ||
3781 | <filename>directdisk</filename> kickstart file uses. | ||
3782 | </para> | ||
3783 | |||
3784 | <para> | ||
3785 | The example begins by making a copy of the | ||
3786 | <filename>directdisk.wks</filename> file in the | ||
3787 | <filename>scripts/lib/image/canned-wks</filename> | ||
3788 | directory and then changing the lines that specify the | ||
3789 | target disk from which to boot. | ||
3790 | <literallayout class='monospaced'> | ||
3791 | $ cp /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/directdisk.wks \ | ||
3792 | /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/directdisksdb.wks | ||
3793 | </literallayout> | ||
3794 | Next, the example modifies the | ||
3795 | <filename>directdisksdb.wks</filename> file and changes all | ||
3796 | instances of "<filename>--ondisk sda</filename>" | ||
3797 | to "<filename>--ondisk sdb</filename>". | ||
3798 | The example changes the following two lines and leaves the | ||
3799 | remaining lines untouched: | ||
3800 | <literallayout class='monospaced'> | ||
3801 | part /boot --source bootimg --ondisk sdb --fstype=msdos --label boot --active --align 1024 | ||
3802 | part / --source rootfs --ondisk sdb --fstype=ext3 --label platform --align 1024 | ||
3803 | </literallayout> | ||
3804 | Once the lines are changed, the example generates the | ||
3805 | <filename>directdisksdb</filename> image. | ||
3806 | The command points the process at the | ||
3807 | <filename>core-image-minimal</filename> artifacts for the | ||
3808 | Next Unit of Computing (nuc) | ||
3809 | <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> | ||
3810 | the <filename>local.conf</filename>. | ||
3811 | <literallayout class='monospaced'> | ||
3812 | $ wic create directdisksdb -e core-image-minimal | ||
3813 | Checking basic build environment... | ||
3814 | Done. | ||
3815 | |||
3816 | Creating image(s)... | ||
3817 | |||
3818 | Info: The new image(s) can be found here: | ||
3819 | /var/tmp/wic/build/directdisksdb-201310231131-sdb.direct | ||
3820 | |||
3821 | The following build artifacts were used to create the image(s): | ||
3822 | ROOTFS_DIR: /home/trz/yocto/yocto-image/build/tmp/work/nuc-poky-linux/core-image-minimal/1.0-r0/rootfs | ||
3823 | BOOTIMG_DIR: /home/trz/yocto/yocto-image/build/tmp/sysroots/nuc/usr/share | ||
3824 | KERNEL_DIR: /home/trz/yocto/yocto-image/build/tmp/sysroots/nuc/usr/src/kernel | ||
3825 | NATIVE_SYSROOT: /home/trz/yocto/yocto-image/build/tmp/sysroots/x86_64-linux | ||
3826 | |||
3827 | |||
3828 | The image(s) were created using OE kickstart file: | ||
3829 | /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/directdisksdb.wks | ||
3830 | </literallayout> | ||
3831 | Continuing with the example, you can now directly | ||
3832 | <filename>dd</filename> the image to a USB stick, or | ||
3833 | whatever media for which you built your image, | ||
3834 | and boot the resulting media: | ||
3835 | <literallayout class='monospaced'> | ||
3836 | $ sudo dd if=/var/tmp/wic/build/directdisksdb-201310231131-sdb.direct of=/dev/sdb | ||
3837 | 86018+0 records in | ||
3838 | 86018+0 records out | ||
3839 | 44041216 bytes (44 MB) copied, 13.0734 s, 3.4 MB/s | ||
3840 | [trz@empanada tmp]$ sudo eject /dev/sdb | ||
3841 | </literallayout> | ||
3842 | </para> | ||
3843 | </section> | ||
3844 | |||
3845 | <section id='creating-an-image-based-on-core-image-minimal-and-crownbay-noemgd'> | ||
3846 | <title>Creating an Image Based on <filename>core-image-minimal</filename> and <filename>crownbay-noemgd</filename></title> | ||
3847 | |||
3848 | <para> | ||
3849 | This example creates an image based on | ||
3850 | <filename>core-image-minimal</filename> and a | ||
3851 | <filename>crownbay-noemgd</filename> | ||
3852 | <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> | ||
3853 | that works right out of the box. | ||
3854 | <literallayout class='monospaced'> | ||
3855 | $ wic create directdisk -e core-image-minimal | ||
3856 | |||
3857 | Checking basic build environment... | ||
3858 | Done. | ||
3859 | |||
3860 | Creating image(s)... | ||
3861 | |||
3862 | Info: The new image(s) can be found here: | ||
3863 | /var/tmp/wic/build/directdisk-201309252350-sda.direct | ||
3864 | |||
3865 | The following build artifacts were used to create the image(s): | ||
3866 | |||
3867 | ROOTFS_DIR: /home/trz/yocto/yocto-image/build/tmp/work/crownbay_noemgd-poky-linux/core-image-minimal/1.0-r0/rootfs | ||
3868 | BOOTIMG_DIR: /home/trz/yocto/yocto-image/build/tmp/sysroots/crownbay-noemgd/usr/share | ||
3869 | KERNEL_DIR: /home/trz/yocto/yocto-image/build/tmp/sysroots/crownbay-noemgd/usr/src/kernel | ||
3870 | NATIVE_SYSROOT: /home/trz/yocto/yocto-image/build/tmp/sysroots/crownbay-noemgd/usr/src/kernel | ||
3871 | |||
3872 | The image(s) were created using OE kickstart file: | ||
3873 | /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/directdisk.wks | ||
3874 | </literallayout> | ||
3875 | </para> | ||
3876 | </section> | ||
3877 | |||
3878 | <section id='using-a-modified-kickstart-file-and-running-in-raw-mode'> | ||
3879 | <title>Using a Modified Kickstart File and Running in Raw Mode</title> | ||
3880 | |||
3881 | <para> | ||
3882 | This next example manually specifies each build artifact | ||
3883 | (runs in Raw Mode) and uses a modified kickstart file. | ||
3884 | The example also uses the <filename>-o</filename> option | ||
3885 | to cause <filename>wic</filename> to create the output | ||
3886 | somewhere other than the default | ||
3887 | <filename>/var/tmp/wic</filename> directory: | ||
3888 | <literallayout class='monospaced'> | ||
3889 | $ wic create ~/test.wks -o /home/trz/testwic --rootfs-dir \ | ||
3890 | /home/trz/yocto/yocto-image/build/tmp/work/crownbay_noemgd-poky-linux/core-image-minimal/1.0-r0/rootfs \ | ||
3891 | --bootimg-dir /home/trz/yocto/yocto-image/build/tmp/sysroots/crownbay-noemgd/usr/share \ | ||
3892 | --kernel-dir /home/trz/yocto/yocto-image/build/tmp/sysroots/crownbay-noemgd/usr/src/kernel \ | ||
3893 | --native-sysroot /home/trz/yocto/yocto-image/build/tmp/sysroots/x86_64-linux | ||
3894 | |||
3895 | Creating image(s)... | ||
3896 | |||
3897 | Info: The new image(s) can be found here: | ||
3898 | /home/trz/testwic/build/test-201309260032-sda.direct | ||
3899 | |||
3900 | The following build artifacts were used to create the image(s): | ||
3901 | |||
3902 | ROOTFS_DIR: /home/trz/yocto/yocto-image/build/tmp/work/crownbay_noemgd-poky-linux/core-image-minimal/1.0-r0/rootfs | ||
3903 | BOOTIMG_DIR: /home/trz/yocto/yocto-image/build/tmp/sysroots/crownbay-noemgd/usr/share | ||
3904 | KERNEL_DIR: /home/trz/yocto/yocto-image/build/tmp/sysroots/crownbay-noemgd/usr/src/kernel | ||
3905 | NATIVE_SYSROOT: /home/trz/yocto/yocto-image/build/tmp/sysroots/crownbay-noemgd/usr/src/kernel | ||
3906 | |||
3907 | The image(s) were created using OE kickstart file: | ||
3908 | /home/trz/test.wks | ||
3909 | </literallayout> | ||
3910 | For this example, | ||
3911 | <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> | ||
3912 | did not have to be specified in the | ||
3913 | <filename>local.conf</filename> file since the artifact is | ||
3914 | manually specified. | ||
3915 | </para> | ||
3916 | </section> | ||
3917 | </section> | ||
3918 | |||
3919 | <section id='openembedded-kickstart-wks-reference'> | ||
3920 | <title>OpenEmbedded Kickstart (.wks) Reference</title> | ||
3921 | |||
3922 | <para> | ||
3923 | The current <filename>wic</filename> implementation supports | ||
3924 | only the basic kickstart partitioning commands: | ||
3925 | <filename>partition</filename> (or <filename>part</filename> | ||
3926 | for short) and <filename>bootloader</filename>. | ||
3927 | </para> | ||
3928 | |||
3929 | <para> | ||
3930 | Following is a listing of the commands, their syntax, and | ||
3931 | meanings. | ||
3932 | The commands are based on the Fedora kickstart documentation | ||
3933 | but with modifications to reflect <filename>wic</filename> | ||
3934 | capabilities. | ||
3935 | <literallayout class='monospaced'> | ||
3936 | http://fedoraproject.org/wiki/Anaconda/Kickstart#part_or_partition | ||
3937 | http://fedoraproject.org/wiki/Anaconda/Kickstart#bootloader | ||
3938 | </literallayout> | ||
3939 | </para> | ||
3940 | |||
3941 | <section id='command-part-or-partition'> | ||
3942 | <title>Command: part or partition</title> | ||
3943 | |||
3944 | <para> | ||
3945 | This command creates a partition on the system and uses the | ||
3946 | following syntax: | ||
3947 | <literallayout class='monospaced'> | ||
3948 | part <mntpoint> | ||
3949 | </literallayout> | ||
3950 | The <filename><mntpoint></filename> is where the | ||
3951 | partition will be mounted and must be of one of the | ||
3952 | following forms: | ||
3953 | <itemizedlist> | ||
3954 | <listitem><para><filename>/<path></filename>: | ||
3955 | For example, <filename>/</filename>, | ||
3956 | <filename>/usr</filename>, and | ||
3957 | <filename>/home</filename></para></listitem> | ||
3958 | <listitem><para><filename>swap</filename>: | ||
3959 | The partition will be used as swap space. | ||
3960 | </para></listitem> | ||
3961 | </itemizedlist> | ||
3962 | </para> | ||
3963 | |||
3964 | <para> | ||
3965 | Following are the supported options: | ||
3966 | <itemizedlist> | ||
3967 | <listitem><para><emphasis><filename>--size</filename>:</emphasis> | ||
3968 | The minimum partition size in MBytes. | ||
3969 | Specify an integer value such as 500. | ||
3970 | Do not append the number with "MB". | ||
3971 | You do not need this option if you use | ||
3972 | <filename>--source</filename>.</para></listitem> | ||
3973 | <listitem><para><emphasis><filename>--source</filename>:</emphasis> | ||
3974 | This option is a wic-specific option that can | ||
3975 | currently have one of two values, "bootimg" or | ||
3976 | "rootfs".</para> | ||
3977 | <para>If <filename>--source rootfs</filename> is | ||
3978 | used, it tells the <filename>wic</filename> command | ||
3979 | to create a partition as large as needed to fill | ||
3980 | with the contents of the root filesystem | ||
3981 | (specified by the <filename>-r</filename> | ||
3982 | <filename>wic</filename> option) and to fill it | ||
3983 | with the contents of <filename>/rootfs</filename>. | ||
3984 | </para> | ||
3985 | <para>If <filename>--source bootimg</filename> | ||
3986 | is used, it tells the <filename>wic</filename> | ||
3987 | command to create a partition as large as needed to | ||
3988 | fill with the contents of the boot partition | ||
3989 | (specified by the <filename>-b</filename> | ||
3990 | <filename>wic</filename> option). | ||
3991 | Exactly what those contents are depend on the value | ||
3992 | of the <filename>--fstype</filename> option for | ||
3993 | that partition. | ||
3994 | If <filename>--fstype=efi</filename> is specified, | ||
3995 | the boot artifacts contained in HDDDIR are used, | ||
3996 | and if <filename>--fstype=msdos</filename> is | ||
3997 | specified, the boot artifacts found in | ||
3998 | <filename>STAGING_DATADIR</filename> are used. | ||
3999 | </para></listitem> | ||
4000 | <listitem><para><emphasis><filename>--ondisk</filename> or <filename>--ondrive</filename>:</emphasis> | ||
4001 | Forces the partition to be created on a particular | ||
4002 | disk.</para></listitem> | ||
4003 | <listitem><para><emphasis><filename>--fstype</filename>:</emphasis> | ||
4004 | Sets the file system type for the partition. | ||
4005 | Valid values are: | ||
4006 | <itemizedlist> | ||
4007 | <listitem><para><filename>msdos</filename> | ||
4008 | </para></listitem> | ||
4009 | <listitem><para><filename>efi</filename> | ||
4010 | </para></listitem> | ||
4011 | <listitem><para><filename>ext4</filename> | ||
4012 | </para></listitem> | ||
4013 | <listitem><para><filename>ext3</filename> | ||
4014 | </para></listitem> | ||
4015 | <listitem><para><filename>ext2</filename> | ||
4016 | </para></listitem> | ||
4017 | <listitem><para><filename>btrfs</filename> | ||
4018 | </para></listitem> | ||
4019 | <listitem><para><filename>swap</filename> | ||
4020 | </para></listitem> | ||
4021 | </itemizedlist></para></listitem> | ||
4022 | <listitem><para><emphasis><filename>--label label</filename>:</emphasis> | ||
4023 | Specifies the label to give to the filesystem to | ||
4024 | be made on the partition. | ||
4025 | If the given label is already in use by another | ||
4026 | filesystem, a new label is created for the | ||
4027 | partition.</para></listitem> | ||
4028 | <listitem><para><emphasis><filename>--active</filename>:</emphasis> | ||
4029 | Marks the partition as active.</para></listitem> | ||
4030 | <listitem><para><emphasis><filename>--align (in KBytes)</filename>:</emphasis> | ||
4031 | This option is specific to the Meego Image | ||
4032 | Creator (mic) that says to start a partition on an | ||
4033 | x KBytes boundary.</para></listitem> | ||
4034 | </itemizedlist> | ||
4035 | </para> | ||
4036 | </section> | ||
4037 | |||
4038 | <section id='command-bootloader'> | ||
4039 | <title>Command: bootloader</title> | ||
4040 | |||
4041 | <para> | ||
4042 | This command specifies how the boot loader should be | ||
4043 | and supports the following options: | ||
4044 | <itemizedlist> | ||
4045 | <listitem><para><emphasis><filename>--timeout</filename>:</emphasis> | ||
4046 | Specifies the number of seconds before the | ||
4047 | bootloader times out and boots the default option. | ||
4048 | </para></listitem> | ||
4049 | <listitem><para><emphasis><filename>--append</filename>:</emphasis> | ||
4050 | Specifies kernel parameters. | ||
4051 | These will be added to the syslinux | ||
4052 | <filename>APPEND</filename> or | ||
4053 | <filename>grub</filename> kernel command line. | ||
4054 | </para> | ||
4055 | <para>The boot type is determined by the fstype of | ||
4056 | the <filename>/boot</filename> mountpoint. | ||
4057 | If the fstype is "msdos" the boot type is | ||
4058 | "pcbios", otherwise it is the fstype, which | ||
4059 | is currently "efi" (more to be added later). | ||
4060 | </para> | ||
4061 | <para>If the boot type is "efi", the image will | ||
4062 | use <filename>grub</filename> and has one | ||
4063 | menuentry: "boot".</para> | ||
4064 | <para>If the boot type is "pcbios", the image | ||
4065 | will use syslinux and has one menu label: "boot". | ||
4066 | </para> | ||
4067 | <para>Future updates will implement more options. | ||
4068 | If you use anything that is not specifically | ||
4069 | supported, results can be unpredictable. | ||
4070 | </para></listitem> | ||
4071 | </itemizedlist> | ||
4072 | </para> | ||
4073 | </section> | ||
4074 | </section> | ||
4075 | </section> | ||
4076 | |||
3351 | <section id='configuring-the-kernel'> | 4077 | <section id='configuring-the-kernel'> |
3352 | <title>Configuring the Kernel</title> | 4078 | <title>Configuring the Kernel</title> |
3353 | 4079 | ||