USB disks attach after rootfs prompt

Edward Tomasz Napierała trasz at FreeBSD.org
Sat Mar 19 21:56:30 UTC 2016


On 0319T1509, Poul-Henning Kamp wrote:
> --------
> In message <1458397972.68920.69.camel at freebsd.org>, Ian Lepore writes:
> >On Sat, 2016-03-19 at 13:04 +0000, Poul-Henning Kamp wrote:
> >> Running:
> >> 
> >> 	FreeBSD 11.0-CURRENT #32 r296137: Sat Feb 27 11:34:01 UTC 2016
> >> 
> >> I tried "boot -a" and found that USB disks only attach *after* you
> >> enter some root filesystem.
> >> 
> >> That's not terribly useful.
> >
> >iirc, interrupts are disabled while you're at the mountroot prompt,
> >which freezes usb enumeration.
> 
> I am somewhat certain that this used to work...

That might be my fault.  I've modified the root mount mechanism to only
wait for the root mount tokens (ie USB) if the root device isn't already
there; basically this makes the kernel not wait for USB if rootfs is
on SATA.

Does the following fix things for you?  (Note there's something
seriously wrong with character echo, but it doesn't seem related.)

Index: svn/head/sys/kern/vfs_mountroot.c
===================================================================
--- svn/head/sys/kern/vfs_mountroot.c	(revision 297053)
+++ svn/head/sys/kern/vfs_mountroot.c	(working copy)
@@ -89,6 +89,7 @@ __FBSDID("$FreeBSD$");
 static int parse_mount(char **);
 static struct mntarg *parse_mountroot_options(struct mntarg *, const char *);
 static int sysctl_vfs_root_mount_hold(SYSCTL_HANDLER_ARGS);
+static void vfs_mountroot_wait(void);
 static int vfs_mountroot_wait_if_neccessary(const char *fs, const char *dev);
 
 /*
@@ -488,6 +489,8 @@ parse_dir_ask(char **conf)
 	char *mnt;
 	int error;
 
+	vfs_mountroot_wait();
+
 	printf("\nLoader variables:\n");
 	parse_dir_ask_printenv("vfs.root.mountfrom");
 	parse_dir_ask_printenv("vfs.root.mountfrom.options");



More information about the freebsd-current mailing list