aboutsummaryrefslogtreecommitdiff
path: root/initramfs_init
diff options
context:
space:
mode:
Diffstat (limited to 'initramfs_init')
-rw-r--r--initramfs_init15
1 files changed, 11 insertions, 4 deletions
diff --git a/initramfs_init b/initramfs_init
index 385ccb8..865a91d 100644
--- a/initramfs_init
+++ b/initramfs_init
@@ -13,10 +13,17 @@ echo "[yerba-initramfs/init] Mounted /dev/sr0 (ISO root)"
mkdir -p /mnt/root
mount -t squashfs -o loop /mnt/iso/yerba/rootfs.squashfs /mnt/root
+echo "[yerba-initramfs/init] Mounted squashfs at /mnt/root"
-echo "[yerba-initramfs/init] TODO: Make this actually mount OverlayFS and switch_root."
-echo "[yerba-initramfs/init] You will see a message saying something bad has happened. Please ignore this."
+mount -t tmpfs tmpfs /mnt/overlay
+mkdir -p /mnt/overlay/upper /mnt/overlay/work /mnt/overlay/merged
+echo "[yerba-initramfs/init] Mounted tmpfs at /mnt/overlay and created upper, work & merged directories"
-echo "[yerba-initramfs/init] Something very very bad has occurred (oh no.)"
-echo "[yerba-initramfs/init] Dropping you to a BusyBox shell."
+mount -t overlay overlay -o lowerdir=/mnt/root,upperdir=/mnt/overlay/upper,workdir=/mnt/overlay/work /mnt/overlay/merged
+echo "[yerba-initramfs/init] Mounted OverlayFS at /mnt/overlay/merged"
+
+echo "[yerba-initramfs/init] Switching to overlay root..."
+exec switch_root /mnt/overlay/merged /sbin/init
+
+echo "[yerba-initramfs/init] switch_root failed, dropping to shell"
exec /bin/sh