PERFORCE change 144611 for review

Hans Petter Selasky hselasky at FreeBSD.org
Fri Jul 4 13:14:14 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=144611

Change 144611 by hselasky at hselasky_laptop001 on 2008/07/04 13:13:46

	
	Improve booting from removable devices.

Affected files ...

.. //depot/projects/usb/src/sys/kern/vfs_mount.c#10 edit

Differences ...

==== //depot/projects/usb/src/sys/kern/vfs_mount.c#10 (text+ko) ====

@@ -58,6 +58,7 @@
 #include <sys/sysent.h>
 #include <sys/systm.h>
 #include <sys/vnode.h>
+#include <sys/cons.h>
 #include <vm/uma.h>
 
 #include <geom/geom.h>
@@ -148,10 +149,7 @@
 
 /* legacy find-root code */
 char		*rootdevnames[2] = {NULL, NULL};
-#ifndef ROOTDEVNAME
-#  define ROOTDEVNAME NULL
-#endif
-static const char	*ctrootdevname = ROOTDEVNAME;
+static const char	*ctrootdevname = NULL;
 
 /*
  * ---------------------------------------------------------------------
@@ -1613,7 +1611,10 @@
 vfs_mountroot(void)
 {
 	char *cp;
-	int error, i, asked = 0;
+	int error;
+	uint8_t i;
+	uint8_t asked = 0;
+	uint8_t timeout = 16;
 
 	root_mount_prepare();
 
@@ -1631,6 +1632,11 @@
 		asked = 1;
 	}
 
+ retry:
+#ifdef ROOTDEVNAME
+	ctrootdevname = ROOTDEVNAME;
+#endif
+
 	/*
 	 * The root filesystem information is compiled in, and we are
 	 * booted with instructions to use it.
@@ -1684,9 +1690,24 @@
 	 * Everything so far has failed, prompt on the console if we haven't
 	 * already tried that.
 	 */
-	if (!asked)
+	if (!asked) {
+		if (--timeout) {
+			/* 
+			 * Improve booting from removable devices
+			 * having USB in mind.
+			 */
+			printf("Waiting %u more seconds for boot "
+			       "device. Press any key for boot "
+			       "prompt.\r", timeout);
+			pause("WROOT", hz);
+			if (cncheckc() == -1) {
+				goto retry;
+			}
+			printf("\n");
+		}
 		if (!vfs_mountroot_ask())
 			goto mounted;
+	}
 
 	panic("Root mount failed, startup aborted.");
 


More information about the p4-projects mailing list