ref-manual: add overlayfs-etc class
PATCH v2 1/2 ref-manual: add overlayfs-etc class
--- documentation/ref-manual/classes.rst | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
documentation/ref-manual/classes.rst +45 -0
@@ -1769,6 +1769,51 @@ to the unit the following:: .. note:: The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it. + In order to get ``/etc`` in overlayfs see :ref:`overlayfs-etc <ref-classes-overlayfs-etc>` + +.. _ref-classes-overlayfs-etc: + +``overlayfs-etc.bbclass`` +========================= + +In order to have the ``/etc`` directory in overlayfs a special handling at early +boot stage is required. The idea is to supply a custom init script that mounts +``/etc`` before launching the actual init program, because the latter already +requires ``/etc`` to be mounted + +Example usage in image recipe:: + + IMAGE_FEATURES += "overlayfs-etc" + +.. note:: + + This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES` + +Your machine configuration should define at least the device, mount point, and file system type +you are going to use for ``overlayfs``:: + + OVERLAYFS_ETC_MOUNT_POINT = "/data" + OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2" + OVERLAYFS_ETC_FSTYPE ?= "ext4" + +To control more mount options you should consider setting mount options +(``defaults`` is used by default):: + + OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync" + +The class provides two options for ``/sbin/init`` generation: + +* The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig`` + and place generated init under original name, i.e. ``/sbin/init``. It has an advantage + that you won't need to change any kernel parameters in order to make it work, + but it poses a restriction that package-management can't be used, because updating + init manager would remove the generated script +* If you wish to keep original init as is, you can set:: + + OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0" + + Then the generated init will be named ``/sbin/preinit`` and you would need to extend your + kernel parameters manually in your bootloader configuration. .. _ref-classes-own-mirrors:
Signature · 1 line
2.28.0
PATCH v2 2/2 ref-manual: document overlayfs-etc image feature
--- documentation/ref-manual/features.rst | 4 ++++ 1 file changed, 4 insertions(+)
documentation/ref-manual/features.rst +4 -0
@@ -219,6 +219,10 @@ Here are the image features available for all images: - *empty-root-password:* Sets the root password to an empty string, which allows logins with a blank password. +- *overlayfs-etc:* Configures the ``/etc`` directory to be in ``overlayfs``. + This allows to store device specific information elsewhere, especially + if root filesystem is configured to be read-only. + - *package-management:* Installs package management tools and preserves the package manager database.
Signature · 1 line
2.28.0
Re: [docs] [PATCH v2 2/2] ref-manual: document overlayfs-etc image feature
Hi Slava,
Many thanks for the updates!
Quoted 10 lines · Vyacheslav Yurkov
Signed-off-by Vyacheslav Yurkov <[email protected]>--- documentation/ref-manual/features.rst | 4 ++++ 1 file changed, 4 insertions(+)documentation/ref-manual/features.rst +0
-0
documentation/ref-manual/features.rst Here are the image features available for all images: · line 227
Quoted 9 lines
documentation/ref-manual/features.rst +4
-0@@ -219,6 +219,10 @@ Here are the image features available for all images: - *empty-root-password:* Sets the root password to an empty string, which allows logins with a blank password. +- *overlayfs-etc:* Configures the ``/etc`` directory to be in ``overlayfs``. + This allows to store device specific information elsewhere, especially + if root filesystem is configured to be read-only. + - *package-management:* Installs package management tools and preserves the package manager database.
For both patches: Reviewed-by: Michael Opdenacker <[email protected]>
There were a few remaining punctuation and missing article issues (that I probably failed to report), but I was happy to fix them!
Merged in "master-next".
Thanks again.
Michael.
Signature · 3 lines
Michael Opdenacker, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [docs] [PATCH v2 2/2] ref-manual: document overlayfs-etc image feature
Hi Michael,
Thanks for the review and updates.
I assume it might be easier to send an update patch separately if needed. Or you can do fix-ups in master-next? :)
Cheers,
Slava
Quoted 15 lines · Michael Opdenacker
Hi Slava,
Many thanks for the updates!
On 12/16/21 12:22 PM, Vyacheslav Yurkov wrote:
For both patches: Reviewed-by: Michael Opdenacker <[email protected]>
There were a few remaining punctuation and missing article issues (that I probably failed to report), but I was happy to fix them!Merged in "master-next".
Thanks again.
Michael.
Re: [docs] [PATCH v2 2/2] ref-manual: document overlayfs-etc image feature
Hi Slava
Quoted 5 lines · Vyacheslav Yurkov
Hi Michael,
Thanks for the review and updates.I assume it might be easier to send an update patch separately if needed. Or you can do fix-ups in master-next? :)
I can make fixups in master-next indeed. This way, we just have one commit. Cheers
Michael.
Signature · 3 lines
Michael Opdenacker, Bootlin Embedded Linux and Kernel engineering https://bootlin.com