summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorJeff Bailey <jbailey@ubuntu.com>2005-06-08 21:13:41 +0000
committerJeff Bailey <jbailey@ubuntu.com>2005-06-08 21:13:41 +0000
commitde9c780f57ae626f05ec1c971c56648250cba03c (patch)
tree585d8515ef623e64b2800cc4266920fff1564940 /init
downloadinitramfs-tools-de9c780f57ae626f05ec1c971c56648250cba03c.tar.gz
initramfs-tools-de9c780f57ae626f05ec1c971c56648250cba03c.zip
Initial checkin
Diffstat (limited to 'init')
-rw-r--r--init64
1 files changed, 64 insertions, 0 deletions
diff --git a/init b/init
new file mode 100644
index 0000000..c3e4887
--- /dev/null
+++ b/init
@@ -0,0 +1,64 @@
+#!/bin/sh -x
+mkdir /sys
+mkdir /proc
+mkdir /tmp
+mount -t sysfs sysfs /sys
+mount -t proc proc /proc
+
+. /conf/initramfs.conf
+. /scripts/functions
+
+# Parse command line options
+init=/sbin/init
+root=
+ro=-r
+break=
+rootmnt=/root
+for x in $(cat /proc/cmdline); do
+ case $x in
+ init=*)
+ INIT=${x#init=}
+ ;;
+ root=*)
+ ROOT=${x#root=}
+ ;;
+ nfsroot=*)
+ NFSROOT=${x#nfsroot=}
+ ;;
+ boot=*)
+ BOOT=${x#boot=}
+ ;;
+ ro)
+ ro=-r
+ ;;
+ rw)
+ ro=-w
+ ;;
+ break)
+ break=yes
+ ;;
+ esac
+done
+
+. /scripts/${BOOT}
+
+# Load the modules
+# FIXME - do module options here
+for x in $(cat /conf/modules); do
+ insmod /modules/$x
+done
+
+# Populate /dev tree
+udevstart
+
+if [ x${break} = xyes ]; then
+ panic "Spawning shell within the initramfs"
+fi
+
+mountroot
+
+umount /sys
+umount /proc
+
+# Chain to real filesystem
+exec run-init ${rootmnt} ${init} "$@"