summaryrefslogtreecommitdiff
path: root/local
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2023-05-08 18:17:20 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2023-05-08 18:17:20 +0200
commit943a8ffa9a08c11d8c5e76513a8f0a5e881a601a (patch)
tree85849197c3adc48dd39fdcdccc64cb6cf4fb4772 /local
parent4488caf475df12bd532d12fd4efeaf881052343d (diff)
downloadi486tcc-linux-943a8ffa9a08c11d8c5e76513a8f0a5e881a601a.tar.gz
i486tcc-linux-943a8ffa9a08c11d8c5e76513a8f0a5e881a601a.tar.bz2
added booting from nbd
Diffstat (limited to 'local')
-rwxr-xr-xlocal/etc/rc.init4
-rwxr-xr-xlocal/init36
2 files changed, 38 insertions, 2 deletions
diff --git a/local/etc/rc.init b/local/etc/rc.init
index 752656a..32ba30e 100755
--- a/local/etc/rc.init
+++ b/local/etc/rc.init
@@ -10,7 +10,7 @@ mount -n -t devtmpfs -o mode=0755,nosuid udev /dev
mkdir -p /dev/pts
mount -n -t devpts -o mode=0620,gid=5,nosuid,noexec devpts /dev/pts
-echo "Mounting registerd filesystems.."
+echo "Mounting registered filesystems.."
mount -a
echo "Starting login sessions.."
@@ -19,4 +19,4 @@ respawn getty /dev/tty2 &
respawn getty /dev/tty3 &
respawn getty /dev/tty4 &
-echo "Done."
+echo "Ready."
diff --git a/local/init b/local/init
new file mode 100755
index 0000000..7a00929
--- /dev/null
+++ b/local/init
@@ -0,0 +1,36 @@
+#!/bin/oksh
+
+echo "Starting in ramdisk.."
+
+echo "Mounting pseudo-filesystems.."
+mkdir -p /proc /sys
+mount -n -t proc -o nosuid,noexec,nodev proc /proc
+mount -n -t sysfs -o nosuid,noexec,nodev,ro sys /sys
+mount -n -t devtmpfs -o mode=0755,nosuid udev /dev
+mkdir -p /dev/pts
+mount -n -t devpts -o mode=0620,gid=5,nosuid,noexec devpts /dev/pts
+
+echo "Starting network via DHCP.."
+# TODO: replace modprobe with samurai script
+#modprobe ne io=0x300
+insmod /lib/modules/drivers/net/ethernet/8390/8390p.ko
+insmod /lib/modules/drivers/net/ethernet/8390/ne.ko io=0x300
+ifconfig eth0 up
+sdhcp
+
+echo "Loading root filesystem.."
+insmod /lib/modules/crypto/crypto.ko
+insmod /lib/modules/crypto/crypto_algapi.ko
+insmod /lib/modules/crypto/crypto_hash.ko
+insmod lib/modules/fs/jbd2/jbd2.ko
+insmod /lib/modules/fs/mbcache.ko
+insmod /lib/modules/lib/crc16.ko
+insmod /lib/modules/crypto/crc32c_generic.ko
+insmod /lib/modules/fs/ext4/ext4.ko
+insmod /lib/modules/drivers/block/nbd.ko
+nbd-client -N ROOT 10.0.0.2 /dev/nbd0
+mkdir /newroot
+mount -t ext4 /dev/nbd0 /newroot
+
+echo "Mounting new root.."
+exec switch_root /newroot /bin/sinit