Skip to contentSkip to conversation

ref-manual: add overlayfs-etc class

PATCH Superseded Vyacheslav Yurkov 3 participants 6 messages Dec 16, 2021 – Dec 17, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ref-manual: add overlayfs-etc class

---
 documentation/ref-manual/classes.rst | 41 ++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
documentation/ref-manual/classes.rst +41 -0
index 2c191f407..a5b01c2cf 100644
@@ -1769,6 +1769,47 @@ 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 ``/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 actual init program, because the latter already
+requires ``/etc`` to be mounted
+
+.. note::
+
+   This class must not be inherited directly. Use corresponding IMAGE_FEATURE
+
+Your machine configuration should define at least 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:
+
+* Default option is to rename 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, becaause updating
+  init manager would remove generated script
+* If you are would like to keep original init as is, you can set::
+
+   OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
+
+  Then 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
#1 lore raw

PATCH 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
index ded653221..5f6c00fac 100644
@@ -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 ``/etc`` directory to be in ``overlayfs``.
+   This allows to store device specific information elsewhere, especially
+   if rootfs is configured to be read-only.
+
 -  *package-management:* Installs package management tools and preserves
    the package manager database.
 
Signature · 1 line
2.28.0
#2 lore raw

Re: [docs] [PATCH 2/2] ref-manual: document overlayfs-etc image feature

Quoted 10 lines · Vyacheslav Yurkov
---
 documentation/ref-manual/features.rst | 4 ++++
 1 file changed, 4 insertions(+)
documentation/ref-manual/features.rst +0 -0
index ded653221..5f6c00fac 100644

documentation/ref-manual/features.rst Here are the image features available for all images: · line 222

Quoted 4 lines
documentation/ref-manual/features.rst +1 -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 ``/etc`` directory to be in ``overlayfs``.

/s/Configures/Configures the/

documentation/ref-manual/features.rst Here are the image features available for all images: · line 224

Quoted 2 lines
documentation/ref-manual/features.rst +2 -0
+   This allows to store device specific information elsewhere, especially
+   if rootfs is configured to be read-only.

s/rootfs/the root filesystem/

I'll propose a guideline to replace "rootfs" by "root filesystem", but the way. Everyone understands this term here of course, but that's better English ;-)

Thanks for the patch, and thanks in advance for the V2 ;) Cheers
Michael.

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw
In reply to Vyacheslav Yurkov

Hi Slava,

Thanks for the documentation update patch!
See my comments below.

Quoted 11 lines · Vyacheslav Yurkov
---
 documentation/ref-manual/classes.rst | 41 ++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
documentation/ref-manual/classes.rst +0 -0
index 2c191f407..a5b01c2cf 100644
@@ -1769,6 +1769,47 @@ to the unit the following::
 .. note::

documentation/ref-manual/classes.rst to the unit the following:: · line 1779

Quoted 10 lines
documentation/ref-manual/classes.rst +8 -0
 
    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 ``/etc`` directory in overlayfs a special handling at early 

s/to have/to have the/

documentation/ref-manual/classes.rst to the unit the following:: · line 1781

Quoted 2 lines
documentation/ref-manual/classes.rst +2 -0
+boot stage is required.  The idea is to supply a custom init script that mounts
+``/etc`` before launching actual init program, because the latter already

s/actual init program/the actual init program/

documentation/ref-manual/classes.rst to the unit the following:: · line 1786

Quoted 5 lines
documentation/ref-manual/classes.rst +5 -0
+requires ``/etc`` to be mounted
+
+.. note::
+
+   This class must not be inherited directly. Use corresponding IMAGE_FEATURE

Oops, you forgot the "S" in "IMAGE_FEATURES". You may say:

Use :term:IMAGE_FEATURES or :term:EXTRA_IMAGE_FEATURES.

What about directly adding an example too?

documentation/ref-manual/classes.rst to the unit the following:: · line 1789

Quoted 3 lines
documentation/ref-manual/classes.rst +3 -0
+
+Your machine configuration should define at least device, mount point, and file system type
+you are going to use for ``overlayfs``::

s/at least device/at least the device/

documentation/ref-manual/classes.rst to the unit the following:: · line 1802

Quoted 13 lines
documentation/ref-manual/classes.rst +13 -0
+
+  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:
+
+* Default option is to rename original ``/sbin/init`` to ``/sbin/init.orig`` and

