1 Index: linux-2.6.31.5/drivers/mtd/devices/block2mtd.c
2 ===================================================================
3 --- linux-2.6.31.5.orig/drivers/mtd/devices/block2mtd.c 2009-11-07 13:52:05.000000000 +0100
4 +++ linux-2.6.31.5/drivers/mtd/devices/block2mtd.c 2009-11-07 13:52:17.000000000 +0100
6 #include <linux/buffer_head.h>
7 #include <linux/mutex.h>
8 #include <linux/mount.h>
9 +#include <linux/list.h>
10 +#include <linux/delay.h>
12 #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
13 #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args)
16 + struct list_head list;
20 +static LIST_HEAD(retry_list);
22 /* Info for the block device */
23 struct block2mtd_dev {
28 +static int block2mtd_setup2(const char *val);
30 /* Static info about the MTD, used in cleanup_module */
31 static LIST_HEAD(blkmtd_device_list);
33 +static int add_retry(const char *val) {
34 + struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL);
36 + INIT_LIST_HEAD(&r->list);
38 + list_add(&r->list, &retry_list);
43 +static int __init process_retries(void) {
44 + struct list_head *p, *tmp;
46 + list_for_each_safe(p, tmp, &retry_list) {
47 + struct retry *r = list_entry(p, struct retry, list);
48 + block2mtd_setup2(r->val);
55 +rootfs_initcall(process_retries);
57 static struct page *page_read(struct address_space *mapping, int index)
60 if (token[2] && (strlen(token[2]) + 1 > 80))
61 parse_err("mtd device name too long");
63 - add_device(name, erase_size, token[2]);
64 + if (add_device(name, erase_size, token[2]) == NULL) {
70 Index: linux-2.6.31.5/include/asm-generic/vmlinux.lds.h
71 ===================================================================
72 --- linux-2.6.31.5.orig/include/asm-generic/vmlinux.lds.h 2009-11-07 13:52:04.000000000 +0100
73 +++ linux-2.6.31.5/include/asm-generic/vmlinux.lds.h 2009-11-07 13:52:17.000000000 +0100
78 - *(.initcallrootfs.init) \
84 +#define INITCALLS_ROOT \
85 + *(.initcallrootfs.init)
88 VMLINUX_SYMBOL(__initcall_start) = .; \
90 Index: linux-2.6.31.5/init/do_mounts.c
91 ===================================================================
92 --- linux-2.6.31.5.orig/init/do_mounts.c 2009-10-23 00:57:56.000000000 +0200
93 +++ linux-2.6.31.5/init/do_mounts.c 2009-11-07 13:52:17.000000000 +0100
98 -static unsigned int __initdata root_delay;
99 -static int __init root_delay_setup(char *str)
101 - root_delay = simple_strtoul(str, NULL, 0);
105 __setup("rootflags=", root_data_setup);
106 __setup("rootfstype=", fs_names_setup);
107 -__setup("rootdelay=", root_delay_setup);
109 static void __init get_fs_names(char *page)
116 - printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
118 - ssleep(root_delay);
122 - * wait for the known devices to complete their probing
124 - * Note: this is a potential source of long boot delays.
125 - * For example, it is not atypical to wait 5 seconds here
126 - * for the touchpad of a laptop to initialize.
128 - wait_for_device_probe();
132 if (saved_root_name[0]) {
133 root_device_name = saved_root_name;
134 if (!strncmp(root_device_name, "mtd", 3) ||
135 Index: linux-2.6.31.5/init/main.c
136 ===================================================================
137 --- linux-2.6.31.5.orig/init/main.c 2009-11-07 13:52:16.000000000 +0100
138 +++ linux-2.6.31.5/init/main.c 2009-11-07 14:00:29.000000000 +0100
140 #ifdef CONFIG_X86_LOCAL_APIC
143 +#include "do_mounts.h"
145 static int kernel_init(void *);
147 @@ -784,12 +785,13 @@
150 extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[];
151 +extern initcall_t __root_initcall_start[], __root_initcall_end[];
153 -static void __init do_initcalls(void)
154 +static void __init do_initcalls(initcall_t *start, initcall_t *end)
158 - for (call = __early_initcall_end; call < __initcall_end; call++)
159 + for (call = start; call < end; call++)
160 do_one_initcall(*call);
162 /* Make sure there is no pending stuff from the initcall sequence */
168 + do_initcalls(__early_initcall_end, __initcall_end);
171 static void __init do_pre_smp_initcalls(void)
173 panic("No init found. Try passing init= option to kernel.");
176 +static unsigned int __initdata root_delay;
177 +static int __init root_delay_setup(char *str)
179 + root_delay = simple_strtoul(str, NULL, 0);
182 +__setup("rootdelay=", root_delay_setup);
183 static int __init kernel_init(void * unused)
188 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
189 ramdisk_execute_command = NULL;
190 - prepare_namespace();
192 + printk(KERN_INFO "Waiting %desc before mounting root device...\n",
194 + ssleep(root_delay);
196 + while (driver_probe_done() != 0)
199 + do_initcalls(__root_initcall_start, __root_initcall_end);
200 + prepare_namespace();