Re: Can't boot 8.0-BETA4 from USB stick

From: Andrey V. Elsukov <bu7cher_at_yandex.ru>
Date: Wed, 16 Sep 2009 09:43:18 +0400
Scott Long wrote:
> Delaying the mountroot doesn't fix the problem.  The problem is that 
> there's a race between the process doing the USB tree discovery, and the 
> process doing the CAM/SCSI bus scan.  The tree discovery needs to happen 
> before the bus scan, and no amount of root delay tweaks will help that, 
> except maybe accidentally by shifting timings.  I'm working on the 
> correct solution.  I'll hopefully have something tomorrow.

Hi, Scott.

I wrote small kld which i load from boot prompt and now my flash device
detected (i know it's hack, but it can help until you are working on right solution) :)

-- 
WBR, Andrey V. Elsukov

/*-
 * Copyright (c) 2009 Andrey V. Elsukov <bu7cher_at_yandex.ru>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/systm.h>

static struct callout wait_callout;
static struct root_hold_token *wait_hold = NULL;
static int wait_seconds = 15;

static void
wait_timeout(void *arg)
{
	if (wait_hold != NULL)
		root_mount_rel(wait_hold);
}

static int
wait_modevent(module_t mod, int type, void *unused)
{
	switch (type) {
	case MOD_LOAD:
		wait_hold = root_mount_hold("USB Flash");
		if (wait_hold != NULL) {
			callout_init(&wait_callout, 0);
			callout_reset(&wait_callout, hz * wait_seconds,
					wait_timeout, NULL);
		}
		break;
	case MOD_UNLOAD:
		if (wait_hold != NULL)
			callout_stop(&wait_callout);
		break;
	};
	return (0);
}
static moduledata_t waitmod = {
	"wait",
	wait_modevent,
	0
};

DECLARE_MODULE(wait, waitmod, SI_SUB_ROOT_CONF, SI_ORDER_ANY);
Received on Wed Sep 16 2009 - 03:43:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:55 UTC