summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
diff options
context:
space:
mode:
authorAlejandro Hernandez Samaniego <alhe@linux.microsoft.com>2022-01-29 12:48:39 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-01 23:44:59 +0000
commited323de4dcb600dd71d544f5994f52307b6db564 (patch)
tree581575b6fa10b8f987dedff95ecc7f0e1f7716f9 /meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
parent31bca6db85302e4b178c274b026fe0f42cbfa10f (diff)
downloadpoky-ed323de4dcb600dd71d544f5994f52307b6db564.tar.gz
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. (From OE-Core rev: 4f876982a856c54a8074c85346632e33caa7ef53) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alhe@linux.microsoft.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb')
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb9
1 files changed, 9 insertions, 0 deletions
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
index 9e8c1dc3ab..4e76e20026 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
@@ -18,6 +18,7 @@ SRC_URI = "file://init \
18 file://e2fs \ 18 file://e2fs \
19 file://debug \ 19 file://debug \
20 file://lvm \ 20 file://lvm \
21 file://overlayroot \
21 " 22 "
22 23
23S = "${WORKDIR}" 24S = "${WORKDIR}"
@@ -49,6 +50,9 @@ do_install() {
49 # lvm 50 # lvm
50 install -m 0755 ${WORKDIR}/lvm ${D}/init.d/09-lvm 51 install -m 0755 ${WORKDIR}/lvm ${D}/init.d/09-lvm
51 52
53 # overlayroot needs to run after rootfs module but before finish
54 install -m 0755 ${WORKDIR}/overlayroot ${D}/init.d/91-overlayroot
55
52 # Create device nodes expected by some kernels in initramfs 56 # Create device nodes expected by some kernels in initramfs
53 # before even executing /init. 57 # before even executing /init.
54 install -d ${D}/dev 58 install -d ${D}/dev
@@ -64,6 +68,7 @@ PACKAGES = "${PN}-base \
64 initramfs-module-rootfs \ 68 initramfs-module-rootfs \
65 initramfs-module-debug \ 69 initramfs-module-debug \
66 initramfs-module-lvm \ 70 initramfs-module-lvm \
71 initramfs-module-overlayroot \
67 " 72 "
68 73
69FILES:${PN}-base = "/init /init.d/99-finish /dev" 74FILES:${PN}-base = "/init /init.d/99-finish /dev"
@@ -107,3 +112,7 @@ FILES:initramfs-module-debug = "/init.d/00-debug"
107SUMMARY:initramfs-module-lvm = "initramfs lvm rootfs support" 112SUMMARY:initramfs-module-lvm = "initramfs lvm rootfs support"
108RDEPENDS:initramfs-module-lvm = "${PN}-base" 113RDEPENDS:initramfs-module-lvm = "${PN}-base"
109FILES:initramfs-module-lvm = "/init.d/09-lvm" 114FILES:initramfs-module-lvm = "/init.d/09-lvm"
115
116SUMMARY:initramfs-module-overlayroot = "initramfs support for mounting a RW overlay on top of a RO root filesystem"
117RDEPENDS:initramfs-module-overlayroot = "${PN}-base initramfs-module-rootfs"
118FILES:initramfs-module-overlayroot = "/init.d/91-overlayroot"