s/Default/The default/

s/original/the original/

documentation/ref-manual/classes.rst to the unit the following:: · line 1803

Quoted 1 line
documentation/ref-manual/classes.rst +1 -0
+  place generated init under original name, i.e. ``/sbin/init``. It has an advantage

s/generated init/the generated init/

s/original name/its original name/

documentation/ref-manual/classes.rst to the unit the following:: · line 1805

Quoted 2 lines
documentation/ref-manual/classes.rst +2 -0
+  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, becaause updating

s/becaause/because/

documentation/ref-manual/classes.rst to the unit the following:: · line 1806

Quoted 1 line
documentation/ref-manual/classes.rst +1 -0
+  init manager would remove generated script

s/generated script/the generated script/

documentation/ref-manual/classes.rst to the unit the following:: · line 1807

Quoted 1 line
documentation/ref-manual/classes.rst +1 -0
+* If you are would like to keep original init as is, you can set::

s/If you are would like/If you wish/

documentation/ref-manual/classes.rst to the unit the following:: · line 1811

Quoted 4 lines
documentation/ref-manual/classes.rst +4 -0
+
+   OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
+
+  Then generated init will be named ``/sbin/preinit`` and you would need to extend your

/s/generated init/the generated init/

Cheers
Michael.

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw
In reply to Vyacheslav Yurkov

Hi Vyacheslav,

Quoted 13 lines · Vyacheslav Yurkov

---
documentation/ref-manual/classes.rst | 41 ++++++++++++++++++++++++++++

1 file changed, 41 insertions(+)
documentation/ref-manual/classes.rst +0 -0
index 2c191f407..a5b01c2cf 100644
@@ -1769,6 +1769,47 @@ to the unit the following::

.. note::

The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.

documentation/ref-manual/classes.rst

Quoted 2 lines
documentation/ref-manual/classes.rst +2 -0
+   In order to get ``/etc`` in overlayfs see :ref:`overlayfs-etc <ref-classes-overlayfs-etc>` 
+

Missing dot at the end of the sentence.

documentation/ref-manual/classes.rst to the unit the following:: · line 1783

Quoted 10 lines

+.. _ref-classes-overlayfs-etc:

documentation/ref-manual/classes.rst +9 -0
+
+``overlayfs-etc.bbclass``
+=========================
+
+In order to have ``/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 actual init program, because the latter already
+requires ``/etc`` to be mounted
+

Missing dot at the end of the sentence.

documentation/ref-manual/classes.rst to the unit the following:: · line 1787

Quoted 4 lines

+.. note::

documentation/ref-manual/classes.rst +3 -0
+
+   This class must not be inherited directly. Use corresponding IMAGE_FEATURE
+

Missing dot at the end of the sentence.

Quoted 9 lines
documentation/ref-manual/classes.rst +9 -0
+Your machine configuration should define at least 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)::

documentation/ref-manual/classes.rst to the unit the following:: · line 1806

Quoted 10 lines
documentation/ref-manual/classes.rst +10 -0
+
+  OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
+
+The class provides two options for ``/sbin/init`` generation:
+
+* Default option is to rename 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, becaause updating
+  init manager would remove generated script

What is the default value? This needs to be explicit otherwise it cannot be "undone" in a bbappends for example.

Thanks for the patch,
Cheers,
Quentin

Quoted 9 lines
documentation/ref-manual/classes.rst +6 -0
+* If you are would like to keep original init as is, you can set::
+
+   OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
+
+  Then 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:

#5 lore raw

Hi Quentin,
Thanks for the review

Quoted 13 lines · Quentin Schulz

documentation/ref-manual/classes.rst to the unit the following:: · line 1806

Quoted 11 lines
documentation/ref-manual/classes.rst +10 -0
+
+  OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
+
+The class provides two options for ``/sbin/init`` generation:
+
+* Default option is to rename 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, becaause updating
+  init manager would remove generated script

What is the default value? This needs to be explicit otherwise it cannot be "undone" in a bbappends for example.

Quoted 3 lines

Thanks for the patch,
Cheers,
Quentin

Could you please elaborate on default value of what we are talking here? For mandatory variables there are no default values, for two optional variables the default values are set with ??=.

Cheers,
Slava