summaryrefslogtreecommitdiffstats
path: root/documentation/dev-manual
diff options
context:
space:
mode:
authorScott Rifenbark <scott.m.rifenbark@intel.com>2013-11-13 17:14:56 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-12-03 12:53:56 +0000
commitb0c4c855a0d5d4d2efcdf4da4b06e943be310887 (patch)
tree58867f056d53d8e110b7820a405d36f22422399b /documentation/dev-manual
parentfa191d48825d97e324e57e628a0ce2d720c2e06d (diff)
downloadpoky-b0c4c855a0d5d4d2efcdf4da4b06e943be310887.tar.gz
dev-manual: More work on the new wic section.
I am working through the raw text. Not clear through yet but needed to commit this. (From yocto-docs rev: 4da28c311443ad31a0a36b07b39aa7ce4180b49c) Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/dev-manual')
-rw-r--r--documentation/dev-manual/dev-manual-common-tasks.xml769
1 files changed, 374 insertions, 395 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml
index 1d2d74927c..305dc316b4 100644
--- a/documentation/dev-manual/dev-manual-common-tasks.xml
+++ b/documentation/dev-manual/dev-manual-common-tasks.xml
@@ -1926,18 +1926,16 @@
1926 that image as is on your device. 1926 that image as is on your device.
1927 Physical devices accept and boot images in various ways depending 1927 Physical devices accept and boot images in various ways depending
1928 on the specifics of the device. 1928 on the specifics of the device.
1929 Usually information about the hardware can tell you what image 1929 Usually, information about the hardware can tell you what image
1930 format the device requires. 1930 format the device requires.
1931 Should your device require multiple partitions on an SD card, flash, 1931 Should your device require multiple partitions on an SD card, flash,
1932 or an HDD, you can use the OpenEmbedded Image Creator 1932 or an HDD, you can use the OpenEmbedded Image Creator
1933 (<filename>wic</filename>) to create the properly partitioned image. 1933 () to create the properly partitioned image.
1934 </para> 1934 </para>
1935 1935
1936 <para> 1936 <para>
1937 Using the <filename>wic</filename> command, you can also describe 1937 The <filename>wic</filename> command generates partitioned images
1938 your desired final image and have BitBake assemble the image. 1938 from existing OpenEmbedded build artifacts.
1939 The 'wic' command generates partitioned images from existing
1940 OpenEmbedded build artifacts.
1941 Image generation is driven by partitioning commands contained 1939 Image generation is driven by partitioning commands contained
1942 in an Openembedded kickstart file (<filename>.wks</filename>) 1940 in an Openembedded kickstart file (<filename>.wks</filename>)
1943 specified either directly on the command-line or as one of a 1941 specified either directly on the command-line or as one of a
@@ -1949,28 +1947,53 @@
1949 </para> 1947 </para>
1950 1948
1951 <para> 1949 <para>
1952 'wic' is based loosely on the 'mic' (Meego Image Creator) framework, 1950 This section provides some background information on
1953but heavily modified to make direct use of OpenEmbedded build 1951 <filename>wic</filename>, describes what you need to have in
1954artifacts instead of package installation and configuration, things 1952 place to run the tool, provides instruction on how to use
1955already incorporated in the OE artifacts. 1953 <filename>wic</filename>, and provides several examples.
1956 </para> 1954 </para>
1957 1955
1958 <note> 1956 <section id='wic-background'>
1959The name 'wic' comes from 'oeic', which stands for 'OpenEmbedded 1957 <title>Background</title>
1960Image Creator'. The 'oe' diphthong in 'oeic' has been promoted to the
1961letter 'w', because 'oeic' is impossible to remember or pronounce.
1962 </note>
1963 1958
1964 <note> 1959 <para>
1965This is a completely independent standalone utility that 1960 This section provides some background on the
1966initially provides easier-to-use and more flexible replacements for a 1961 <filename>wic</filename> utility.
1967couple bits of existing functionality in oe-core: directdisk.bbclass 1962 While none of this information is required to use
1968and mkefidisk.sh. The replaced scripts are implemented by a 1963 <filename>wic</filename>, you might find it interesting.
1969general-purpose partitioning 'language' based on Red Hat kickstart 1964 <itemizedlist>
1970syntax (with the underlying code borrowed from Tizen mic, which in 1965 <listitem><para>
1971turn was borrowed from Meego mic, in turn borrowed from Fedora livecd, 1966 The name "wic" is derived from OpenEmbedded
1972etc.). 1967 Image Creator (oeic).
1973 </note> 1968 The "oe" diphthong in "oeic" was promoted to the
1969 letter "w", because "oeic" is both difficult to remember and
1970 pronounce.</para></listitem>
1971 <listitem><para>
1972 <filename>wic</filename> is loosely based on the
1973 Meego Image Creator (<filename>mic</filename>)
1974 framework.
1975 The <filename>wic</filename> implementation has been
1976 heavily modified to make direct use of OpenEmbedded
1977 build artifacts instead of package installation and
1978 configuration, which are already incorporated within
1979 the OpenEmbedded artifacts.</para></listitem>
1980 <listitem><para>
1981 <filename>wic</filename> is a completely independent
1982 standalone utility that initially provides
1983 easier-to-use and more flexible replacements for a
1984 couple bits of existing functionality in OE Core's
1985 <filename>directdisk.bbclass</filename> and
1986 <filename>mkefidisk.sh</filename> script.
1987 The replaced scripts are implemented by a
1988 general-purpose partitioning language based on Red Hat
1989 kickstart syntax.
1990 Underlying code for <filename>wic</filename> succeeded
1991 from several projects over time.</para></listitem>
1992 </itemizedlist>
1993 </para>
1994 </section>
1995
1996<!--
1974 1997
1975 <para> 1998 <para>
1976 This section covers the mechanics of invoking and providing help for 1999 This section covers the mechanics of invoking and providing help for
@@ -1996,310 +2019,233 @@ or missing feature of the tool, please file a bug report describing
1996the details. 2019the details.
1997 </note> 2020 </note>
1998 2021
1999 <section id='requirements'> 2022-->
2000 <title>Requirements</title>
2001 2023
2002 <para> 2024 <section id='wic-requirements'>
2003 wic has only been tested on and is only designed to work on the 2025 <title>Requirements</title>
2004distros officially supported by Yocto.
2005 </para>
2006 2026
2007 <para> 2027 <para>
2008 Aside from the standard system utilities, such as 'cp', wic expects the 2028 In order to use the <filename>wic</filename> utility with the
2009following utilities to be installed on the host machine: 2029 OpenEmbedded Build system, you need to meet the following
2030 requirements:
2010 <itemizedlist> 2031 <itemizedlist>
2011 <listitem><para><emphasis>parted:</emphasis> 2032 <listitem><para>The Linux distribution on your
2012 GNU Parted - a partition manipulation program 2033 development host must support the Yocto Project.
2034 See the
2035 "<ulink url='&YOCTO_DOCS_REF_URL;#detailed-supported-distros'>Supported Linux Distributions</ulink>"
2036 section in the Yocto Project Reference Manual for this
2037 list of distributions.</para></listitem>
2038 <listitem><para>
2039 The standard system utilities, such as
2040 <filename>cp</filename>, must be installed on your
2041 development host system.
2042 </para></listitem>
2043 <listitem><para>
2044 The
2045 <ulink url='http://www.gnu.org/software/parted/'>GNU Parted</ulink>
2046 package must be installed on your development host
2047 system.
2048 </para></listitem>
2049 <listitem><para>
2050 Have the build artifacts already available.
2051 You must already have created an image using the
2052 Openembedded build system (e.g.
2053 <filename>core-image-minimal</filename>.
2054 It might seem redundant to generate an image in order
2055 to create an image using <filename>wic</filename>,
2056 but the artifacts are needed and they are generated
2057 with the build system.</para></listitem>
2058 <listitem><para>
2059 You must have sourced one of the build environment
2060 setup scripts (i.e.
2061 <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink>
2062 or
2063 <ulink url='&YOCTO_DOCS_REF_URL;#structure-memres-core-script'><filename>oe-init-build-env-memres</filename></ulink>)
2064 found in the
2065 <link linkend='build-directory'>Build Directory</link>.
2013 </para></listitem> 2066 </para></listitem>
2014 </itemizedlist> 2067 </itemizedlist>
2015 </para> 2068 </para>
2016 </section> 2069 </section>
2017 2070
2018 <section id='raw-vs-cooked-mode'> 2071 <section id='wic-getting-help'>
2019 <title>Raw Vs. Cooked Mode</title> 2072 <title>Getting Help</title>
2020 2073
2021 <para> 2074 <para>
2022 'wic' can be used in 'raw' mode, where artifacts are explicitly 2075 You can get general help for the <filename>wic</filename>
2023specified via command-line arguments (see the command documentation 2076 by entering the <filename>wic</filename> command by itself
2024and examples below), or it can be used in a more easily usable 2077 or by entering the command with a help argument as follows:
2025'cooked' mode which uses the current MACHINE setting and a specified 2078 <literallayout class='monospaced'>
2026image name to automatically locate the artifacts used to create the 2079 $ wic -h
2027image. 2080 $ wic --help
2081 </literallayout>
2028 </para> 2082 </para>
2029 2083
2030 <note>
2031 The prerequisite for generating any image is to have the build
2032artifacts already available. For example, to create a 'wic' image
2033using the build artifacts from a core-image-minimal build, you must
2034already have created a core-image-minimal OpenembeddedCore image. It
2035may seem redundant to generate an OpenEmbedded image in order to
2036create a 'wic' image, and in fact to some degree it is. At the
2037moment, however, that's typically how build artifacts are generated,
2038and future versions will likely be more integrated into the build
2039system and will be able to skip that step. There is a benefit
2040however, in that 'wic' images are created more quickly and without the
2041need for root access.
2042 </note>
2043 </section>
2044
2045 <section id='command-summary'>
2046 <title>Command Summary</title>
2047
2048 <para> 2084 <para>
2049 The general form of the 'wic' command in raw mode is: 2085 Currently, <filename>wic</filename> supports two commands:
2086 <filename>create</filename> and <filename>list</filename>.
2087 You can get help for these commands as follows:
2050 <literallayout class='monospaced'> 2088 <literallayout class='monospaced'>
2051 $ wic create myimage.wks -r &lt;rootfs-dir&gt; -b &lt;bootimg-dir&gt; 2089 $ wic help &lt;command&gt;
2052 -k &lt;kernel-dir&gt; -n &lt;native-sysroot&gt;
2053 </literallayout> 2090 </literallayout>
2054 <note>
2055 The 'wic' does NOT require root privileges, and in fact should
2056not be run as root.
2057 </note>
2058 </para> 2091 </para>
2059 2092
2060 <para> 2093 <para>
2061 The .wks file specified in the command is an OE kickstart file (see 2094 You can find more out about the images
2062the OE kickstart syntax section below) and can of course be specified 2095 <filename>wic</filename> creates using the provided
2063directly on the command-line, but the user can also choose from a set 2096 kickstart files with the following form of the command:
2064of 'canned' .wks files available via the 'wic list images' command 2097 <literallayout class='monospaced'>
2065(example below). 2098 $ wic list &lt;image&gt; help
2099 </literallayout>
2100 Where <filename>&lt;image&gt;</filename> is either
2101 <filename>directdisk</filename> or
2102 <filename>mkefidisk</filename>.
2066 </para> 2103 </para>
2104 </section>
2105
2106 <section id='operational-modes'>
2107 <title>Operational Modes</title>
2067 2108
2068 <para> 2109 <para>
2069 The -r, -b, -k, and -n options refer to the corresponding OpenEmbedded 2110 You can run <filename>wic</filename> in two modes: Raw and
2070build artifacts. Using OpenEmbedded terminology: 2111 Cooked:
2071 <itemizedlist> 2112 <itemizedlist>
2072 <listitem><para><emphasis>-r option:</emphasis> 2113 <listitem><para><emphasis>Raw Mode:</emphasis>
2073 Used to specify the path to the /rootfs dir to 2114 You explicitly specify build artifacts through
2074 use as the .wks rootfs source.</para></listitem> 2115 command-line arguments.</para></listitem>
2075 <listitem><para><emphasis>-b option:</emphasis> 2116 <listitem><para><emphasis>Cooked Mode:</emphasis>
2076 Used to specify the path to the dir containing 2117 The current
2077 the boot artifacts (e.g. /EFI or /syslinux dirs) to use as the 2118 <ulink url='&YOCTO_DOCS_REF_URL;var-MACHINE'><filename>MACHINE</filename></ulink>
2078 .wks bootimg source.</para></listitem> 2119 setting and image name are used to automatically locate
2079 <listitem><para><emphasis>-k option:</emphasis> 2120 and provide the build artifacts.</para></listitem>
2080 Used to specify the path to the dir containing
2081 the kernel to use in the .wks bootimg.
2082 </para></listitem>
2083 <listitem><para><emphasis>-n option:</emphasis>
2084 Used to specify the path to the native sysroot
2085 containing the tools to use to build the image.
2086 </para></listitem>
2087 </itemizedlist> 2121 </itemizedlist>
2088 </para> 2122 </para>
2089 2123
2090 <para> 2124 <section id='raw-mode'>
2091 For more technical detail on the origin and meanings of those 2125 <title>Raw Mode</title>
2092artifacts, see the Yocto documentation corresponding to those topics
2093elsewhere. In most cases, it's not important to know that, because
2094'cooked' mode provides a convenient shortcut allowing the user to
2095forget about the raw details and simply specify artifacts via a
2096high-level OpenEmbedded image name.
2097 </para>
2098 2126
2099 <para> 2127 <para>
2100 If instead of specifying a user-defined .wks file, you prefer to use 2128 The general form of the 'wic' command in raw mode is:
2101one of the 'canned' wic images, you can simply specify a canned image 2129 <literallayout class='monospaced'>
2102name (without the .wks extension) in place of a .wks file. Use 'wic 2130 $ wic create &lt;image_name&gt;.wks -r &lt;rootfs_dir&gt; -b &lt;bootimg_dir&gt; /
2103list images' to get a list of 'canned' images: 2131 -k &lt;kernel_dir&gt; -n &lt;native_sysroot&gt;
2104 <literallayout class='monospaced'> 2132 </literallayout>
2105 $ wic list images 2133 <note>
2106 mkefidisk Create an EFI disk image 2134 You do not need root privileges to run
2107 directdisk Create a 'pcbios' direct disk image 2135 <filename>wic</filename>.
2108 </literallayout> 2136 In fact, you should not run as root when using the
2109 To use one of the canned images, simply specify it in the raw command. 2137 utility.
2110For example: 2138 </note>
2111 <literallayout class='monospaced'> 2139 </para>
2112 $ wic create directdisk -r &lt;rootfs-dir&gt; -b &lt;bootimg-dir&gt;
2113 -k &lt;kernel-dir&gt; -n &lt;native-sysroot&gt;
2114 </literallayout>
2115 Finally, the general form of the 'wic' command in cooked mode is:
2116 <literallayout class='monospaced'>
2117 $ wic create directdisk -e &lt;image-name&gt;
2118 </literallayout>
2119 This form is the simplest and most user-friendly, as it allows you to
2120skip the need for specifying all the parameters individually.
2121 </para>
2122 2140
2123 <para> 2141 <para>
2124 <filename>&lt;image-name&gt;</filename> refers to the Openembedded image name that you've already 2142 Following is a description of the <filename>wic</filename>
2125build the artifacts for, for example, 'core-image-minimal'. 2143 parameters and options:
2126 <note> 2144 <itemizedlist>
2127 In order to use cooked mode, you must have the machine that you 2145 <listitem><para><emphasis><filename>&lt;image_name&gt;.wks</filename>:</emphasis>
2128built the artifacts with selected in local.conf. 2146 An OpenEmbedded kickstart file.
2129 </note> 2147 You can provide your own custom file or use a
2130 </para> 2148 file from a set of provided files as described
2131 </section> 2149 following this list.</para></listitem>
2150 <listitem><para><emphasis><filename>-r &lt;rootfs_dir&gt;</filename>:</emphasis>
2151 Specifies the path to the root filesystem directory
2152 to be used and the <filename>.wks</filename>
2153 root filesystem source.</para></listitem>
2154 <listitem><para><emphasis><filename>-b &lt;bootimg_dir&gt;</filename>:</emphasis>
2155 Specifies the path to the directory that contains
2156 the boot artifacts (e.g. the
2157 <filename>EFI</filename> or
2158 <filename>syslinux</filename> directories) to use
2159 as the <filename>.wks</filename> boot image source.
2160 </para></listitem>
2161 <listitem><para><emphasis><filename>-k &lt;kernel_dir&gt;</filename>:</emphasis>
2162 Specifies the path to the dir containing the kernel
2163 to use in the <filename>.wks</filename> boot
2164 image.</para></listitem>
2165 <listitem><para><emphasis><filename>-n &lt;native_sysroot&gt;</filename>:</emphasis>
2166 Specifies the path to the native sysroot
2167 that contains the tools used to build the image.
2168 </para></listitem>
2169 </itemizedlist>
2170 </para>
2171 </section>
2132 2172
2133 <section id='wic-usage-examples'> 2173 <section id='cooked-mode'>
2134 <title>'wic' Usage Examples</title> 2174 <title>Cooked Mode</title>
2135 2175
2136 <para> 2176 <para>
2137 As mentioned, the main prerequisite for generating any image is to 2177 The general form of the <filename>wic</filename> command
2138have the build artifacts already available. The below examples assume 2178 using Cooked Mode is:
2139the user has already built a 'core-image-minimal' for a specific 2179 <literallayout class='monospaced'>
2140machine (future versions won't require this redundant step, but for 2180 $ wic create &lt;kickstart_file&gt; -e &lt;image_name&gt;
2141now that's typically how build artifacts get generated). 2181 </literallayout>
2142 </para> 2182 This form is the simplest and most user-friendly, as it
2183 does not requre specifying all individual parameters.
2184 All you need to provide is your own
2185 <filename>.wks</filename> file or one provided with the
2186 release.
2187 </para>
2188
2189 <para>
2190 Following is a description of the <filename>wic</filename>
2191 parameters and options:
2192 <itemizedlist>
2193 <listitem><para><emphasis><filename>&lt;kickstart&gt;</filename>:</emphasis>
2194 An OpenEmbedded kickstart file.
2195 You can provide your own custom file or supplied
2196 file.</para></listitem>
2197 <listitem><para><emphasis><filename>-e &lt;image_name&gt;</filename>:</emphasis>
2198 Specifies the image built using the OpenEmbedded
2199 build system.</para></listitem>
2200 </itemizedlist>
2201 </para>
2202 </section>
2203 </section>
2204
2205 <section id='using-a-provided-kickstart_file'>
2206 <title>Using a Provided Kickstart File</title>
2143 2207
2144 <para> 2208 <para>
2145 The other prerequisite is to source the build environment: 2209 If you do not want to create your own
2146 <literallayout class='monospaced'> 2210 <filename>.wks</filename> file, you can use a provided
2147 $ source oe-init-build-env 2211 file.
2148 </literallayout> 2212 Use the following command to list the available files:
2149 To start out with, we'll generate an image from one of the canned .wks
2150files. The following generates a list of available images:
2151 <literallayout class='monospaced'> 2213 <literallayout class='monospaced'>
2152 $ wic list images 2214 $ wic list images
2153 mkefidisk Create an EFI disk image 2215 mkefidisk Create an EFI disk image
2154 directdisk Create a 'pcbios' direct disk image 2216 directdisk Create a 'pcbios' direct disk image
2217 </literallayout>
2218 When you use a provided file, you do not have to use the
2219 <filename>.wks</filename> extension.
2220 Here is an example in Raw Mode that uses the
2221 <filename>directdisk</filename> file:
2222 <literallayout class='monospaced'>
2223 $ wic create directdisk -r &lt;rootfs_dir&gt; -b &lt;bootimg_dir&gt; \
2224 -k &lt;kernel_dir&gt; -n &lt;native_sysroot&gt;
2155 </literallayout> 2225 </literallayout>
2156 You can get more information about any of the available images by typing
2157'wic list xxx help', where 'xxx' is one of the image names.
2158 </para>
2159
2160 <para>
2161 For example:
2162 <literallayout class='monospaced'>
2163 $ wic list mkefidisk help
2164 </literallayout>
2165 Creates a partitioned EFI disk image that the user
2166can directly dd to boot media.
2167 </para> 2226 </para>
2227 </section>
2168 2228
2169 <para> 2229 <section id='wic-usage-examples'>
2170 At any time, you can get help on the 'wic' command or any subcommand 2230 <title>Examples</title>
2171(currently 'list' and 'create'). For instance, to get the description
2172of 'wic create' command and its parameters:
2173 <literallayout class='monospaced'>
2174 $ wic create
2175
2176 Usage:
2177
2178 Create a new OpenEmbedded image
2179
2180 usage: wic create &lt;wks file or image name&gt; [-o &lt;DIRNAME&gt; | --outdir &lt;DIRNAME&gt;]
2181 [-i &lt;JSON PROPERTY FILE&gt; | --infile &lt;JSON PROPERTY FILE&gt;]
2182 [-e | --image-name] [-r, --rootfs-dir] [-b, --bootimg-dir]
2183 [-k, --kernel-dir] [-n, --native-sysroot] [-s, --skip-build-check]
2184
2185 This command creates an OpenEmbedded image based on the 'OE kickstart
2186 commands' found in the &lt;wks file&gt;.
2187
2188 The -o option can be used to place the image in a directory with a
2189 different name and location.
2190
2191 See 'wic help create' for more detailed instructions.
2192
2193 [...]
2194 </literallayout>
2195 </para>
2196 2231
2197 <para> 2232 <para>
2198 Continuing further, as mentioned in the command, you can get even more 2233 This section provides several examples that show how to use
2199detailed information by adding 'help' to the above: 2234 the <filename>wic</filename> utility.
2200 <literallayout class='monospaced'> 2235 All the examples assume the list of requirements in the
2201 $ wic help create 2236 "<link linkend='wic-requirements'>Requirements</link>" section
2202 2237 have been met.
2203 NAME 2238 The examples assume the previously generated image is
2204 wic create - Create a new OpenEmbedded image 2239 <filename>core-image-minimal</filename>.
2205
2206 SYNOPSIS
2207 wic create &lt;wks file or image name&gt; [-o &lt;DIRNAME&gt; | --outdir &lt;DIRNAME&gt;]
2208 [-i &lt;JSON PROPERTY FILE&gt; | --infile &lt;JSON PROPERTY FILE&gt;]
2209 [-e | --image-name] [-r, --rootfs-dir] [-b, --bootimg-dir]
2210 [-k, --kernel-dir] [-n, --native-sysroot] [-s,
2211 --skip-build-check]
2212
2213 DESCRIPTION
2214 This command creates an OpenEmbedded image based on the 'OE
2215 kickstart commands' found in the &lt;wks file&gt;.
2216
2217 In order to do this, wic needs to know the locations of the
2218 various build artifacts required to build the image.
2219
2220 Users can explicitly specify the build artifact locations using
2221 the -r, -b, -k, and -n options. See below for details on where
2222 the corresponding artifacts are typically found in a normal
2223 OpenEmbedded build.
2224
2225 Alternatively, users can use the -e option to have 'mic' determine
2226 those locations for a given image. If the -e option is used, the
2227 user needs to have set the appropriate MACHINE variable in
2228 local.conf, and have sourced the build environment.
2229
2230 The -e option is used to specify the name of the image to use the
2231 artifacts from e.g. core-image-sato.
2232
2233 The -r option is used to specify the path to the /rootfs dir to
2234 use as the .wks rootfs source.
2235
2236 The -b option is used to specify the path to the dir containing
2237 the boot artifacts (e.g. /EFI or /syslinux dirs) to use as the
2238 .wks bootimg source.
2239
2240 The -k option is used to specify the path to the dir containing
2241 the kernel to use in the .wks bootimg.
2242
2243 The -n option is used to specify the path to the native sysroot
2244 containing the tools to use to build the image.
2245
2246 The -s option is used to skip the build check. The build check is
2247 a simple sanity check used to determine whether the user has
2248 sourced the build environment so that the -e option can operate
2249 correctly. If the user has specified the build artifact locations
2250 explicitly, 'wic' assumes the user knows what he or she is doing
2251 and skips the build check.
2252
2253 When 'wic -e' is used, the locations for the build artifacts
2254 values are determined by 'wic -e' from the output of the 'bitbake
2255 -e' command given an image name e.g. 'core-image-minimal' and a
2256 given machine set in local.conf. In that case, the image is
2257 created as if the following 'bitbake -e' variables were used:
2258
2259 -r: IMAGE_ROOTFS
2260 -k: STAGING_KERNEL_DIR
2261 -n: STAGING_DIR_NATIVE
2262 -b: HDDDIR and STAGING_DATA_DIR (handlers decide which to use)
2263
2264 If 'wic -e' is not used, the user needs to select the appropriate
2265 value for -b (as well as -r, -k, and -n).
2266
2267 The -o option can be used to place the image in a directory with a
2268 different name and location.
2269
2270 As an alternative to the wks file, the image-specific properties
2271 that define the values that will be used to generate a particular
2272 image can be specified on the command-line using the -i option and
2273 supplying a JSON object consisting of the set of name:value pairs
2274 needed by image creation.
2275
2276 The set of properties available for a given image type can be
2277 listed using the 'wic list' command.
2278 </literallayout>
2279 So, the easiest way to create an image is to use the -e option with a
2280canned .wks file. To use the -e option, you need to specify the image
2281used to generate the artifacts and you actually need to have the
2282MACHINE used to build them specified in your local.conf (these
2283requirements aren't necessary if you aren't using the -e options.
2284 </para> 2240 </para>
2285 2241
2286 <para> 2242 <section id='generate-an-image-using-a-provided-kickstart-file'>
2287 Below, we generate a mkefidisk image, pointing the process at the 2243 <title>Generate an Image using a Provided Kickstart File</title>
2288core-image-minimal artifacts for the minnow, selected as our current
2289MACHINE in local.conf.
2290 </para>
2291 2244
2292 <para> 2245 <para>
2293 First, once we've set the build up, we run a core-image-minimal minnow 2246 This example runs in Cooked Mode and uses the
2294build: 2247 <filename>mkefidisk</filename> kickstart file:
2295 <literallayout class='monospaced'> 2248 <literallayout class='monospaced'>
2296 $ bitbake core-image-minimal
2297 </literallayout>
2298 Once the build is finished, we can then use wic to create an EFI image
2299for the minnow to boot. In this case, we'll use the '-e' option to
2300have wic discover the appropriate build artifacts and generate the
2301image:
2302 <literallayout class='monospaced'>
2303 $ wic create mkefidisk -e core-image-minimal 2249 $ wic create mkefidisk -e core-image-minimal
2304 Checking basic build environment... 2250 Checking basic build environment...
2305 Done. 2251 Done.
@@ -2318,86 +2264,118 @@ image:
2318 2264
2319 The image(s) were created using OE kickstart file: 2265 The image(s) were created using OE kickstart file:
2320 /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/mkefidisk.wks 2266 /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/mkefidisk.wks
2321 </literallayout> 2267 </literallayout>
2322 The output specifies exactly which image was created and where it was 2268 This example shows the easiest way to create an image
2323created. It also names the artifacts that were used and the exact 2269 by running in Cooked Mode and using the
2324.wks script that was used to generate the image. You should always 2270 <filename>&lt;-e&gt;</filename> option with a
2325verify the details provided in the output to make sure that the image 2271 provided kickstart file.
2326was indeed created exactly as expected. 2272 All that is necessary is to specify the image
2327 </para> 2273 used to generate the artifacts.
2274 Your <filename>local.conf</filename> needs to have the
2275 <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink>
2276 variable set to the machine you are using, which is
2277 "minnow" in this example.
2278 </para>
2328 2279
2329 <para> 2280 <para>
2330 Using the path specified in the output for the image name and 2281 The output specifies exactly which image were
2331location, you can now directly dd the image to a USB stick or whatever 2282 created and where the image was created.
2332media you built the image for, and boot the resulting media: 2283 The output also names the artifacts used and the exact
2333 <literallayout class='monospaced'> 2284 <filename>.wks</filename> script that was used to generate
2285 the image.
2286 <note>
2287 You should always verify the details provided in the
2288 output to make sure that the imagewas indeed created
2289 exactly as expected.
2290 </note>
2291 </para>
2292
2293 <para>
2294 Continuing with the example, you can now directly
2295 <filename>dd</filename> the image to a USB stick, or
2296 whatever media for which you built your image,
2297 and boot the resulting media:
2298 <literallayout class='monospaced'>
2334 $ sudo dd if=/var/tmp/wic/build/mkefidisk-201310230946-sda.direct of=/dev/sdb 2299 $ sudo dd if=/var/tmp/wic/build/mkefidisk-201310230946-sda.direct of=/dev/sdb
2335 [sudo] password for trz: 2300 [sudo] password for trz:
2336 182274+0 records in 2301 182274+0 records in
2337 182274+0 records out 2302 182274+0 records out
2338 93324288 bytes (93 MB) copied, 14.4777 s, 6.4 MB/s 2303 93324288 bytes (93 MB) copied, 14.4777 s, 6.4 MB/s
2339 [trz@empanada ~]$ sudo eject /dev/sdb 2304 [trz@empanada ~]$ sudo eject /dev/sdb
2340 </literallayout> 2305 </literallayout>
2341 The next example uses a modified 'directdisk' script as an example. 2306 </para>
2342 </para> 2307 </section>
2343
2344 <para>
2345 Because wic image creation is driven by .wks files, it's easy to
2346change the parameters that drive image creation: simply modify the
2347.wks file.
2348 </para>
2349 2308
2350 <para> 2309 <section id='using-a-modified-kickstart-file'>
2351 As illustrated previously, 'wic list images' provides a list of 2310 <title>Using a Modified Kickstart File</title>
2352available images. The images displayed are simply the list of .wks
2353files in the scripts/lib/image/canned-wks/ directory, minus the .wks
2354extension.
2355 </para>
2356 2311
2357 <para> 2312 <para>
2358 To add a new image to that list, simply add a new .wks file. 2313 Because <filename>wic</filename> image creation is driven
2359 </para> 2314 by the kickstart file, it is easy to drive image creation
2315 by changing the parameters in the file.
2316 This next example demonstrates that through modification
2317 of the <filename>directdisk</filename> kickstart file.
2318 </para>
2360 2319
2361 <para> 2320 <para>
2362 For this example, we already have a .wks file that already does pretty 2321 As mentioned earlier, you can use the command
2363much what we want, but for our particular hardware, we know we'll be 2322 <filename>wic list images</filename> to show the list
2364booting from sdb instead of sda, which is what the directdisk script uses. 2323 of provided kickstart files.
2365 </para> 2324 The directory in which these files reside is in the
2325 <link linkend='source-directory'>Source Directory</link>
2326 in <filename>scripts/lib/image/canned-wks/</filename>.
2327 Because the available files reside in this directory, you
2328 can create and add your own custom files to the directory.
2329 Subsequent use of the <filename>wic list images</filename>
2330 command would then include your kickstart files.
2331 </para>
2366 2332
2367 <para> 2333 <para>
2368 What we can do is simply create a copy of the directdisk.wks file in 2334 In this example, the existing
2369the scripts/lib/image/canned-wks/ directory and change the lines that 2335 <filename>directdisk</filename> file already does most
2370specify the target disk to boot from. 2336 of what is needed.
2371 </para> 2337 However, for the hardware in this example, the image will
2338 need to boot from <filename>sdb</filename> instead of
2339 <filename>sda</filename>, which is what the
2340 <filename>directdisk</filename> kickstart file uses.
2341 </para>
2372 2342
2373 <para> 2343 <para>
2374 First, we copy the directdisk.wks file to directdisksdb.wks: 2344 The example begins by making a copy of the
2375 <literallayout class='monospaced'> 2345 <filename>directdisk.wks</filename> file in the
2346 <filename>scripts/lib/image/canned-wks</filename>
2347 directory and then changing the lines that specify the
2348 target disk from which to boot.
2349 <literallayout class='monospaced'>
2376 $ cp /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/directdisk.wks /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/directdisksdb.wks 2350 $ cp /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/directdisk.wks /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/directdisksdb.wks
2377 </literallayout> 2351 </literallayout>
2378 Then we modify the directdisksdb.wks file and change all instances of 2352 Next, the example modifies the
2379'--ondisk sda' to '--ondisk sdb'. The following two lines are the 2353 <filename>directdisksdb.wks</filename> file and changes all
2380lines we end up changing (leaving the rest alone): 2354 instances of "<filename>--ondisk sda</filename>"
2381 <literallayout class='monospaced'> 2355 to "<filename>--ondisk sdb</filename>".
2356 The example changes the following two lines and leaves the
2357 remaining lines untouched:
2358 <literallayout class='monospaced'>
2382 part /boot --source bootimg --ondisk sdb --fstype=msdos --label boot --active --align 1024 2359 part /boot --source bootimg --ondisk sdb --fstype=msdos --label boot --active --align 1024
2383 part / --source rootfs --ondisk sdb --fstype=ext3 --label platform --align 1024 2360 part / --source rootfs --ondisk sdb --fstype=ext3 --label platform --align 1024
2384 </literallayout> 2361 </literallayout>
2385 Once we've made that change, we generate a directdisksdb image, 2362 (I AM HERE)
2363 Once the lines are changed, Once we've made that change, we generate a directdisksdb image,
2386pointing the process at the core-image-minimal artifacts for the nuc 2364pointing the process at the core-image-minimal artifacts for the nuc
2387(Next Unit of Computing), selected as our current MACHINE in 2365(Next Unit of Computing), selected as our current MACHINE in
2388local.conf. 2366local.conf.
2389 </para> 2367 </para>
2390 2368
2391 <para> 2369 <para>
2392 Once we've set the build up, we run a core-image-minimal nuc build: 2370 Once we've set the build up, we run a core-image-minimal nuc build:
2393 <literallayout class='monospaced'> 2371 <literallayout class='monospaced'>
2394 $ bitbake core-image-minimal 2372 $ bitbake core-image-minimal
2395 </literallayout> 2373 </literallayout>
2396 Once the build is finished, we can then use nuc to create our 2374 Once the build is finished, we can then use nuc to create our
2397directdisk image for the nuc to boot. In this case, we'll use the 2375directdisk image for the nuc to boot. In this case, we'll use the
2398'-e' option to have wic discover the appropriate build artifacts and 2376'-e' option to have wic discover the appropriate build artifacts and
2399generate the image: 2377generate the image:
2400 <literallayout class='monospaced'> 2378 <literallayout class='monospaced'>
2401 $ wic create directdisksdb -e core-image-minimal 2379 $ wic create directdisksdb -e core-image-minimal
2402 Checking basic build environment... 2380 Checking basic build environment...
2403 Done. 2381 Done.
@@ -2416,25 +2394,25 @@ generate the image:
2416 2394
2417 The image(s) were created using OE kickstart file: 2395 The image(s) were created using OE kickstart file:
2418 /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/directdisksdb.wks 2396 /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/directdisksdb.wks
2419 </literallayout> 2397 </literallayout>
2420 Using the path specified in the output for the image name and 2398 Using the path specified in the output for the image name and
2421location, you can now directly dd the image to a USB stick or whatever 2399location, you can now directly dd the image to a USB stick or whatever
2422media you built the image for, and boot the resulting media: 2400media you built the image for, and boot the resulting media:
2423 <literallayout class='monospaced'> 2401 <literallayout class='monospaced'>
2424 $ sudo dd if=/var/tmp/wic/build/directdisksdb-201310231131-sdb.direct of=/dev/sdb 2402 $ sudo dd if=/var/tmp/wic/build/directdisksdb-201310231131-sdb.direct of=/dev/sdb
2425 86018+0 records in 2403 86018+0 records in
2426 86018+0 records out 2404 86018+0 records out
2427 44041216 bytes (44 MB) copied, 13.0734 s, 3.4 MB/s 2405 44041216 bytes (44 MB) copied, 13.0734 s, 3.4 MB/s
2428 [trz@empanada tmp]$ sudo eject /dev/sdb 2406 [trz@empanada tmp]$ sudo eject /dev/sdb
2429 </literallayout> 2407 </literallayout>
2430 Of course, you can just use the directdisk image directly if you don't 2408 Of course, you can just use the directdisk image directly if you don't
2431have any special needs. 2409have any special needs.
2432 </para> 2410 </para>
2433 2411
2434 <para> 2412 <para>
2435 Here'we're creating a wic image based on core-image-minimal and 2413 Here'we're creating a wic image based on core-image-minimal and
2436crownbay-noemgd, which works right out of the box. 2414crownbay-noemgd, which works right out of the box.
2437 <literallayout class='monospaced'> 2415 <literallayout class='monospaced'>
2438 $ wic create directdisk -e core-image-minimal 2416 $ wic create directdisk -e core-image-minimal
2439 2417
2440 Checking basic build environment... 2418 Checking basic build environment...
@@ -2454,12 +2432,12 @@ crownbay-noemgd, which works right out of the box.
2454 2432
2455 The image(s) were created using OE kickstart file: 2433 The image(s) were created using OE kickstart file:
2456 /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/directdisk.wks 2434 /home/trz/yocto/yocto-image/scripts/lib/image/canned-wks/directdisk.wks
2457 </literallayout> 2435 </literallayout>
2458 Finally, here's an example that doesn't take the easy way out and 2436 Finally, here's an example that doesn't take the easy way out and
2459manually specifies each build artifact, along with a non-canned .wks 2437manually specifies each build artifact, along with a non-canned .wks
2460file, and also uses the -o option to have wic create the output 2438file, and also uses the -o option to have wic create the output
2461somewhere other than the default /var/tmp/wic: 2439somewhere other than the default /var/tmp/wic:
2462 <literallayout class='monospaced'> 2440 <literallayout class='monospaced'>
2463 $ wic create ~/test.wks -o /home/trz/testwic --rootfs-dir /home/trz/yocto/yocto-image/build/tmp/work/crownbay_noemgd-poky-linux/core-image-minimal/1.0-r0/rootfs --bootimg-dir /home/trz/yocto/yocto-image/build/tmp/sysroots/crownbay-noemgd/usr/share --kernel-dir /home/trz/yocto/yocto-image/build/tmp/sysroots/crownbay-noemgd/usr/src/kernel --native-sysroot /home/trz/yocto/yocto-image/build/tmp/sysroots/x86_64-linux 2441 $ wic create ~/test.wks -o /home/trz/testwic --rootfs-dir /home/trz/yocto/yocto-image/build/tmp/work/crownbay_noemgd-poky-linux/core-image-minimal/1.0-r0/rootfs --bootimg-dir /home/trz/yocto/yocto-image/build/tmp/sysroots/crownbay-noemgd/usr/share --kernel-dir /home/trz/yocto/yocto-image/build/tmp/sysroots/crownbay-noemgd/usr/src/kernel --native-sysroot /home/trz/yocto/yocto-image/build/tmp/sysroots/x86_64-linux
2464 2442
2465 Creating image(s)... 2443 Creating image(s)...
@@ -2476,17 +2454,17 @@ somewhere other than the default /var/tmp/wic:
2476 2454
2477 The image(s) were created using OE kickstart file: 2455 The image(s) were created using OE kickstart file:
2478 /home/trz/test.wks 2456 /home/trz/test.wks
2479 </literallayout> 2457 </literallayout>
2480 In this case, we didn't need to have the proper machine selected in 2458 In this case, we didn't need to have the proper machine selected in
2481local.conf - we manually specified each artifact and therefore wic 2459local.conf - we manually specified each artifact and therefore wic
2482doesn't need further information from the build system. 2460doesn't need further information from the build system.
2483 </para> 2461 </para>
2484 2462
2485 <para> 2463 <para>
2486 Finally, here's an example of the actual partition language commands 2464 Finally, here's an example of the actual partition language commands
2487used to generate the mkefidisk image i.e. these are the contents of the 2465used to generate the mkefidisk image i.e. these are the contents of the
2488mkefidisk.wks OE kickstart file: 2466mkefidisk.wks OE kickstart file:
2489 <literallayout class='monospaced'> 2467 <literallayout class='monospaced'>
2490 # short-description: Create an EFI disk image 2468 # short-description: Create an EFI disk image
2491 # long-description: Creates a partitioned EFI disk image that the user 2469 # long-description: Creates a partitioned EFI disk image that the user
2492 # can directly dd to boot media. 2470 # can directly dd to boot media.
@@ -2498,56 +2476,56 @@ mkefidisk.wks OE kickstart file:
2498 part swap --ondisk sda --size 44 --label swap1 --fstype=swap 2476 part swap --ondisk sda --size 44 --label swap1 --fstype=swap
2499 2477
2500 bootloader --timeout=10 --append="rootwait rootfstype=ext3 console=ttyPCH0,115200 console=tty0 vmalloc=256MB snd-hda- intel.enable_msi=0" 2478 bootloader --timeout=10 --append="rootwait rootfstype=ext3 console=ttyPCH0,115200 console=tty0 vmalloc=256MB snd-hda- intel.enable_msi=0"
2501 </literallayout> 2479 </literallayout>
2502 </para> 2480 </para>
2481 </section>
2503 </section> 2482 </section>
2504 </section>
2505 2483
2506 <section id='openembedded-kickstart-wks-reference'> 2484 <section id='openembedded-kickstart-wks-reference'>
2507 <title>OpenEmbedded Kickstart (.wks) Reference</title> 2485 <title>OpenEmbedded Kickstart (.wks) Reference</title>
2508 2486
2509 <para> 2487 <para>
2510 The current 'wic' implementation supports only the basic kickstart 2488 The current 'wic' implementation supports only the basic kickstart
2511partitioning commands: 'partition' (or 'part' for short) and 2489partitioning commands: 'partition' (or 'part' for short) and
2512'bootloader'. 2490'bootloader'.
2513 </para> 2491 </para>
2514 2492
2515 <para> 2493 <para>
2516 They are listed below and mostly follow the syntax and meaning of the 2494 They are listed below and mostly follow the syntax and meaning of the
2517standard kickstart options for those commands. The documentation below 2495standard kickstart options for those commands. The documentation below
2518is based on the Fedora kickstart documentation of the same commands, 2496is based on the Fedora kickstart documentation of the same commands,
2519but modified to reflect wic capabilities. For reference: 2497but modified to reflect wic capabilities. For reference:
2520 <literallayout class='monospaced'> 2498 <literallayout class='monospaced'>
2521 http://fedoraproject.org/wiki/Anaconda/Kickstart#part_or_partition 2499 http://fedoraproject.org/wiki/Anaconda/Kickstart#part_or_partition
2522 http://fedoraproject.org/wiki/Anaconda/Kickstart#bootloader 2500 http://fedoraproject.org/wiki/Anaconda/Kickstart#bootloader
2523 </literallayout> 2501 </literallayout>
2524 </para> 2502 </para>
2525 2503
2526 <section id='command-part-or-partition'> 2504 <section id='command-part-or-partition'>
2527 <title>Command: part or partition</title> 2505 <title>Command: part or partition</title>
2528 2506
2529 <para> 2507 <para>
2530 Creates a partition on the system. 2508 Creates a partition on the system.
2531 Use the following syntax: 2509 Use the following syntax:
2532 <literallayout class='monospaced'> 2510 <literallayout class='monospaced'>
2533 part &lt;mntpoint&gt; 2511 part &lt;mntpoint&gt;
2534 </literallayout> 2512 </literallayout>
2535 The &lt;mntpoint&gt; is where the partition will be mounted and must be of 2513 The &lt;mntpoint&gt; is where the partition will be mounted and must be of
2536one of the following forms: 2514one of the following forms:
2537 <itemizedlist> 2515 <itemizedlist>
2538 <listitem><para><filename>/&lt;path&gt;</filename>: 2516 <listitem><para><filename>/&lt;path&gt;</filename>:
2539 For example, <filename>/</filename>, 2517 For example, <filename>/</filename>,
2540 <filename>/usr</filename>, and 2518 <filename>/usr</filename>, and
2541 <filename>/home</filename></para></listitem> 2519 <filename>/home</filename></para></listitem>
2542 <listitem><para><filename>swap</filename>: 2520 <listitem><para><filename>swap</filename>:
2543 The partition will be used as swap space. 2521 The partition will be used as swap space.
2544 </para></listitem> 2522 </para></listitem>
2545 </itemizedlist> 2523 </itemizedlist>
2546 </para> 2524 </para>
2547 2525
2548 <para> 2526 <para>
2549 Following are the supported options: 2527 Following are the supported options:
2550 <literallayout class='monospaced'> 2528 <literallayout class='monospaced'>
2551 --size 2529 --size
2552 The minimum partition size in megabytes. Specify an integer value 2530 The minimum partition size in megabytes. Specify an integer value
2553 here such as 500. Do not append the number with MB. Not needed if 2531 here such as 500. Do not append the number with MB. Not needed if
@@ -2597,20 +2575,20 @@ one of the following forms:
2597 --align (in kB) 2575 --align (in kB)
2598 The '--align' option is a mic-specific option that says to start a 2576 The '--align' option is a mic-specific option that says to start a
2599 partition on an x kB boundary. 2577 partition on an x kB boundary.
2600 </literallayout> 2578 </literallayout>
2601 </para> 2579 </para>
2602 </section> 2580 </section>
2603 2581
2604 <section id='command-bootloader'> 2582 <section id='command-bootloader'>
2605 <title>Command: bootloader</title> 2583 <title>Command: bootloader</title>
2606 2584
2607 <para> 2585 <para>
2608 This command specifies how the boot loader should be installed. 2586 This command specifies how the boot loader should be installed.
2609 </para> 2587 </para>
2610 2588
2611 <para> 2589 <para>
2612 Following are the supported options: 2590 Following are the supported options:
2613 <literallayout class='monospaced'> 2591 <literallayout class='monospaced'>
2614 --timeout 2592 --timeout
2615 Specify the number of seconds before the bootloader times out and 2593 Specify the number of seconds before the bootloader times out and
2616 boots the default option. 2594 boots the default option.
@@ -2631,8 +2609,9 @@ one of the following forms:
2631 2609
2632 Future updates will implement more options - using anything not 2610 Future updates will implement more options - using anything not
2633 explicitly supported can result in unpredictable results. 2611 explicitly supported can result in unpredictable results.
2634 </literallayout> 2612 </literallayout>
2635 </para> 2613 </para>
2614 </section>
2636 </section> 2615 </section>
2637 </section> 2616 </section>
2638 2617