1 --- a/arch/x86/kernel/vmlinux_32.lds.S
2 +++ b/arch/x86/kernel/vmlinux_32.lds.S
3 @@ -135,6 +135,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 @@ -510,7 +542,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)
98 #define PERCPU(align) \
100 VMLINUX_SYMBOL(__per_cpu_start) = .; \
101 --- a/init/do_mounts.c
102 +++ b/init/do_mounts.c
103 @@ -174,16 +174,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 @@ -359,18 +351,6 @@ void __init prepare_namespace(void)
125 - printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
127 - ssleep(root_delay);
130 - /* wait for the known devices to complete their probing */
131 - while (driver_probe_done() != 0)
136 if (saved_root_name[0]) {
137 root_device_name = saved_root_name;
138 if (!strncmp(root_device_name, "mtd", 3) ||
142 #ifdef CONFIG_X86_LOCAL_APIC
145 +#include "do_mounts.h"
148 * This is one of the first .c files built. Error out early if we have compiler
149 @@ -745,12 +746,13 @@ int do_one_initcall(initcall_t fn)
152 extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[];
153 +extern initcall_t __root_initcall_start[], __root_initcall_end[];
155 -static void __init do_initcalls(void)
156 +static void __init do_initcalls(initcall_t *start, initcall_t *end)
160 - for (call = __early_initcall_end; call < __initcall_end; call++)
161 + for (call = start; call < end; call++)
162 do_one_initcall(*call);
164 /* Make sure there is no pending stuff from the initcall sequence */
165 @@ -772,7 +774,7 @@ static void __init do_basic_setup(void)
166 usermodehelper_init();
170 + do_initcalls(__early_initcall_end, __initcall_end);
173 static void __init do_pre_smp_initcalls(void)
174 @@ -833,6 +835,13 @@ static int noinline init_post(void)
175 panic("No init found. Try passing init= option to kernel.");
178 +static unsigned int __initdata root_delay;
179 +static int __init root_delay_setup(char *str)
181 + root_delay = simple_strtoul(str, NULL, 0);
184 +__setup("rootdelay=", root_delay_setup);
185 static int __init kernel_init(void * unused)
188 @@ -873,7 +882,16 @@ static int __init kernel_init(void * unu
190 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
191 ramdisk_execute_command = NULL;
192 - prepare_namespace();
194 + printk(KERN_INFO "Waiting %desc before mounting root device...\n",
196 + ssleep(root_delay);
198 + while (driver_probe_done() != 0)
201 + do_initcalls(__root_initcall_start, __root_initcall_end);
202 + prepare_namespace();