summaryrefslogtreecommitdiff
path: root/experiments/04_20251216_pkg_store/init
diff options
context:
space:
mode:
authorwrzosik <mia@miangie.dev>2026-01-24 23:21:49 +0100
committerwrzosik <mia@miangie.dev>2026-01-24 23:21:49 +0100
commit2fe1d98ce20bb8a44742d0c7af524bb8bc5d7504 (patch)
tree417d205433f33c2533603572378342e2307c4aa7 /experiments/04_20251216_pkg_store/init
parent73ff7de47a640f32e75e49c01d1b1ea333014b61 (diff)
experiment: building rootfs from package store (basics)HEADmain
First tries with overlayfs, 9p and virtio. First kernel compilled with custom configuration
Diffstat (limited to 'experiments/04_20251216_pkg_store/init')
-rw-r--r--experiments/04_20251216_pkg_store/init32
1 files changed, 32 insertions, 0 deletions
diff --git a/experiments/04_20251216_pkg_store/init b/experiments/04_20251216_pkg_store/init
new file mode 100644
index 0000000..742270e
--- /dev/null
+++ b/experiments/04_20251216_pkg_store/init
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+echo "creating /new_root_base..."
+busybox mkdir /new_root_base
+busybox mount -t tmpfs tmpfs /new_root_base
+busybox cp -r bin etc lib lib64 sbin usr var /new_root_base
+busybox ln -s usr/games/sl /new_root_base/init
+
+busybox mkdir /new_root_base/dev
+busybox mkdir /new_root_base/proc
+busybox mkdir /new_root_base/sys
+
+echo "mounting /pkg_store..."
+busybox mkdir /pkg_store
+busybox mount -t 9p host0 -o trans=virtio,version=9p2000.L /pkg_store
+
+echo "merging store into /new_root..."
+export PKG_DIRS=$(
+ busybox find /pkg_store -mindepth 1 -maxdepth 1 -type d |\
+ busybox paste -sd ":" -
+)
+busybox mkdir /new_root
+busybox mount -t overlay overlay -olowerdir="/new_root_base:$PKG_DIRS" /new_root
+
+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 "switching to /new_root..."
+exec busybox switch_root /new_root /init
+#exec busybox sh