[OE-core] [PATCH 4/4] initrdscripts/init-live.sh: umount extra mount points
Hongxu Jia
hongxu.jia at windriver.com
Mon Dec 3 10:13:30 UTC 2018
Just umount these mount points. After switch_root, let udev/fstab in
rootfs to process these partition. It aligns the principle that `Initrd
is used to mount the root file system at boot time'[1]
[1] https://en.wikipedia.org/wiki/Initial_ramdisk
Umount dev rather mount point to avoid `spaces in the mount points to
actual ASCII char'
Here are test steps:
$ echo 'INITRAMFS_SCRIPTS = "initramfs-live-boot initramfs-live-install \
initramfs-live-install-efi"' >> conf/local.conf
$ echo 'IMAGE_FSTYPES_pn-core-image-minimal_append = " live"' >> conf/local.conf
$ echo 'KERNEL_FEATURES_append = " features/overlayfs/overlayfs.scc"' >> conf/local.conf
$ bitbake core-image-minimal
$ runqemu core-image-minimal slirp iso
qemux86-64 login: root
root at qemux86-64:~# touch /abc
Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
---
meta/recipes-core/initrdscripts/files/init-live.sh | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 65183d7..068e049 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -92,15 +92,11 @@ boot_live_root() {
mkdir -p ${ROOT_MOUNT}/media/realroot
mount -n --move "/run/media/${ROOT_DISK}" ${ROOT_MOUNT}/media/realroot
- # Move the mount points of some filesystems over to
- # the corresponding directories under the real root filesystem.
- for dir in `awk '/\/dev.* \/run\/media/{print $2}' /proc/mounts`; do
- # Parse any OCT or HEX encoded chars such as spaces
- # in the mount points to actual ASCII chars
- dir=`printf $dir`
- mkdir -p "${ROOT_MOUNT}/media/${dir##*/}"
- mount -n --move "$dir" "${ROOT_MOUNT}/media/${dir##*/}"
+ # Umount available mount points
+ for dev in `awk '/\/dev.* \/run\/media/{print $1}' /proc/mounts`; do
+ umount $dev
done
+
mount -n --move /proc ${ROOT_MOUNT}/proc
mount -n --move /sys ${ROOT_MOUNT}/sys
mount -n --move /dev ${ROOT_MOUNT}/dev
--
2.7.4
More information about the Openembedded-core
mailing list