Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jan 2009 16:23:48 +0100
From:      "Olivier SMEDTS" <olivier@gid0.org>
To:        "Hans Petter Selasky" <hselasky@c2i.net>
Cc:        Ed Maste <emaste@freebsd.org>, freebsd-usb@freebsd.org
Subject:   Re: Advice on booting from usb2
Message-ID:  <367b2c980901100723h19dc2ff6x55a48c96dcdce9b3@mail.gmail.com>
In-Reply-To: <200901101508.44659.hselasky@c2i.net>
References:  <200901101332.04206.Thomas.Sparrevohn@btinternet.com> <200901101508.44659.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
2009/1/10 Hans Petter Selasky <hselasky@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@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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-usb
> To unsubscribe, send any mail to "freebsd-usb-unsubscribe@freebsd.org"
>



-- 
Olivier Smedts                                                 _
                                        ASCII ribbon campaign ( )
e-mail: olivier@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."



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