diff options
-rw-r--r-- | documentation/ref-manual/classes.rst | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst index 1b685370c4..5c60fd8c82 100644 --- a/documentation/ref-manual/classes.rst +++ b/documentation/ref-manual/classes.rst | |||
@@ -1710,6 +1710,55 @@ one such example. However, being aware of this class can reduce the | |||
1710 | proliferation of different versions of similar classes across multiple | 1710 | proliferation of different versions of similar classes across multiple |
1711 | layers. | 1711 | layers. |
1712 | 1712 | ||
1713 | .. _ref-classes-overlayfs: | ||
1714 | |||
1715 | ``overlayfs.bbclass`` | ||
1716 | ======================= | ||
1717 | |||
1718 | It's often desired in Embedded System design to have a read-only rootfs. | ||
1719 | But a lot of different applications might want to have read-write access to | ||
1720 | some parts of a filesystem. It can be especially useful when your update mechanism | ||
1721 | overwrites the whole rootfs, but you may want your application data to be preserved | ||
1722 | between updates. The :ref:`overlayfs <ref-classes-overlayfs>` class provides a way | ||
1723 | to achieve that by means of ``overlayfs`` and at the same time keeping the base | ||
1724 | rootfs read-only. | ||
1725 | |||
1726 | To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper | ||
1727 | layer in your machine configuration. The underlying file system can be anything that | ||
1728 | is supported by ``overlayfs``. This has to be done in your machine configuration:: | ||
1729 | |||
1730 | OVERLAYFS_MOUNT_POINT[data] = "/data" | ||
1731 | |||
1732 | .. note:: | ||
1733 | |||
1734 | * QA checks fail to catch file existence if you redefine this variable in your recipe! | ||
1735 | * Only the existence of the systemd mount unit file is checked, not its contents. | ||
1736 | * To get more details on ``overlayfs``, its internals and supported operations, please refer | ||
1737 | to the official documentation of the `Linux kernel <https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html>`_. | ||
1738 | |||
1739 | The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP | ||
1740 | (e.g. in ``systemd-machine-units`` recipe) and it's installed into the image. | ||
1741 | |||
1742 | Then you can specify writable directories on a recipe basis (e.g. in my-application.bb):: | ||
1743 | |||
1744 | OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application" | ||
1745 | |||
1746 | To support several mount points you can use a different variable flag. Assuming we | ||
1747 | want to have a writable location on the file system, but do not need that the data | ||
1748 | survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs`` file system. | ||
1749 | |||
1750 | In your machine configuration:: | ||
1751 | |||
1752 | OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay" | ||
1753 | |||
1754 | and then in your recipe:: | ||
1755 | |||
1756 | OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application" | ||
1757 | |||
1758 | .. note:: | ||
1759 | |||
1760 | The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it. | ||
1761 | |||
1713 | .. _ref-classes-own-mirrors: | 1762 | .. _ref-classes-own-mirrors: |
1714 | 1763 | ||
1715 | ``own-mirrors.bbclass`` | 1764 | ``own-mirrors.bbclass`` |