diff options
Diffstat (limited to 'documentation/dev-manual/building.rst')
-rw-r--r-- | documentation/dev-manual/building.rst | 84 |
1 files changed, 83 insertions, 1 deletions
diff --git a/documentation/dev-manual/building.rst b/documentation/dev-manual/building.rst index fe502690dd..4770a5a184 100644 --- a/documentation/dev-manual/building.rst +++ b/documentation/dev-manual/building.rst | |||
@@ -280,7 +280,9 @@ Follow these steps to create an :term:`Initramfs` image: | |||
280 | #. *Create the Initramfs Image Recipe:* You can reference the | 280 | #. *Create the Initramfs Image Recipe:* You can reference the |
281 | ``core-image-minimal-initramfs.bb`` recipe found in the | 281 | ``core-image-minimal-initramfs.bb`` recipe found in the |
282 | ``meta/recipes-core`` directory of the :term:`Source Directory` | 282 | ``meta/recipes-core`` directory of the :term:`Source Directory` |
283 | as an example from which to work. | 283 | as an example from which to work. The ``core-image-minimal-initramfs`` recipe |
284 | is based on the :ref:`initramfs-framework <dev-manual/building:Customizing an | ||
285 | Initramfs using \`\`initramfs-framework\`\`>` recipe described below. | ||
284 | 286 | ||
285 | #. *Decide if You Need to Bundle the Initramfs Image Into the Kernel | 287 | #. *Decide if You Need to Bundle the Initramfs Image Into the Kernel |
286 | Image:* If you want the :term:`Initramfs` image that is built to be bundled | 288 | Image:* If you want the :term:`Initramfs` image that is built to be bundled |
@@ -308,6 +310,86 @@ Follow these steps to create an :term:`Initramfs` image: | |||
308 | and bundled with the kernel image if you used the | 310 | and bundled with the kernel image if you used the |
309 | :term:`INITRAMFS_IMAGE_BUNDLE` variable described earlier. | 311 | :term:`INITRAMFS_IMAGE_BUNDLE` variable described earlier. |
310 | 312 | ||
313 | Customizing an Initramfs using ``initramfs-framework`` | ||
314 | ------------------------------------------------------ | ||
315 | |||
316 | The ``core-image-minimal-initramfs.bb`` recipe found in | ||
317 | :oe_git:`meta/recipes-core/images | ||
318 | </openembedded-core/tree/meta/recipes-core/images>` uses the | ||
319 | :oe_git:`initramfs-framework_1.0.bb | ||
320 | </openembedded-core/tree/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb>` | ||
321 | recipe as its base component. The goal of the ``initramfs-framework`` recipe is | ||
322 | to provide the building blocks to build a customized :term:`Initramfs`. | ||
323 | |||
324 | The ``initramfs-framework`` recipe relies on shell initialization scripts | ||
325 | defined in :oe_git:`meta/recipes-core/initrdscripts/initramfs-framework | ||
326 | </openembedded-core/tree/meta/recipes-core/initrdscripts/initramfs-framework>`. Since some of | ||
327 | these scripts do not apply for all use cases, the ``initramfs-framework`` recipe | ||
328 | defines different packages: | ||
329 | |||
330 | - ``initramfs-framework-base``: this package installs the basic components of | ||
331 | an :term:`Initramfs`, such as the ``init`` script or the ``/dev/console`` | ||
332 | character special file. As this package is a runtime dependency of all | ||
333 | modules listed below, it is automatically pulled in when one of the modules | ||
334 | is installed in the image. | ||
335 | - ``initramfs-module-exec``: support for execution of applications. | ||
336 | - ``initramfs-module-mdev``: support for `mdev | ||
337 | <https://wiki.gentoo.org/wiki/Mdev>`__. | ||
338 | - ``initramfs-module-udev``: support for :wikipedia:`Udev <Udev>`. | ||
339 | - ``initramfs-module-e2fs``: support for :wikipedia:`ext4/ext3/ext2 | ||
340 | <Extended_file_system>` filesystems. | ||
341 | - ``initramfs-module-nfsrootfs``: support for locating and mounting the root | ||
342 | partition via :wikipedia:`NFS <Network_File_System>`. | ||
343 | - ``initramfs-module-rootfs``: support for locating and mounting the root | ||
344 | partition. | ||
345 | - ``initramfs-module-debug``: dynamic debug support. | ||
346 | - ``initramfs-module-lvm``: :wikipedia:`LVM <Logical_volume_management>` rootfs support. | ||
347 | - ``initramfs-module-overlayroot``: support for mounting a read-write overlay | ||
348 | on top of a read-only root filesystem. | ||
349 | |||
350 | In addition to the packages defined by the ``initramfs-framework`` recipe | ||
351 | itself, the following packages are defined by the recipes present in | ||
352 | :oe_git:`meta/recipes-core/initrdscripts </openembedded-core/tree/meta/recipes-core/initrdscripts>`: | ||
353 | |||
354 | - ``initramfs-module-install``: module to create and install a partition layout | ||
355 | on a selected block device. | ||
356 | - ``initramfs-module-install-efi``: module to create and install an EFI | ||
357 | partition layout on a selected block device. | ||
358 | - ``initramfs-module-setup-live``: module to start a shell in the | ||
359 | :term:`Initramfs` if ``root=/dev/ram0`` in passed in the `Kernel command-line | ||
360 | <https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html>`__ | ||
361 | or the ``root=`` parameter was not passed. | ||
362 | |||
363 | To customize the :term:`Initramfs`, you can add or remove packages listed | ||
364 | earlier from the :term:`PACKAGE_INSTALL` variable with a :ref:`bbappend | ||
365 | <dev-manual/layers:Appending Other Layers Metadata With Your Layer>` on the | ||
366 | ``core-image-minimal-initramfs`` recipe, or create a custom recipe for the | ||
367 | :term:`Initramfs` taking ``core-image-minimal-initramfs`` as example. | ||
368 | |||
369 | Custom scripts can be added to the :term:`Initramfs` by writing your own | ||
370 | recipes. The recipes are conventionally named ``initramfs-module-<module name>`` | ||
371 | where ``<module name>`` is the name of the module. The recipe should set its | ||
372 | :term:`RDEPENDS` package-specific variables to include | ||
373 | ``initramfs-framework-base`` and the other packages on which the module depends | ||
374 | at runtime. | ||
375 | |||
376 | The recipe must install shell initialization scripts in :term:`${D} <D>`\ | ||
377 | ``/init.d`` and must follow the ``<number>-<script name>`` naming scheme where: | ||
378 | |||
379 | - ``<number>`` is a *two-digit* number that affects the execution order of the | ||
380 | script compared to others. For example, the script ``80-setup-live`` would be | ||
381 | executed after ``01-udev`` because 80 is greater than 01. | ||
382 | |||
383 | This number being two-digits is important here as the scripts are executed | ||
384 | alphabetically. For example, the script ``10-script`` would be executed | ||
385 | before the script ``8-script``, because ``1`` is inferior to ``8``. | ||
386 | Therefore, the script should be named ``08-script``. | ||
387 | |||
388 | - ``<script name>`` is the script name which you can choose freely. | ||
389 | |||
390 | If two script use the same ``<number>``, they are sorted alphabetically based | ||
391 | on ``<script name>``. | ||
392 | |||
311 | Bundling an Initramfs Image From a Separate Multiconfig | 393 | Bundling an Initramfs Image From a Separate Multiconfig |
312 | ------------------------------------------------------- | 394 | ------------------------------------------------------- |
313 | 395 | ||