From e61ca9decf489ec803f554c1b069e7141445ee8e Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 1 Oct 2018 17:35:46 +0200 Subject: [PATCH] Another overlay mount overhaul - Directly pass the device type to the mount command - Use the special default type "hwdevice" to wait for a device node before mounting it - Initialize the overlay partition from the initrd script - Do the bind mount setup as document Signed-off-by: David Oberhollenzer --- pkg/initrd/initrd.skel | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pkg/initrd/initrd.skel b/pkg/initrd/initrd.skel index 460bf64..772fabd 100644 --- a/pkg/initrd/initrd.skel +++ b/pkg/initrd/initrd.skel @@ -10,9 +10,9 @@ busybox mount -t devtmpfs none /dev root_sfs="" root="" -root_type="" +root_type="hwdevice" overlay_dev="" -overlay_type="" +overlay_type="hwdevice" singleuser=0 for param in `cat /proc/cmdline`; do @@ -53,7 +53,7 @@ mount_device() { qemu) mount -t 9p -o trans=virtio -oversion=9p2000.L $device $mountpoint ;; - *) + hwdevice) while [ ! -e $device ]; do echo "Waiting for device $device" busybox sleep 1 @@ -61,6 +61,9 @@ mount_device() { mount $device $mountpoint ;; + *) + mount -t $type $device $mountpoint + ;; esac } @@ -82,7 +85,16 @@ fi if [ ! -z "$overlay_dev" ]; then mount_device "$overlay_dev" "/newroot/cfg/overlay" "$overlay_type" + mkdir -p /newroot/cfg/overlay/etc + mkdir -p /newroot/cfg/overlay/etc_work + mkdir -p /newroot/cfg/overlay/var_lib + mkdir -p /newroot/cfg/overlay/var_lib_work + mkdir -p /newroot/cfg/overlay/usr + mkdir -p /newroot/cfg/overlay/usr_work + chroot /newroot mount -n -t overlay overlay -olowerdir=/cfg/preserve/etc,upperdir=/cfg/overlay/etc,workdir=/cfg/overlay/etc_work /etc +else + chroot /newroot mount --bind "/cfg/preserve/etc" "/etc" fi # cleanup mounts