[readonly/geninitrd/devel: 204/334] Initial support for rootfs on NFS.

draenog draenog at pld-linux.org
Sat Nov 2 19:28:40 CET 2013


commit 6fe19d5b38724cb3a6ddce997f3eca864eb74985
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Jun 5 15:33:21 2004 +0000

    Initial support for rootfs on NFS.
    
    svn-id: @4146

 geninitrd | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
---
diff --git a/geninitrd b/geninitrd
index 290507f..c109271 100755
--- a/geninitrd
+++ b/geninitrd
@@ -21,6 +21,7 @@ USERAIDSTART="yes"
 USEMDADMSTATIC="no"
 USEINSMODSTATIC="no"
 uselvm="no"
+usenfs="no"
 # it should be safe to remove scsi_mod from here, but I'm not sure...
 PRESCSIMODS="-scsi_mod unknown -sd_mod"
 PREIDEMODS="-ide-core unknown -ide-detect -ide-disk"
@@ -542,6 +543,18 @@ find_modules_for() {
         if [ -z "$1" ]; then
 	    	echo "ERROR: no argument passed to find_modules_for()" >&2
 		exit
+	elif is_yes "`echo "$1" | awk '/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:/ { print "yes"; }'`"; then
+		if [ ! -x /usr/bin/pcidev ] ; then
+		    echo "ERROR: root on NFS but /usr/bin/pcidev not found." >&2
+		    echo "Please install correct pci-database package and rerun $0." >&2
+		    exit 1
+		fi
+		for m in $(/usr/bin/pcidev /m net | xargs); do
+		    findmodule "$m"
+		done
+		findmodule "-ipv4"
+	        findmodule "nfs"
+		usenfs="yes"
 	elif is_yes "`echo "$1" | awk '/^\/dev\/md/ { print "yes"; }'`"; then
 		find_modules_softraid "$1"
 	elif is_yes "$(echo "$1" | awk '/^\/dev\/(sd|scsi)/ { print "yes"; }')" ; then
@@ -1012,6 +1025,21 @@ if is_yes "$USERAIDSTART" && is_yes "$raidfound" ; then
 	fi
 fi
 
+if is_yes "$usenfs" ; then
+    	[ -n "$verbose" ] && echo "Adding rootfs on NFS support to initrd (dhcp)"
+	mkdir "$MNTIMAGE/newroot/"
+	mkdir "$MNTIMAGE/newroot/initrd"
+	mkdir "$MNTIMAGE/newroot/dev"
+	mknod "$MNTIMAGE/newroot/dev/console" c 5 1
+	mknod "$MNTIMAGE/newroot/dev/null" c 1 3
+	mknod "$MNTIMAGE/newroot/dev/zero" c 1 5
+    	echo "busybox udhcpc"  >> "$s"
+	echo "mount -n -t nfs -o ro $rootdev1 /newroot" >> "$s"
+	echo "cd /new_root" >> "$s"
+	echo "pivot_root /new_root /new_root/initrd" >> "$s"
+	echo "exec chroot . /sbin/init" >> "$s"
+fi
+
 if is_yes "$uselvm" ; then
 	[ -n "$verbose" ] && echo "Adding LVM support to initrd"
 	inst /sbin/initrd-lvm $MNTIMAGE/bin/lvm
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/398807324938659207036e520c0950a61ef50c11



More information about the pld-cvs-commit mailing list