summaryrefslogtreecommitdiff
path: root/experiments/03_20251130_leaving_initramfs/init
diff options
context:
space:
mode:
authorwrzosik <mia@miangie.dev>2025-11-30 15:21:08 +0100
committerwrzosik <mia@miangie.dev>2025-11-30 15:21:08 +0100
commit73f39a96c8786cf9491c06e8ba60edd63863dac1 (patch)
tree8dd9c6ad689872d88c6b1fcd5cc38cfe73fe575a /experiments/03_20251130_leaving_initramfs/init
parent4859194c62140a947a0d60bd3bc557c181139baf (diff)
experiment: Leave initramfs
Added experiment on booting past initramfs. It uses Makefile to build initramfs.
Diffstat (limited to 'experiments/03_20251130_leaving_initramfs/init')
-rw-r--r--experiments/03_20251130_leaving_initramfs/init23
1 files changed, 23 insertions, 0 deletions
diff --git a/experiments/03_20251130_leaving_initramfs/init b/experiments/03_20251130_leaving_initramfs/init
new file mode 100644
index 0000000..27fcc61
--- /dev/null
+++ b/experiments/03_20251130_leaving_initramfs/init
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+echo "creating new root..."
+busybox mkdir /new_root
+busybox mount -t tmpfs tmpfs /new_root
+
+busybox cp -r bin etc init lib lib64 sbin usr var /new_root
+
+busybox mkdir /new_root/dev
+busybox mkdir /new_root/proc
+busybox mkdir /new_root/sys
+
+echo "mounting special filesystems..."
+busybox mount -t devtmpfs udev /new_root/dev
+busybox mount -t proc proc /new_root/proc
+busybox mount -t sysfs sysfs /new_root/sys
+
+echo "the cake is a lie!" > /new_root/cake
+
+echo "it's time to try 'switch_root' command and enter new_root"
+echo "look for /cake to verify it worked"
+
+exec busybox switch_root /new_root /bin/busybox sh