1 --- a/arch/x86/kernel/vmlinux.lds.S
2 +++ b/arch/x86/kernel/vmlinux.lds.S
3 @@ -244,6 +244,12 @@ SECTIONS
7 + .root_initcall.init : AT(ADDR(.root_initcall.init) - LOAD_OFFSET) {
8 + __root_initcall_start = .;
10 + __root_initcall_end = .;
13 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
14 __con_initcall_start = .;
16 --- a/drivers/mtd/devices/block2mtd.c
17 +++ b/drivers/mtd/devices/block2mtd.c
19 #include <linux/buffer_head.h>
20 #include <linux/mutex.h>
21 #include <linux/mount.h>
22 +#include <linux/list.h>
23 +#include <linux/delay.h>
25 #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
26 #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args)
29 + struct list_head list;
33 +static LIST_HEAD(retry_list);
35 /* Info for the block device */
36 struct block2mtd_dev {
37 @@ -33,10 +41,34 @@ struct block2mtd_dev {
41 +static int block2mtd_setup2(const char *val);
43 /* Static info about the MTD, used in cleanup_module */
44 static LIST_HEAD(blkmtd_device_list);
46 +static int add_retry(const char *val) {
47 + struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL);
49 + INIT_LIST_HEAD(&r->list);
51 + list_add(&r->list, &retry_list);
56 +static int __init process_retries(void) {
57 + struct list_head *p, *tmp;
59 + list_for_each_safe(p, tmp, &retry_list) {
60 + struct retry *r = list_entry(p, struct retry, list);
61 + block2mtd_setup2(r->val);
68 +rootfs_initcall(process_retries);
70 static struct page *page_read(struct address_space *mapping, int index)
72 @@ -511,7 +543,9 @@ static int block2mtd_setup2(const char *
73 if (token[2] && (strlen(token[2]) + 1 > 80))
74 parse_err("mtd device name too long");
76 - add_device(name, erase_size, token[2]);
77 + if (add_device(name, erase_size, token[2]) == NULL) {
83 --- a/include/asm-generic/vmlinux.lds.h
84 +++ b/include/asm-generic/vmlinux.lds.h
89 - *(.initcallrootfs.init) \
95 +#define INITCALLS_ROOT \
96 + *(.initcallrootfs.init)
99 VMLINUX_SYMBOL(__initcall_start) = .; \
101 --- a/init/do_mounts.c
102 +++ b/init/do_mounts.c
103 @@ -176,16 +176,8 @@ static int __init fs_names_setup(char *s
107 -static unsigned int __initdata root_delay;
108 -static int __init root_delay_setup(char *str)
110 - root_delay = simple_strtoul(str, NULL, 0);
114 __setup("rootflags=", root_data_setup);
115 __setup("rootfstype=", fs_names_setup);
116 -__setup("rootdelay=", root_delay_setup);
118 static void __init get_fs_names(char *page)
120 @@ -366,23 +358,6 @@ void __init prepare_namespace(void)
125 - printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
127 - ssleep(root_delay);
131 - * wait for the known devices to complete their probing
133 - * Note: this is a potential source of long boot delays.
134 - * For example, it is not atypical to wait 5 seconds here
135 - * for the touchpad of a laptop to initialize.
137 - wait_for_device_probe();
141 if (saved_root_name[0]) {
142 root_device_name = saved_root_name;
143 if (!strncmp(root_device_name, "mtd", 3) ||
147 #ifdef CONFIG_X86_LOCAL_APIC
150 +#include "do_mounts.h"
152 static int kernel_init(void *);
154 @@ -779,12 +780,13 @@ int do_one_initcall(initcall_t fn)
157 extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[];
158 +extern initcall_t __root_initcall_start[], __root_initcall_end[];
160 -static void __init do_initcalls(void)
161 +static void __init do_initcalls(initcall_t *start, initcall_t *end)
165 - for (call = __early_initcall_end; call < __initcall_end; call++)
166 + for (call = start; call < end; call++)
167 do_one_initcall(*call);
169 /* Make sure there is no pending stuff from the initcall sequence */
170 @@ -807,7 +809,7 @@ static void __init do_basic_setup(void)
175 + do_initcalls(__early_initcall_end, __initcall_end);
178 static void __init do_pre_smp_initcalls(void)
179 @@ -868,6 +870,13 @@ static noinline int init_post(void)
180 panic("No init found. Try passing init= option to kernel.");
183 +static unsigned int __initdata root_delay;
184 +static int __init root_delay_setup(char *str)
186 + root_delay = simple_strtoul(str, NULL, 0);
189 +__setup("rootdelay=", root_delay_setup);
190 static int __init kernel_init(void * unused)
193 @@ -912,7 +921,16 @@ static int __init kernel_init(void * unu
195 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
196 ramdisk_execute_command = NULL;
197 - prepare_namespace();
199 + printk(KERN_INFO "Waiting %desc before mounting root device...\n",
201 + ssleep(root_delay);
203 + while (driver_probe_done() != 0)
206 + do_initcalls(__root_initcall_start, __root_initcall_end);
207 + prepare_namespace();