Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jan 2009 15:08:43 +0100
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-usb@freebsd.org
Cc:        Ed Maste <emaste@freebsd.org>
Subject:   Re: Advice on booting from usb2
Message-ID:  <200901101508.44659.hselasky@c2i.net>
In-Reply-To: <200901101332.04206.Thomas.Sparrevohn@btinternet.com>
References:  <200901101332.04206.Thomas.Sparrevohn@btinternet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901101508.44659.hselasky>