summaryrefslogtreecommitdiff
path: root/experiments/03_20251130_leaving_initramfs/init
blob: 27fcc61c6e4b4085cd25d873cb32949afdbec6e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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