Re: [PATCH] Configurable delay before mounting root device

From: Daniel Drake
Date: Fri Jan 21 2005 - 10:20:31 EST


Andrew Morton wrote:
You owe me an update to Documentation/kernel-parameters.txt ;)
Adds a boot parameter which can be used to specify a delay (in seconds) before
the root device is decoded/discovered/mounted.

Example usage for 10 second delay:

rootdelay=10

Useful for usb-storage devices which no longer make their partitions
immediately available, and for other storage devices which require some
"spin-up" time.

Signed-off-by: Daniel Drake <dsd@xxxxxxxxxx>

--- linux-2.6.10/init/do_mounts.c.orig 2005-01-20 20:37:01.000000000 +0000
+++ linux-2.6.10/init/do_mounts.c 2005-01-20 20:44:47.190899080 +0000
@@ -6,6 +6,7 @@
#include <linux/suspend.h>
#include <linux/root_dev.h>
#include <linux/security.h>
+#include <linux/delay.h>

#include <linux/nfs_fs.h>
#include <linux/nfs_fs_sb.h>
@@ -228,8 +229,16 @@
return 1;
}

+static unsigned int __initdata root_delay;
+static int __init root_delay_setup(char *str)
+{
+ root_delay = simple_strtoul(str, NULL, 0);
+ return 1;
+}
+
__setup("rootflags=", root_data_setup);
__setup("rootfstype=", fs_names_setup);
+__setup("rootdelay=", root_delay_setup);

static void __init get_fs_names(char *page)
{
@@ -387,6 +396,12 @@

mount_devfs();

+ if (root_delay) {
+ printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
+ root_delay);
+ ssleep(root_delay);
+ }
+
md_run_setup();

if (saved_root_name[0]) {
--- linux-2.6.10/Documentation/kernel-parameters.txt.orig 2005-01-21 17:18:20.000000000 +0000
+++ linux-2.6.10/Documentation/kernel-parameters.txt 2005-01-21 17:22:29.000000000 +0000
@@ -1072,6 +1072,9 @@ running once the system is up.

root= [KNL] Root filesystem

+ rootdelay= [KNL] Delay (in seconds) to pause before attempting to
+ mount the root filesystem
+
rootflags= [KNL] Set root filesystem mount option string

rootfstype= [KNL] Set root filesystem type