lkml.org 
[lkml]   [2004]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Possible to delay boot process to boot from USB subsystem?
Hi,

I include the following patch in all my kernels. It adds a "setuptime" boot
option which allows one to specify how many milliseconds to wait before
mounting the root FS. I usually wait 2500 ms to boot on USB flash, but I
once saw a machine which required a bit more (4 sec). The advantage is that
if it isn't enough, just reboot and change the paramter.

Regards,
Willy


diff -urN linux-2.4.23-rc3/init/main.c linux-2.4.23-rc3-setuptime/init/main.c
--- linux-2.4.23-rc3/init/main.c Fri Oct 10 08:47:16 2003
+++ linux-2.4.23-rc3-setuptime/init/main.c Sun Nov 23 18:12:19 2003
@@ -127,6 +127,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)
{
@@ -137,6 +138,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;
@@ -553,12 +563,26 @@

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)
{
struct files_struct *files;
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 14:02    [W:0.274 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site