1 --- a/drivers/mtd/devices/block2mtd.c
2 +++ b/drivers/mtd/devices/block2mtd.c
4 #include <linux/buffer_head.h>
5 #include <linux/mutex.h>
6 #include <linux/mount.h>
7 +#include <linux/list.h>
8 +#include <linux/delay.h>
10 #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
11 #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args)
14 + struct list_head list;
18 +static LIST_HEAD(retry_list);
20 /* Info for the block device */
21 struct block2mtd_dev {
22 @@ -33,10 +41,34 @@ struct block2mtd_dev {
26 +static int block2mtd_setup2(const char *val);
28 /* Static info about the MTD, used in cleanup_module */
29 static LIST_HEAD(blkmtd_device_list);
31 +static int add_retry(const char *val) {
32 + struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL);
34 + INIT_LIST_HEAD(&r->list);
36 + list_add(&r->list, &retry_list);
41 +static int __init process_retries(void) {
42 + struct list_head *p, *tmp;
44 + list_for_each_safe(p, tmp, &retry_list) {
45 + struct retry *r = list_entry(p, struct retry, list);
46 + block2mtd_setup2(r->val);
53 +rootfs_initcall(process_retries);
55 static struct page *page_read(struct address_space *mapping, int index)
57 @@ -511,7 +543,9 @@ static int block2mtd_setup2(const char *
58 if (token[2] && (strlen(token[2]) + 1 > 80))
59 parse_err("mtd device name too long");
61 - add_device(name, erase_size, token[2]);
62 + if (add_device(name, erase_size, token[2]) == NULL) {
68 --- a/include/asm-generic/vmlinux.lds.h
69 +++ b/include/asm-generic/vmlinux.lds.h
74 - *(.initcallrootfs.init) \
80 +#define INITCALLS_ROOT \
81 + *(.initcallrootfs.init)
84 VMLINUX_SYMBOL(__initcall_start) = .; \
86 --- a/init/do_mounts.c
87 +++ b/init/do_mounts.c
88 @@ -176,16 +176,8 @@ static int __init fs_names_setup(char *s
92 -static unsigned int __initdata root_delay;
93 -static int __init root_delay_setup(char *str)
95 - root_delay = simple_strtoul(str, NULL, 0);
99 __setup("rootflags=", root_data_setup);
100 __setup("rootfstype=", fs_names_setup);
101 -__setup("rootdelay=", root_delay_setup);
103 static void __init get_fs_names(char *page)
105 @@ -366,23 +358,6 @@ void __init prepare_namespace(void)
110 - printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
112 - ssleep(root_delay);
116 - * wait for the known devices to complete their probing
118 - * Note: this is a potential source of long boot delays.
119 - * For example, it is not atypical to wait 5 seconds here
120 - * for the touchpad of a laptop to initialize.
122 - wait_for_device_probe();
126 if (saved_root_name[0]) {
127 root_device_name = saved_root_name;
128 if (!strncmp(root_device_name, "mtd", 3) ||
132 #ifdef CONFIG_X86_LOCAL_APIC
135 +#include "do_mounts.h"
137 static int kernel_init(void *);
139 @@ -784,12 +785,13 @@ int do_one_initcall(initcall_t fn)
142 extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[];
143 +extern initcall_t __root_initcall_start[], __root_initcall_end[];
145 -static void __init do_initcalls(void)
146 +static void __init do_initcalls(initcall_t *start, initcall_t *end)
150 - for (call = __early_initcall_end; call < __initcall_end; call++)
151 + for (call = start; call < end; call++)
152 do_one_initcall(*call);
154 /* Make sure there is no pending stuff from the initcall sequence */
155 @@ -873,6 +875,13 @@ static noinline int init_post(void)
156 panic("No init found. Try passing init= option to kernel.");
159 +static unsigned int __initdata root_delay;
160 +static int __init root_delay_setup(char *str)
162 + root_delay = simple_strtoul(str, NULL, 0);
165 +__setup("rootdelay=", root_delay_setup);
166 static int __init kernel_init(void * unused)
169 @@ -917,7 +926,16 @@ static int __init kernel_init(void * unu
171 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
172 ramdisk_execute_command = NULL;
173 - prepare_namespace();
175 + printk(KERN_INFO "Waiting %desc before mounting root device...\n",
177 + ssleep(root_delay);
179 + while (driver_probe_done() != 0)
182 + do_initcalls(__root_initcall_start, __root_initcall_end);
183 + prepare_namespace();