Advice on booting from usb2
Hans Petter Selasky
hselasky at c2i.net
Sat Jan 10 06:06:24 PST 2009
On Saturday 10 January 2009, Thomas Sparrevohn wrote:
> I have a 4GB SDHC card that I have formatted with ufs and installed a
> current kernel on - Its connected to a USB reader. Now here is the thing -
> I can boot the kernel with USB2 well enough but when it comes to mount root
> - it looks like USB2 has not probed and attached the device yet and I get
> the "mount root from" prompt - however it does not show the cam devices
>
> Any advice?
It's being worked on by "Ed Maste <emaste at freebsd.org>".
Temporary patch is available here for kern/vfs_mount.c :
--- vfs_mount.c.orig Mon Dec 22 14:43:36 2008
+++ vfs_mount.c Mon Dec 22 15:09:14 2008
@@ -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>
@@ -1606,7 +1607,11 @@
vfs_mountroot(void)
{
char *cp;
- int error, i, asked = 0;
+ const char *rootdevname_orig;
+ int error;
+ unsigned int i;
+ unsigned char asked = 0; /* set if asked for mount point */
+ unsigned char timeout = 16; /* seconds */
root_mount_prepare();
@@ -1624,6 +1629,10 @@
asked = 1;
}
+ /* store a copy of the initial root device name */
+ rootdevname_orig = ctrootdevname;
+ retry:
+
/*
* The root filesystem information is compiled in, and we are
* booted with instructions to use it.
@@ -1674,12 +1683,27 @@
if (!vfs_mountroot_try(ctrootdevname))
goto mounted;
/*
- * Everything so far has failed, prompt on the console if we haven't
- * already tried that.
+ * Check if we should try more times.
+ */
+ if (timeout != 0) {
+ timeout--;
+ pause("WROOT", hz);
+ if (cncheckc() == -1) {
+ /* no key press - try again */
+ ctrootdevname = rootdevname_orig;
+ goto retry;
+ }
+ }
+
+ /*
+ * Everything so far has failed, prompt on the console if we
+ * haven't already tried that.
*/
- if (!asked)
+ if (!asked) {
+ printf("\n");
if (!vfs_mountroot_ask())
goto mounted;
+ }
panic("Root mount failed, startup aborted.");
--HPS
More information about the freebsd-usb
mailing list