]> git.pld-linux.org Git - projects/geninitrd.git/blobdiff - geninitrd
- nfs modularized
[projects/geninitrd.git] / geninitrd
index b810f0f2edf63708143372374fa51a629ca05f2d..77022dfdb07e5160664f1eac2159fb6b0d9f43c3 100755 (executable)
--- a/geninitrd
+++ b/geninitrd
@@ -45,9 +45,6 @@ tmp_mounted=no
 # are /dev nodes already created from /proc/devices info?
 proc_partitions=no
 
-# if we should init NFS at boot
-have_nfs=no
-
 usage() {
        uname_r=$(uname -r)
        echo "usage: $PROGRAM [--version] [-v] [-f] [--ifneeded] [--preload <module>]"
@@ -480,26 +477,8 @@ find_modules_for_devpath() {
                return
        fi
 
-       if is_yes "`echo "$devpath" | awk '/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:|\/dev\/nfs)/ { print "yes"; }'`"; then
-               if [ ! -x /usr/bin/pcidev -a -z "$NFS_ETH_MODULES" ]; then
-                       die "root on NFS but /usr/bin/pcidev not found. Please install correct pci-database package and rerun $PROGRAM."
-               fi
-               if [ ! -f /proc/bus/pci/devices ]; then
-                       warn "Remember to add network card modules in /etc/sysconfig/geninitrd, example:"
-                       warn "BASICMODULES=\"e1000 ne2k-pci mii 8139too 3c59x\""
-               else
-                       local m
-                       [ -z "$NFS_ETH_MODULES" ] && NFS_ETH_MODULES=$(/usr/bin/pcidev /m net | xargs)
-                       warn "NOTE: Network card(s) module(s) $NFS_ETH_MODULES is for this machine"
-                       for m in $NFS_ETH_MODULES; do
-                               find_module "$m"
-                       done
-               fi
-               find_module "-ipv4"
-               find_module "nfs"
-               have_nfs=yes
-               warn "Remember to use \`root=/dev/ram0 init=/linuxrc' when starting kernel"
-               warn "or you will have problems like init(xx) being child process of swapper(1)."
+       if is_nfs "$devpath"; then
+               find_modules_nfs "$devpath"
                return
        fi
 
@@ -709,55 +688,6 @@ initrd_gen_devices() {
        EOF
 }
 
-initrd_gen_nfs() {
-       # use root=/dev/ram0 init=/linuxrc when starting kernel or you will
-       # have problems like init(XX) being child process of swapper(1).
-       debug "Adding rootfs on NFS support to initrd (dhcp)"
-       mknod "$DESTDIR/dev/urandom" c 1 9
-       mkdir "$DESTDIR/newroot"
-       add_linuxrc <<-'EOF'
-               ifconfig lo 127.0.0.1 up
-               route add -net 127.0.0.0 mask 255.0.0.0 lo
-               ifconfig eth0 up
-               udhcpc -i eth0 -f -q -s /bin/setdhcp
-
-               cd /newroot
-               pivot_root . initrd
-               [ -x /sbin/chroot ] && exec /sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1
-               exec /usr/sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1
-       EOF
-
-       cat <<-'EOF' > "$DESTDIR/bin/setdhcp"
-               #!/bin/sh
-               [ "$1" != "bound" ] && exit
-               [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
-               [ -n "$subnet" ] && NETMASK="netmask $subnet"
-               ifconfig $interface $ip $BROADCAST $NETMASK up
-               if [ -n "$router" ]; then
-                       for r in $router; do
-                               route add default gw $r dev $interface
-                       done
-               fi
-
-               for o in $CMDLINE; do
-                       case $o in
-                       nfsroot=*)
-                               rootpath=${o#nfsroot=}
-                               ;;
-                       esac
-               done
-
-               if [ -n "$rootpath" ]; then
-                       mount -n -t nfs -o ro,nolock,posix,tcp,wsize=8192,rsize=8192 $rootpath /newroot
-               else
-                       echo "Missing rootpath in what DHCP server sent to us. Failing..."
-                       echo "All seen variables are listed below:"
-                       set
-               fi
-       EOF
-
-       chmod 755 "$DESTDIR/bin/setdhcp"
-}
 
 initrd_gen_setrootdev() {
        debug "Adding rootfs finding based on kernel cmdline root= option support."
@@ -860,7 +790,7 @@ if [ -r /etc/sysconfig/geninitrd ]; then
        . /etc/sysconfig/geninitrd
 fi
 
-geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb
+geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs
 
 while [ $# -gt 0 ]; do
        case $1 in
This page took 0.031365 seconds and 4 git commands to generate.