Subject: Re: Son of diskless boot
To: None <jonathan@DSG.Stanford.EDU>
From: maximum entropy <entropy@zippy.bernstein.com>
List: port-i386
Date: 05/23/1997 07:19:54
>From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
>
>Does booting from flopppy cause the kernel to receive the major/minor
>for the floppy, tricking setroot() into continuing far enouhg to call
>nfs_setroot()?  If the i386 kernel needs _some_ kind of major/minor,
>and it's not getting one from dosboot, then isn't that a bug in
>dosboot ( or the kernel)?

Yes!!!

The checks are done in the wrong order:  if no boot device was
determined, it sets RB_ASKNAME.  The next block of code then finds the
nfs device for rootspec, but RB_ASKNAME is already set so it prompts
the user anyway.

Here is a patch:

--- /sys/kern/kern_subr.c-CURRENT	Thu Mar 27 07:21:18 1997
+++ /sys/kern/kern_subr.c	Fri May 23 07:10:25 1997
@@ -399,13 +399,6 @@
 #endif
 
 	/*
-	 * If wildcarded root and we the boot device wasn't determined,
-	 * ask the user.
-	 */
-	if (rootspec == NULL && bootdv == NULL)
-		boothowto |= RB_ASKNAME;
-
-	/*
 	 * If NFS is specified as the file system, and we found
 	 * a DV_DISK boot device (or no boot device at all), then
 	 * find a reasonable network interface for "rootspec".
@@ -433,6 +426,13 @@
 			rootspec = (const char *)ifp->if_xname;
 		}
 	}
+
+	/*
+	 * If wildcarded root and the boot device wasn't determined,
+	 * ask the user.
+	 */
+	if (rootspec == NULL && bootdv == NULL)
+		boothowto |= RB_ASKNAME;
 
  top:
 	if (boothowto & RB_ASKNAME) {

--
entropy -- it's not just a good idea, it's the second law.