Advice on booting from usb2

Olivier SMEDTS olivier at gid0.org
Sat Jan 10 07:56:22 PST 2009


2009/1/10 Hans Petter Selasky <hselasky at c2i.net>:
> 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 :

Great, my ZFS-only USB key could only boot by mounting root manually.
I'll try this.

Cheers

> --- 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
> _______________________________________________
> freebsd-usb at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-usb
> To unsubscribe, send any mail to "freebsd-usb-unsubscribe at freebsd.org"
>



-- 
Olivier Smedts                                                 _
                                        ASCII ribbon campaign ( )
e-mail: olivier at gid0.org        - against HTML email & vCards  X
www: http://www.gid0.org    - against proprietary attachments / \

  "Il y a seulement 10 sortes de gens dans le monde :
  ceux qui comprennent le binaire,
  et ceux qui ne le comprennent pas."


More information about the freebsd-usb mailing list