diff options
| author | Ricardo Salveti <ricardo@foundries.io> | 2025-08-18 21:56:05 -0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-08-21 10:29:56 +0100 |
| commit | 34df6b71b9f997229568429815530820e3f4216d (patch) | |
| tree | cba6df2515e315f96f4e55f6ddd3b40238fe936a /meta/recipes-core | |
| parent | 81d31fbd6a7880aa993d66ade1728470c7c4e5cd (diff) | |
| download | poky-34df6b71b9f997229568429815530820e3f4216d.tar.gz | |
initramfs-framework: mount /run and move to rootfs before switch_root
Mount /run as tmpfs during early init and include it in the set of
mounts moved to $ROOTFS_DIR prior to exec switch_root.
Having /run available early lets initramfs modules stamp state that can
later influence systemd service jobs, since systemd will reuse the mount
point instead of creating a new one during boot.
This is particularly useful with ostree, as it uses /run/ostree-booted
as way to describe that the rootfs comes from an ostree deployment.
(From OE-Core rev: 3a4bd7ddefbf5b412a2b4031d491f5a50f1908cd)
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
| -rwxr-xr-x | meta/recipes-core/initrdscripts/initramfs-framework/finish | 3 | ||||
| -rwxr-xr-x | meta/recipes-core/initrdscripts/initramfs-framework/init | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/finish b/meta/recipes-core/initrdscripts/initramfs-framework/finish index 716c2f44af..21eaa57393 100755 --- a/meta/recipes-core/initrdscripts/initramfs-framework/finish +++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish | |||
| @@ -35,10 +35,11 @@ finish_run() { | |||
| 35 | mount -n --move "$dir" "${ROOTFS_DIR}/media/${dir##*/}" | 35 | mount -n --move "$dir" "${ROOTFS_DIR}/media/${dir##*/}" |
| 36 | done | 36 | done |
| 37 | 37 | ||
| 38 | debug "Moving /dev, /proc and /sys onto rootfs..." | 38 | debug "Moving /dev, /proc, /sys and /run onto rootfs..." |
| 39 | mount --move /dev $ROOTFS_DIR/dev | 39 | mount --move /dev $ROOTFS_DIR/dev |
| 40 | mount --move /proc $ROOTFS_DIR/proc | 40 | mount --move /proc $ROOTFS_DIR/proc |
| 41 | mount --move /sys $ROOTFS_DIR/sys | 41 | mount --move /sys $ROOTFS_DIR/sys |
| 42 | mount --move /run $ROOTFS_DIR/run | ||
| 42 | 43 | ||
| 43 | cd $ROOTFS_DIR | 44 | cd $ROOTFS_DIR |
| 44 | exec switch_root $ROOTFS_DIR ${bootparam_init:-/sbin/init} | 45 | exec switch_root $ROOTFS_DIR ${bootparam_init:-/sbin/init} |
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/init b/meta/recipes-core/initrdscripts/initramfs-framework/init index a48b77e95e..5dd252219a 100755 --- a/meta/recipes-core/initrdscripts/initramfs-framework/init +++ b/meta/recipes-core/initrdscripts/initramfs-framework/init | |||
| @@ -81,9 +81,11 @@ EFI_DIR=/sys/firmware/efi # place to store device firmware information | |||
| 81 | touch /etc/fstab | 81 | touch /etc/fstab |
| 82 | 82 | ||
| 83 | # initialize /proc, /sys, /run/lock and /var/lock | 83 | # initialize /proc, /sys, /run/lock and /var/lock |
| 84 | mkdir -p /proc /sys /run/lock /var/lock | 84 | mkdir -p /proc /sys /run /var/lock |
| 85 | mount -t proc proc /proc | 85 | mount -t proc proc /proc |
| 86 | mount -t sysfs sysfs /sys | 86 | mount -t sysfs sysfs /sys |
| 87 | mount -t tmpfs tmpfs /run | ||
| 88 | mkdir -p /run/lock | ||
| 87 | 89 | ||
| 88 | if [ -d $EFI_DIR ];then | 90 | if [ -d $EFI_DIR ];then |
| 89 | mount -t efivarfs none /sys/firmware/efi/efivars | 91 | mount -t efivarfs none /sys/firmware/efi/efivars |
