summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initrdscripts/initramfs-framework/finish
diff options
context:
space:
mode:
authorMuhammad Hamza <Muhammad_Hamza@mentor.com>2022-06-17 10:50:22 +0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-08 08:27:20 +0100
commit8dfc7162e31748b4da99e9ee33d45b6b551e384a (patch)
tree85b2df6d5077daa0be2e12007ad6dbde053011ee /meta/recipes-core/initrdscripts/initramfs-framework/finish
parentd2f8a57a30066815aba9cd4ebef7bf9edf21bcaa (diff)
downloadpoky-8dfc7162e31748b4da99e9ee33d45b6b551e384a.tar.gz
initramfs-framework: move storage mounts to actual rootfs
Operations such as mkfs fail on devices that are not switched to the actual rootfs before switch_root is called. The kernel interprets these devices as still being used even after unmounting and errors such as below are seen when the target is fully booted root@v1000:~# umount /dev/sdb1 root@v1000:~# mkfs.ext4 /dev/sdb1 mke2fs 1.43.8 (1-Jan-2018) /dev/sdb1 contains a ext4 file system last mounted on Wed Nov 28 07:33:54 2018 Proceed anyway? (y,N) y /dev/sdb1 is apparently in use by the system; will not make a filesystem here! (From OE-Core rev: ce27982c24d2398c9eadb9d4d9e7475509424195) Signed-off-by: Awais Belal <awais_belal@mentor.com> Signed-off-by: Muhammad Hamza <muhammad_hamza@mentor.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> (cherry picked from commit ec53ffd01972d1be2d6a28de828b3f0b80dc1e61) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/initrdscripts/initramfs-framework/finish')
-rwxr-xr-xmeta/recipes-core/initrdscripts/initramfs-framework/finish9
1 files changed, 9 insertions, 0 deletions
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/finish b/meta/recipes-core/initrdscripts/initramfs-framework/finish
index 717383ebac..dee3ab3387 100755
--- a/meta/recipes-core/initrdscripts/initramfs-framework/finish
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish
@@ -14,6 +14,15 @@ finish_run() {
14 14
15 info "Switching root to '$ROOTFS_DIR'..." 15 info "Switching root to '$ROOTFS_DIR'..."
16 16
17 debug "Moving basic mounts onto rootfs"
18 for dir in `awk '/\/dev.* \/run\/media/{print $2}' /proc/mounts`; do
19 # Parse any OCT or HEX encoded chars such as spaces
20 # in the mount points to actual ASCII chars
21 dir=`printf $dir`
22 mkdir -p "${ROOTFS_DIR}/media/${dir##*/}"
23 mount -n --move "$dir" "${ROOTFS_DIR}/media/${dir##*/}"
24 done
25
17 debug "Moving /dev, /proc and /sys onto rootfs..." 26 debug "Moving /dev, /proc and /sys onto rootfs..."
18 mount --move /dev $ROOTFS_DIR/dev 27 mount --move /dev $ROOTFS_DIR/dev
19 mount --move /proc $ROOTFS_DIR/proc 28 mount --move /proc $ROOTFS_DIR/proc