1 Index: linux-2.6.23/drivers/mtd/devices/block2mtd.c
2 ===================================================================
3 --- linux-2.6.23.orig/drivers/mtd/devices/block2mtd.c 2007-12-06 23:30:31.583285849 +0100
4 +++ linux-2.6.23/drivers/mtd/devices/block2mtd.c 2007-12-06 23:31:29.970613152 +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 VERSION "$Revision: 1.30 $"
15 #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
16 #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args)
19 + struct list_head list;
23 +static LIST_HEAD(retry_list);
25 /* Info for the block device */
26 struct block2mtd_dev {
31 +static int block2mtd_setup2(const char *val);
33 /* Static info about the MTD, used in cleanup_module */
34 static LIST_HEAD(blkmtd_device_list);
36 +static int add_retry(const char *val)
38 + struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL);
40 + INIT_LIST_HEAD(&r->list);
42 + list_add(&r->list, &retry_list);
47 +static int __init process_retries(void)
49 + struct list_head *p, *tmp;
51 + list_for_each_safe(p, tmp, &retry_list) {
52 + struct retry *r = list_entry(p, struct retry, list);
53 + block2mtd_setup2(r->val);
60 +rootfs_initcall(process_retries);
62 static struct page *page_read(struct address_space *mapping, int index)
65 if (token[2] && (strlen(token[2]) + 1 > 80))
66 parse_err("mtd device name too long");
68 - add_device(name, erase_size, token[2]);
69 + if (add_device(name, erase_size, token[2]) == NULL) {
77 and block2mtd_init() has already been called,
78 we can parse the argument now. */
80 - if (block2mtd_init_called)
81 + if (block2mtd_init_called) {
82 + /* if the call failed (e.g. because the device does not exist yet)
83 + * then try again just before attempting to mount the rootfs */
84 return block2mtd_setup2(val);
87 /* During early boot stage, we only save the parameters
88 here. We must parse them later: if the param passed
89 Index: linux-2.6.23/init/do_mounts.c
90 ===================================================================
91 --- linux-2.6.23.orig/init/do_mounts.c 2007-12-06 23:30:28.019082737 +0100
92 +++ linux-2.6.23/init/do_mounts.c 2007-12-06 23:30:32.459335774 +0100
97 -static unsigned int __initdata root_delay;
98 -static int __init root_delay_setup(char *str)
100 - root_delay = simple_strtoul(str, NULL, 0);
104 __setup("rootflags=", root_data_setup);
105 __setup("rootfstype=", fs_names_setup);
106 -__setup("rootdelay=", root_delay_setup);
108 static void __init get_fs_names(char *page)
115 - printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
117 - ssleep(root_delay);
120 - /* wait for the known devices to complete their probing */
121 - while (driver_probe_done() != 0)
126 if (saved_root_name[0]) {
127 root_device_name = saved_root_name;
128 if (!strncmp(root_device_name, "mtd", 3)) {
129 Index: linux-2.6.23/init/main.c
130 ===================================================================
131 --- linux-2.6.23.orig/init/main.c 2007-12-06 23:30:28.023082962 +0100
132 +++ linux-2.6.23/init/main.c 2007-12-06 23:30:32.463336000 +0100
134 #ifdef CONFIG_X86_LOCAL_APIC
137 +#include "do_mounts.h"
140 * This is one of the first .c files built. Error out early if we have compiler
141 @@ -662,13 +663,14 @@
142 __setup("initcall_debug", initcall_debug_setup);
144 extern initcall_t __initcall_start[], __initcall_end[];
145 +extern initcall_t __root_initcall_start[], __root_initcall_end[];
147 -static void __init do_initcalls(void)
148 +static void __init do_initcalls(initcall_t *start, initcall_t *end)
151 int count = preempt_count();
153 - for (call = __initcall_start; call < __initcall_end; call++) {
154 + for (call = start; call < end; call++) {
155 ktime_t t0, t1, delta;
159 usermodehelper_init();
163 + do_initcalls(__initcall_start, __initcall_end);
166 static int __initdata nosoftlockup;
168 panic("No init found. Try passing init= option to kernel.");
171 +static unsigned int __initdata root_delay;
172 +static int __init root_delay_setup(char *str)
174 + root_delay = simple_strtoul(str, NULL, 0);
177 +__setup("rootdelay=", root_delay_setup);
179 static int __init kernel_init(void * unused)
184 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
185 ramdisk_execute_command = NULL;
187 + printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
189 + ssleep(root_delay);
191 + /* wait for the known devices to complete their probing */
192 + while (driver_probe_done() != 0)
195 + do_initcalls(__root_initcall_start, __root_initcall_end);
200 Index: linux-2.6.23/arch/i386/kernel/vmlinux.lds.S
201 ===================================================================
202 --- linux-2.6.23.orig/arch/i386/kernel/vmlinux.lds.S 2007-12-06 23:30:28.035083650 +0100
203 +++ linux-2.6.23/arch/i386/kernel/vmlinux.lds.S 2007-12-06 23:30:32.467336225 +0100
208 + .root_initcall.init : AT(ADDR(.root_initcall.init) - LOAD_OFFSET) {
209 + __root_initcall_start = .;
211 + __root_initcall_end = .;
213 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
214 __con_initcall_start = .;
215 *(.con_initcall.init)
216 Index: linux-2.6.23/include/asm-generic/vmlinux.lds.h
217 ===================================================================
218 --- linux-2.6.23.orig/include/asm-generic/vmlinux.lds.h 2007-12-06 23:30:28.043084102 +0100
219 +++ linux-2.6.23/include/asm-generic/vmlinux.lds.h 2007-12-06 23:30:32.467336225 +0100
220 @@ -243,12 +243,14 @@
221 *(.initcall4s.init) \
223 *(.initcall5s.init) \
224 - *(.initcallrootfs.init) \
226 *(.initcall6s.init) \
230 +#define INITCALLS_ROOT \
231 + *(.initcallrootfs.init)
233 #define PERCPU(align) \
235 __per_cpu_start = .; \