diff options
author | Scott Rifenbark <srifenbark@gmail.com> | 2016-12-29 10:26:15 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-11 17:23:17 +0000 |
commit | ecaab75be6be1147caad0900278df534cec2e89e (patch) | |
tree | a2260b8e9ff51f08609b4067b091018c2d9ba7be | |
parent | d229fded3ecb2332bb8602a4924990417385cf09 (diff) | |
download | poky-ecaab75be6be1147caad0900278df534cec2e89e.tar.gz |
dev-manual, ref-manual: Created new section on initramfs
Fixes [YOCTO #7096]
We did not document how to create an initramfs image to be included
with a kernel build. Various variables sort of inferred the
knowledge. I created a new section in the "Common Tasks" section
of the dev-manual that describes how to create an initramfs image.
Also, I updated the kernel.bbclass reference section to point back
to the new "how-to" section.
Finally, I also created a bunch of cross-reference links from various
related variables back to the new "how-to" section.
(From yocto-docs rev: 289dfbd5d24241e42446a043104eecd6dca76f13)
Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | documentation/dev-manual/dev-manual-common-tasks.xml | 73 | ||||
-rw-r--r-- | documentation/ref-manual/ref-classes.xml | 21 | ||||
-rw-r--r-- | documentation/ref-manual/ref-variables.xml | 50 |
3 files changed, 124 insertions, 20 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index 603ca1ff8e..f3f2a4b026 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml | |||
@@ -5475,6 +5475,79 @@ | |||
5475 | </section> | 5475 | </section> |
5476 | </section> | 5476 | </section> |
5477 | 5477 | ||
5478 | <section id='building-an-initramfs-image'> | ||
5479 | <title>Building an Initial RAM Filesystem (initramfs) Image</title> | ||
5480 | |||
5481 | <para> | ||
5482 | initramfs is the successor of Initial RAM Disk (initrd). | ||
5483 | It is a "copy in and out" (cpio) archive of the initial file system | ||
5484 | that gets loaded into memory during the Linux startup process. | ||
5485 | Because Linux uses the contents of the archive during | ||
5486 | initialization, the initramfs needs to contain all of the device | ||
5487 | drivers and tools needed to mount the final root filesystem. | ||
5488 | </para> | ||
5489 | |||
5490 | <para> | ||
5491 | To build an initramfs image and bundle it into the kernel, set the | ||
5492 | following variables: | ||
5493 | <literallayout class='monospaced'> | ||
5494 | INITRAMFS_IMAGE_BUNDLE = "1" | ||
5495 | INITRAMFS_IMAGE = "<replaceable>image_recipe_name</replaceable>" | ||
5496 | </literallayout> | ||
5497 | Setting the | ||
5498 | <ulink url='&YOCTO_DOCS_REF_URL;#var-INITRAMFS_IMAGE_BUNDLE'><filename>INITRAMFS_IMAGE_BUNDLE</filename></ulink> | ||
5499 | flag causes the initramfs created by the recipe | ||
5500 | and defined by | ||
5501 | <ulink url='&YOCTO_DOCS_REF_URL;#var-INITRAMFS_IMAGE'><filename>INITRAMFS_IMAGE</filename></ulink> | ||
5502 | to be unpacked into the <filename>${B}/usr/</filename> directory. | ||
5503 | The unpacked initramfs is then passed to the kernel's | ||
5504 | <filename>Makefile</filename> using the | ||
5505 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CONFIG_INITRAMFS_SOURCE'><filename>CONFIG_INITRAMFS_SOURCE</filename></ulink> | ||
5506 | variable, allowing initramfs to be built in to the kernel | ||
5507 | normally. | ||
5508 | <note> | ||
5509 | The preferred method is to use the | ||
5510 | <filename>INITRAMFS_IMAGE</filename> variable rather than the | ||
5511 | <filename>INITRAMFS_TASK</filename> variable. | ||
5512 | Setting <filename>INITRAMFS_TASK</filename> is supported for | ||
5513 | backward compatibility. | ||
5514 | However, use of this variable has circular dependency | ||
5515 | problems. | ||
5516 | See the | ||
5517 | <ulink url='&YOCTO_DOCS_REF_URL;#var-INITRAMFS_IMAGE_BUNDLE'><filename>INITRAMFS_IMAGE_BUNDLE</filename></ulink> | ||
5518 | variable for additional information on these dependency | ||
5519 | problems. | ||
5520 | </note> | ||
5521 | </para> | ||
5522 | |||
5523 | <para> | ||
5524 | The recipe that <filename>INITRAMFS_IMAGE</filename> | ||
5525 | points to must produce a <filename>.cpio.gz</filename>, | ||
5526 | <filename>.cpio.tar</filename>, <filename>.cpio.lz4</filename>, | ||
5527 | <filename>.cpio.lzma</filename>, or | ||
5528 | <filename>.cpio.xz</filename> file. | ||
5529 | You can ensure you produce one of these <filename>.cpio.*</filename> | ||
5530 | files by setting the | ||
5531 | <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_FSTYPES'><filename>IMAGE_FSTYPES</filename></ulink> | ||
5532 | variable in your configuration file to one or more of the above | ||
5533 | file types. | ||
5534 | <note> | ||
5535 | If you add items to the initramfs image by way of its recipe, | ||
5536 | you should use | ||
5537 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGE_INSTALL'><filename>PACKAGE_INSTALL</filename></ulink> | ||
5538 | rather than | ||
5539 | <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_INSTALL'><filename>IMAGE_INSTALL</filename></ulink>. | ||
5540 | <filename>PACKAGE_INSTALL</filename> gives more direct control | ||
5541 | of what is added to the image as compared to the defaults you | ||
5542 | might not necessarily want that are set by the | ||
5543 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-image'><filename>image</filename></ulink> | ||
5544 | or | ||
5545 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-core-image'><filename>core-image</filename></ulink> | ||
5546 | classes. | ||
5547 | </note> | ||
5548 | </para> | ||
5549 | </section> | ||
5550 | |||
5478 | <section id='configuring-the-kernel'> | 5551 | <section id='configuring-the-kernel'> |
5479 | <title>Configuring the Kernel</title> | 5552 | <title>Configuring the Kernel</title> |
5480 | 5553 | ||
diff --git a/documentation/ref-manual/ref-classes.xml b/documentation/ref-manual/ref-classes.xml index 2344a0406a..f7b1126d7c 100644 --- a/documentation/ref-manual/ref-classes.xml +++ b/documentation/ref-manual/ref-classes.xml | |||
@@ -1873,11 +1873,22 @@ | |||
1873 | </para> | 1873 | </para> |
1874 | 1874 | ||
1875 | <para> | 1875 | <para> |
1876 | This means that each built kernel module is packaged separately and inter-module | 1876 | This means that each built kernel module is packaged separately and |
1877 | dependencies are created by parsing the <filename>modinfo</filename> output. | 1877 | inter-module dependencies are created by parsing the |
1878 | If all modules are required, then installing the <filename>kernel-modules</filename> | 1878 | <filename>modinfo</filename> output. |
1879 | package installs all packages with modules and various other kernel packages | 1879 | If all modules are required, then installing the |
1880 | such as <filename>kernel-vmlinux</filename>. | 1880 | <filename>kernel-modules</filename> package installs all packages with |
1881 | modules and various other kernel packages such as | ||
1882 | <filename>kernel-vmlinux</filename>. | ||
1883 | </para> | ||
1884 | |||
1885 | <para> | ||
1886 | The <filename>kernel</filename> class contains logic that allows | ||
1887 | you to embed an initial RAM filesystem (initramfs) image when | ||
1888 | you build the kernel image. | ||
1889 | For information on how to build an initramfs, see the | ||
1890 | "<ulink url='&YOCTO_DOCS_DEV_URL;#building-an-initramfs-image'>Building an Initial RAM Filesystem (initramfs) Image</ulink>" | ||
1891 | section in the Yocto Project Development Manual. | ||
1881 | </para> | 1892 | </para> |
1882 | 1893 | ||
1883 | <para> | 1894 | <para> |
diff --git a/documentation/ref-manual/ref-variables.xml b/documentation/ref-manual/ref-variables.xml index 0f6535cea1..a696ee4e66 100644 --- a/documentation/ref-manual/ref-variables.xml +++ b/documentation/ref-manual/ref-variables.xml | |||
@@ -2273,12 +2273,13 @@ | |||
2273 | 2273 | ||
2274 | <glossentry id='var-CONFIG_INITRAMFS_SOURCE'><glossterm>CONFIG_INITRAMFS_SOURCE</glossterm> | 2274 | <glossentry id='var-CONFIG_INITRAMFS_SOURCE'><glossterm>CONFIG_INITRAMFS_SOURCE</glossterm> |
2275 | <info> | 2275 | <info> |
2276 | CONFIG_INITRAMFS_SOURCE[doc] = "Identifies the initial RAM disk (initramfs) source files. The OpenEmbedded build system receives and uses this kernel Kconfig variable as an environment variable." | 2276 | CONFIG_INITRAMFS_SOURCE[doc] = "Identifies the initial RAM filesystem (initramfs) source files. The OpenEmbedded build system receives and uses this kernel Kconfig variable as an environment variable." |
2277 | </info> | 2277 | </info> |
2278 | <glossdef> | 2278 | <glossdef> |
2279 | <para role="glossdeffirst"> | 2279 | <para role="glossdeffirst"> |
2280 | <!-- <para role="glossdeffirst"><imagedata fileref="figures/define-generic.png" /> --> | 2280 | <!-- <para role="glossdeffirst"><imagedata fileref="figures/define-generic.png" /> --> |
2281 | Identifies the initial RAM disk (initramfs) source files. | 2281 | Identifies the initial RAM filesystem (initramfs) source |
2282 | files. | ||
2282 | The OpenEmbedded build system receives and uses | 2283 | The OpenEmbedded build system receives and uses |
2283 | this kernel Kconfig variable as an environment variable. | 2284 | this kernel Kconfig variable as an environment variable. |
2284 | By default, the variable is set to null (""). | 2285 | By default, the variable is set to null (""). |
@@ -2304,6 +2305,12 @@ | |||
2304 | If you specify multiple directories and files, the | 2305 | If you specify multiple directories and files, the |
2305 | initramfs image will be the aggregate of all of them. | 2306 | initramfs image will be the aggregate of all of them. |
2306 | </para> | 2307 | </para> |
2308 | |||
2309 | <para> | ||
2310 | For information on creating an initramfs, see the | ||
2311 | "<ulink url='&YOCTO_DOCS_DEV_URL;#building-an-initramfs-image'>Building an Initial RAM Filesystem (initramfs) Image</ulink>" | ||
2312 | section in the Yocto Project Development Manual. | ||
2313 | </para> | ||
2307 | </glossdef> | 2314 | </glossdef> |
2308 | </glossentry> | 2315 | </glossentry> |
2309 | 2316 | ||
@@ -5405,9 +5412,12 @@ | |||
5405 | variable to specify packages for installation. | 5412 | variable to specify packages for installation. |
5406 | Instead, use the | 5413 | Instead, use the |
5407 | <link linkend='var-PACKAGE_INSTALL'><filename>PACKAGE_INSTALL</filename></link> | 5414 | <link linkend='var-PACKAGE_INSTALL'><filename>PACKAGE_INSTALL</filename></link> |
5408 | variable, which allows the initial RAM disk (initramfs) | 5415 | variable, which allows the initial RAM filesystem |
5409 | recipe to use a fixed set of packages and not be | 5416 | (initramfs) recipe to use a fixed set of packages and |
5410 | affected by <filename>IMAGE_INSTALL</filename>. | 5417 | not be affected by <filename>IMAGE_INSTALL</filename>. |
5418 | For information on creating an initramfs, see the | ||
5419 | "<ulink url='&YOCTO_DOCS_DEV_URL;#building-an-initramfs-image'>Building an Initial RAM Filesystem (initramfs) Image</ulink>" | ||
5420 | section in the Yocto Project Development Manual. | ||
5411 | </note> | 5421 | </note> |
5412 | </para> | 5422 | </para> |
5413 | 5423 | ||
@@ -6133,13 +6143,13 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" | |||
6133 | 6143 | ||
6134 | <glossentry id='var-INITRAMFS_FSTYPES'><glossterm>INITRAMFS_FSTYPES</glossterm> | 6144 | <glossentry id='var-INITRAMFS_FSTYPES'><glossterm>INITRAMFS_FSTYPES</glossterm> |
6135 | <info> | 6145 | <info> |
6136 | INITRAMFS_FSTYPES[doc] = "Defines the format for the output image of an initial RAM disk (initramfs), which is used during boot." | 6146 | INITRAMFS_FSTYPES[doc] = "Defines the format for the output image of an initial RAM filesystem (initramfs), which is used during boot." |
6137 | </info> | 6147 | </info> |
6138 | <glossdef> | 6148 | <glossdef> |
6139 | <para role="glossdeffirst"> | 6149 | <para role="glossdeffirst"> |
6140 | <!-- <para role="glossdeffirst"><imagedata fileref="figures/define-generic.png" /> --> | 6150 | <!-- <para role="glossdeffirst"><imagedata fileref="figures/define-generic.png" /> --> |
6141 | Defines the format for the output image of an initial | 6151 | Defines the format for the output image of an initial |
6142 | RAM disk (initramfs), which is used during boot. | 6152 | RAM filesystem (initramfs), which is used during boot. |
6143 | Supported formats are the same as those supported by the | 6153 | Supported formats are the same as those supported by the |
6144 | <link linkend='var-IMAGE_FSTYPES'><filename>IMAGE_FSTYPES</filename></link> | 6154 | <link linkend='var-IMAGE_FSTYPES'><filename>IMAGE_FSTYPES</filename></link> |
6145 | variable. | 6155 | variable. |
@@ -6152,7 +6162,7 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" | |||
6152 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>, | 6162 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>, |
6153 | is "cpio.gz". | 6163 | is "cpio.gz". |
6154 | The Linux kernel's initramfs mechanism, as opposed to the | 6164 | The Linux kernel's initramfs mechanism, as opposed to the |
6155 | initial RAM disk | 6165 | initial RAM filesystem |
6156 | <ulink url='https://en.wikipedia.org/wiki/Initrd'>initrd</ulink> | 6166 | <ulink url='https://en.wikipedia.org/wiki/Initrd'>initrd</ulink> |
6157 | mechanism, expects an optionally compressed cpio | 6167 | mechanism, expects an optionally compressed cpio |
6158 | archive. | 6168 | archive. |
@@ -6162,7 +6172,7 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" | |||
6162 | 6172 | ||
6163 | <glossentry id='var-INITRAMFS_IMAGE'><glossterm>INITRAMFS_IMAGE</glossterm> | 6173 | <glossentry id='var-INITRAMFS_IMAGE'><glossterm>INITRAMFS_IMAGE</glossterm> |
6164 | <info> | 6174 | <info> |
6165 | INITRAMFS_IMAGE[doc] = "Specifies the PROVIDES name of an image recipe that is used to build an initial RAM disk (initramfs) image." | 6175 | INITRAMFS_IMAGE[doc] = "Specifies the PROVIDES name of an image recipe that is used to build an initial RAM filesystem (initramfs) image." |
6166 | </info> | 6176 | </info> |
6167 | <glossdef> | 6177 | <glossdef> |
6168 | <para role="glossdeffirst"> | 6178 | <para role="glossdeffirst"> |
@@ -6170,7 +6180,7 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" | |||
6170 | Specifies the | 6180 | Specifies the |
6171 | <link linkend='var-PROVIDES'><filename>PROVIDES</filename></link> | 6181 | <link linkend='var-PROVIDES'><filename>PROVIDES</filename></link> |
6172 | name of an image recipe that is used to build an initial | 6182 | name of an image recipe that is used to build an initial |
6173 | RAM disk (initramfs) image. | 6183 | RAM filesystem (initramfs) image. |
6174 | An initramfs provides a temporary root filesystem used for | 6184 | An initramfs provides a temporary root filesystem used for |
6175 | early system initialization (e.g. loading of modules | 6185 | early system initialization (e.g. loading of modules |
6176 | needed to locate and mount the "real" root filesystem). | 6186 | needed to locate and mount the "real" root filesystem). |
@@ -6211,17 +6221,21 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" | |||
6211 | </para> | 6221 | </para> |
6212 | 6222 | ||
6213 | <para> | 6223 | <para> |
6214 | Finally, for more information you can also see the | 6224 | For more information, you can also see the |
6215 | <link linkend='var-INITRAMFS_IMAGE_BUNDLE'><filename>INITRAMFS_IMAGE_BUNDLE</filename></link> | 6225 | <link linkend='var-INITRAMFS_IMAGE_BUNDLE'><filename>INITRAMFS_IMAGE_BUNDLE</filename></link> |
6216 | variable, which allows the generated image to be bundled | 6226 | variable, which allows the generated image to be bundled |
6217 | inside the kernel image. | 6227 | inside the kernel image. |
6228 | Additionally, for information on creating an initramfs, see | ||
6229 | the | ||
6230 | "<ulink url='&YOCTO_DOCS_DEV_URL;#building-an-initramfs-image'>Building an Initial RAM Filesystem (initramfs) Image</ulink>" | ||
6231 | section in the Yocto Project Development Manual. | ||
6218 | </para> | 6232 | </para> |
6219 | </glossdef> | 6233 | </glossdef> |
6220 | </glossentry> | 6234 | </glossentry> |
6221 | 6235 | ||
6222 | <glossentry id='var-INITRAMFS_IMAGE_BUNDLE'><glossterm>INITRAMFS_IMAGE_BUNDLE</glossterm> | 6236 | <glossentry id='var-INITRAMFS_IMAGE_BUNDLE'><glossterm>INITRAMFS_IMAGE_BUNDLE</glossterm> |
6223 | <info> | 6237 | <info> |
6224 | INITRAMFS_IMAGE_BUNDLE[doc] = "Controls whether or not the image recipe specified by INITRAMFS_IMAGE is run through an extra pass (do_bundle_initramfs) during kernel compilation in order to build a single binary that contains both the kernel image and the initial RAM disk (initramfs)." | 6238 | INITRAMFS_IMAGE_BUNDLE[doc] = "Controls whether or not the image recipe specified by INITRAMFS_IMAGE is run through an extra pass (do_bundle_initramfs) during kernel compilation in order to build a single binary that contains both the kernel image and the initial RAM filesystem (initramfs)." |
6225 | </info> | 6239 | </info> |
6226 | <glossdef> | 6240 | <glossdef> |
6227 | <para role="glossdeffirst"> | 6241 | <para role="glossdeffirst"> |
@@ -6231,8 +6245,8 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" | |||
6231 | is run through an extra pass | 6245 | is run through an extra pass |
6232 | (<link linkend='ref-tasks-bundle_initramfs'><filename>do_bundle_initramfs</filename></link>) | 6246 | (<link linkend='ref-tasks-bundle_initramfs'><filename>do_bundle_initramfs</filename></link>) |
6233 | during kernel compilation in order to build a single binary | 6247 | during kernel compilation in order to build a single binary |
6234 | that contains both the kernel image and the initial RAM disk | 6248 | that contains both the kernel image and the initial RAM |
6235 | (initramfs). | 6249 | filesystem (initramfs) image. |
6236 | This makes use of the | 6250 | This makes use of the |
6237 | <link linkend='var-CONFIG_INITRAMFS_SOURCE'><filename>CONFIG_INITRAMFS_SOURCE</filename></link> | 6251 | <link linkend='var-CONFIG_INITRAMFS_SOURCE'><filename>CONFIG_INITRAMFS_SOURCE</filename></link> |
6238 | kernel feature. | 6252 | kernel feature. |
@@ -6279,6 +6293,9 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" | |||
6279 | See the | 6293 | See the |
6280 | <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta-poky/conf/local.conf.sample.extended'><filename>local.conf.sample.extended</filename></ulink> | 6294 | <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta-poky/conf/local.conf.sample.extended'><filename>local.conf.sample.extended</filename></ulink> |
6281 | file for additional information. | 6295 | file for additional information. |
6296 | Also, for information on creating an initramfs, see the | ||
6297 | "<ulink url='&YOCTO_DOCS_DEV_URL;#building-an-initramfs-image'>Building an Initial RAM Filesystem (initramfs) Image</ulink>" | ||
6298 | section in the Yocto Project Development Manual. | ||
6282 | </para> | 6299 | </para> |
6283 | </glossdef> | 6300 | </glossdef> |
6284 | </glossentry> | 6301 | </glossentry> |
@@ -9105,9 +9122,12 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" | |||
9105 | the | 9122 | the |
9106 | <link linkend='images-core-image-minimal-initramfs'><filename>core-image-minimal-initramfs</filename></link> | 9123 | <link linkend='images-core-image-minimal-initramfs'><filename>core-image-minimal-initramfs</filename></link> |
9107 | image. | 9124 | image. |
9108 | When working with an initial RAM disk (initramfs) | 9125 | When working with an initial RAM filesystem (initramfs) |
9109 | image, use the <filename>PACKAGE_INSTALL</filename> | 9126 | image, use the <filename>PACKAGE_INSTALL</filename> |
9110 | variable. | 9127 | variable. |
9128 | For information on creating an initramfs, see the | ||
9129 | "<ulink url='&YOCTO_DOCS_DEV_URL;#building-an-initramfs-image'>Building an Initial RAM Filesystem (initramfs) Image</ulink>" | ||
9130 | section in the Yocto Project Development Manual. | ||
9111 | </para> | 9131 | </para> |
9112 | </glossdef> | 9132 | </glossdef> |
9113 | </glossentry> | 9133 | </glossentry> |