public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <willy@w.ods.org>
To: Samuel Flory <sflory@rackable.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Wesley Wright <wewright@verizonmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] USB HardDisk Booting 2.4.20
Date: Fri, 31 Jan 2003 03:21:51 +0100	[thread overview]
Message-ID: <20030131022151.GA25068@alpha.home.local> (raw)
In-Reply-To: <3E39A895.9000602@rackable.com>

On Thu, Jan 30, 2003 at 02:35:01PM -0800, Samuel Flory wrote:
>  The problem I've seen is there is a several second delay before the 
> usb device is availble.  My solution was to stick a sleep in my initrd 
> before attempting to mount /.  A more rational patch might be to retry 
> mounting / after a few seconds delay before giving up.  I think I saw 
> patch doing this on the usb list.

Hello !

I'm personnaly using this simple patch with success with an usb disk on
key. It adds an option "setuptime" which waits the requested amount of ms
before booting. I use it with "setuptime=2500" and my USB works fine.

I think it could be of a more general use, and perhaps it could be
accepted into mainstream if it doesn't break anything ?

Cheers,
Willy


--- linux-21pre/init/main.c	Sat Dec 21 16:53:09 2002
+++ linux-21pre-usb/init/main.c	Sat Dec 21 17:35:50 2002
@@ -126,6 +126,7 @@
 
 static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
 char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
+static int setuptime;	/* time(ms) to let devices set up before root mount */
 
 static int __init profile_setup(char *str)
 {
@@ -136,6 +137,15 @@
 
 __setup("profile=", profile_setup);
 
+static int __init setuptime_setup(char *str)
+{
+    int par;
+    if (get_option(&str,&par)) setuptime = par;
+	return 1;
+}
+
+__setup("setuptime=", setuptime_setup);
+
 static int __init checksetup(char *line)
 {
 	struct kernel_param *p;
@@ -546,11 +556,25 @@
 
 extern void prepare_namespace(void);
 
+static int finish_setup()
+{
+	int tleft;
+	if (setuptime) {
+		printk("Waiting %d ms for devices to set up.\n", setuptime);
+		tleft = setuptime * HZ / 1000;
+		while (tleft) {
+			set_current_state(TASK_INTERRUPTIBLE);
+			tleft = schedule_timeout(tleft);
+		}
+	}
+}
+
 static int init(void * unused)
 {
 	lock_kernel();
 	do_basic_setup();
 
+	finish_setup();
 	prepare_namespace();
 
 	/*


  reply	other threads:[~2003-01-31  2:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-30 17:27 [PATCH] USB HardDisk Booting 2.4.20 Wesley Wright
2003-01-30 18:47 ` Alan Cox
2003-01-30 22:35   ` Samuel Flory
2003-01-31  2:21     ` Willy Tarreau [this message]
2003-02-01 15:00       ` Wesley Wright
2003-01-30 22:51   ` Wakko Warner
     [not found]   ` <mailman.1043967125.21672.linux-kernel2news@redhat.com>
2003-01-31  1:28     ` Pete Zaitcev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030131022151.GA25068@alpha.home.local \
    --to=willy@w.ods.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sflory@rackable.com \
    --cc=wewright@verizonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox