1 Index: linux-2.6.23/drivers/mtd/devices/block2mtd.c
2 ===================================================================
3 --- linux-2.6.23.orig/drivers/mtd/devices/block2mtd.c 2007-10-25 21:43:40.854599193 +0200
4 +++ linux-2.6.23/drivers/mtd/devices/block2mtd.c 2007-10-25 22:23:19.066125745 +0200
6 #include <linux/buffer_head.h>
7 #include <linux/mutex.h>
8 #include <linux/mount.h>
9 +#include <linux/list.h>
11 #define VERSION "$Revision: 1.30 $"
14 #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
15 #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args)
18 + struct list_head list;
22 +static LIST_HEAD(retry_list);
24 /* Info for the block device */
25 struct block2mtd_dev {
30 +static int block2mtd_setup2(const char *val);
32 /* Static info about the MTD, used in cleanup_module */
33 static LIST_HEAD(blkmtd_device_list);
35 +static int add_retry(const char *val)
37 + struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL);
39 + INIT_LIST_HEAD(&r->list);
41 + list_add(&r->list, &retry_list);
46 +static int __init process_retries(void)
48 + struct list_head *p, *tmp;
50 + list_for_each_safe(p, tmp, &retry_list) {
51 + struct retry *r = list_entry(p, struct retry, list);
52 + block2mtd_setup2(r->val);
59 +rootfs_initcall(process_retries);
61 static struct page *page_read(struct address_space *mapping, int index)
64 if (token[2] && (strlen(token[2]) + 1 > 80))
65 parse_err("mtd device name too long");
67 - add_device(name, erase_size, token[2]);
68 + if (add_device(name, erase_size, token[2]) == NULL) {
76 and block2mtd_init() has already been called,
77 we can parse the argument now. */
79 - if (block2mtd_init_called)
80 + if (block2mtd_init_called) {
81 + /* if the call failed (e.g. because the device does not exist yet)
82 + * then try again just before attempting to mount the rootfs */
83 return block2mtd_setup2(val);
86 /* During early boot stage, we only save the parameters
87 here. We must parse them later: if the param passed
88 Index: linux-2.6.23/init/do_mounts.c
89 ===================================================================
90 --- linux-2.6.23.orig/init/do_mounts.c 2007-10-25 21:39:41.824977672 +0200
91 +++ linux-2.6.23/init/do_mounts.c 2007-10-25 21:41:22.466712918 +0200
96 -static unsigned int __initdata root_delay;
97 -static int __init root_delay_setup(char *str)
99 - root_delay = simple_strtoul(str, NULL, 0);
103 __setup("rootflags=", root_data_setup);
104 __setup("rootfstype=", fs_names_setup);
105 -__setup("rootdelay=", root_delay_setup);
107 static void __init get_fs_names(char *page)
114 - printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
116 - ssleep(root_delay);
119 - /* wait for the known devices to complete their probing */
120 - while (driver_probe_done() != 0)
125 if (saved_root_name[0]) {
126 root_device_name = saved_root_name;
127 if (!strncmp(root_device_name, "mtd", 3)) {
128 Index: linux-2.6.23/init/main.c
129 ===================================================================
130 --- linux-2.6.23.orig/init/main.c 2007-10-25 21:35:50.567799083 +0200
131 +++ linux-2.6.23/init/main.c 2007-10-25 21:56:43.279187031 +0200
133 #ifdef CONFIG_X86_LOCAL_APIC
136 +#include "do_mounts.h"
139 * This is one of the first .c files built. Error out early if we have compiler
140 @@ -662,13 +663,14 @@
141 __setup("initcall_debug", initcall_debug_setup);
143 extern initcall_t __initcall_start[], __initcall_end[];
144 +extern initcall_t __root_initcall_start[], __root_initcall_end[];
146 -static void __init do_initcalls(void)
147 +static void __init do_initcalls(initcall_t *start, initcall_t *end)
150 int count = preempt_count();
152 - for (call = __initcall_start; call < __initcall_end; call++) {
153 + for (call = start; call < end; call++) {
154 ktime_t t0, t1, delta;
158 usermodehelper_init();
162 + do_initcalls(__initcall_start, __initcall_end);
165 static int __initdata nosoftlockup;
167 panic("No init found. Try passing init= option to kernel.");
170 +static unsigned int __initdata root_delay;
171 +static int __init root_delay_setup(char *str)
173 + root_delay = simple_strtoul(str, NULL, 0);
176 +__setup("rootdelay=", root_delay_setup);
178 static int __init kernel_init(void * unused)
183 if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
184 ramdisk_execute_command = NULL;
186 + printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
188 + ssleep(root_delay);
190 + /* wait for the known devices to complete their probing */
191 + while (driver_probe_done() != 0)
194 + do_initcalls(__root_initcall_start, __root_initcall_end);
199 Index: linux-2.6.23/arch/i386/kernel/vmlinux.lds.S
200 ===================================================================
201 --- linux-2.6.23.orig/arch/i386/kernel/vmlinux.lds.S 2007-10-26 00:07:08.465118962 +0200
202 +++ linux-2.6.23/arch/i386/kernel/vmlinux.lds.S 2007-10-26 00:10:15.259763782 +0200
207 + .root_initcall.init : AT(ADDR(.root_initcall.init) - LOAD_OFFSET) {
208 + __root_initcall_start = .;
210 + __root_initcall_end = .;
212 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
213 __con_initcall_start = .;
214 *(.con_initcall.init)
215 Index: linux-2.6.23/include/asm-generic/vmlinux.lds.h
216 ===================================================================
217 --- linux-2.6.23.orig/include/asm-generic/vmlinux.lds.h 2007-10-26 00:08:46.558708993 +0200
218 +++ linux-2.6.23/include/asm-generic/vmlinux.lds.h 2007-10-26 00:09:24.296859571 +0200
219 @@ -243,12 +243,14 @@
220 *(.initcall4s.init) \
222 *(.initcall5s.init) \
223 - *(.initcallrootfs.init) \
225 *(.initcall6s.init) \
229 +#define INITCALLS_ROOT \
230 + *(.initcallrootfs.init)
232 #define PERCPU(align) \
234 __per_cpu_start = .; \