]> code.ossystems Code Review - openembedded-core.git/commit
initramfs-framework: Add overlayroot module
authorAlejandro Hernandez Samaniego <alhe@linux.microsoft.com>
Sat, 29 Jan 2022 19:48:39 +0000 (12:48 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 1 Mar 2022 23:44:28 +0000 (23:44 +0000)
commit4f876982a856c54a8074c85346632e33caa7ef53
treefce1121eea4bcd1154e01b9d7f09c0f39a8613e0
parentb1bb4e2d73985c6e8cf03b0fea94e8b739648cf7
initramfs-framework: Add overlayroot module

When installed, this module mounts a read-write (RW) overlay on
top of a root filesystem, which is kept read-only (RO), free
from modifications by the user, this might prove to be useful
if we want to access or restore the original unmodified rootfs.

The existing overlay-etc.bbclass does something similar, it
mounts an overlay on top of the /etc directory, however doing
the same for root causes the original root to be inaccessible
once the system is booted, hence why this module is added to
the initramfs boot flow, allowing us to mount the RW overlay,
while keeping the original rootfs mounted at /rofs once the
system finishes booting. This script is loosely based on that
class.

This module requires rootrw=<foo> to be passed as a kernel
parameter to specify the device/partition to be used as RW by the
overlay and has a dependency on overlayfs support being present
in the running kernel.

It does not require the read-only IMAGE_FEATURE to be enabled.

The module needs to be executed after the initramfs-module-rootfs
since it relies on it to mount the filesystem at initramfs startup
but before the finish module which normally switches root.
After overlayroot is executed the usual boot flow continues from
the real init process.

If something goes wrong while running this module, the rootfs
is still mounted RO (with no overlay) and the finish module is
executed to continue booting normally.

Its worth noting that, on purpose, this isnt installed by default
on any images that use initramfs-framework to keep the boot flow
unmodified, only when a user manually requests to install it,
then it becomes functional.

Signed-off-by: Alejandro Enedino Hernandez Samaniego <alhe@linux.microsoft.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/initrdscripts/initramfs-framework/overlayroot [new file with mode: 0644]
meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb