lkml.org 
[lkml]   [2003]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] USB HardDisk Booting 2.4.20
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();

/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.044 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site