summaryrefslogtreecommitdiff
path: root/packages/initrdscripts/files/nfsboot.sh
diff options
context:
space:
mode:
authorAlex Osborne <ato@meshy.org>2007-07-19 20:55:15 +0000
committerPaul Sokolovsky <pmiscml@gmail.com>2007-07-19 20:55:15 +0000
commit2603e7f62a5a9e902a554855ed601d0619817b71 (patch)
tree3db9dd94483efff12cfd3f64cd9c571e8f260882 /packages/initrdscripts/files/nfsboot.sh
parent86a52172905ecd9d850cf62f6042b820a3192230 (diff)
initramfs: New modular initramfs for booting kernel from various media.
* Design principles: * This initramfs just mounts roots and runs init on it, nothing else. * Whenever possible, existing kernel parameters are used. When extended boot methods are provided, new parameters mimick/adhere to existing conventions. * System is modular/pluggable - each mount method is in own module with more or less well defined interface, it's possible to construct complete system with any combination of modules. * Modules includes: initramfs-module-loop, initramfs-module-nfs, to boot from loop devices (including recursive loops) and NFS, correspondingly.
Diffstat (limited to 'packages/initrdscripts/files/nfsboot.sh')
-rw-r--r--packages/initrdscripts/files/nfsboot.sh74
1 files changed, 31 insertions, 43 deletions
diff --git a/packages/initrdscripts/files/nfsboot.sh b/packages/initrdscripts/files/nfsboot.sh
index b536c4042b..62a044267a 100644
--- a/packages/initrdscripts/files/nfsboot.sh
+++ b/packages/initrdscripts/files/nfsboot.sh
@@ -1,50 +1,38 @@
#!/bin/sh
-echo "Starting initramfs boot..."
-mkdir /proc
-mount -t proc proc /proc
-
-for arg in `cat /proc/cmdline`; do
- echo $arg
- optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
- echo $optarg
- case $arg in
- root=*)
- root=$optarg ;;
- nfsroot=*)
- nfsroot=$optarg ;;
- ip=*)
- ip=$optarg ;;
+if [ "$ROOT_DEVICE" = "/dev/nfs" ]; then
+ for arg in $CMDLINE; do
+ echo $arg
+ optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+ echo $optarg
+ case $arg in
+ nfsroot=*)
+ nfsroot=$optarg ;;
+ ip=*)
+ ip=$optarg ;;
+ esac
+ done
+
+ echo $ip | (IFS=: read client_ip server_ip gw_ip netmask hostname device autoconf; \
+ echo client_ip=$client_ip;
+ echo server_ip=$server_ip;
+ echo gw_ip=$gw_ip;
+ echo netmask=$netmask;
+ echo hostname=$hostname;
+ echo device=$device;
+ echo autoconf=$autoconf;
+
+ case "$device" in
+ usb*)
+ echo "USB"
+ modprobe g_ether
+ ;;
esac
-done
-
-echo $ip | (IFS=: read client_ip server_ip gw_ip netmask hostname device autoconf; \
-echo client_ip=$client_ip;
-echo server_ip=$server_ip;
-echo gw_ip=$gw_ip;
-echo netmask=$netmask;
-echo hostname=$hostname;
-echo device=$device;
-echo autoconf=$autoconf;
-
-case "x$device" in
- usb*)
- echo "USB"
- modprobe g_ether
- ;;
-esac
+
+ ifconfig $device $client_ip
+ )
-ifconfig $device $client_ip
-)
-
-mkdir /mnt
-if [ "x$root" = "x/dev/nfs" ]; then
echo "booting from NFS: $nfsroot"
mount -t nfs $nfsroot /mnt
-else
- echo "booting from: $root"
- mount $root /mnt
+ BOOT_ROOT=/mnt
fi
-
-cd /mnt
-exec switch_root -c /dev/console /mnt /sbin/init