1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-15 19:58:27 +02:00
openwrt-xburst/target/linux/olpc/patches-2.6.26/300-block2mtd_init.patch
lars 133e403410 Update olpc target kernel to 2.26.5.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12740 3c298f89-4303-0410-b956-a3cf2f4a3e73
2008-09-27 17:09:35 +00:00

214 lines
6.1 KiB
Diff

diff -urN linux-2.6.26.orig/arch/x86/kernel/vmlinux_32.lds.S linux-2.6.26/arch/x86/kernel/vmlinux_32.lds.S
--- linux-2.6.26.orig/arch/x86/kernel/vmlinux_32.lds.S 2008-08-13 03:51:12.000000000 +0200
+++ linux-2.6.26/arch/x86/kernel/vmlinux_32.lds.S 2008-08-13 04:08:18.000000000 +0200
@@ -144,6 +144,12 @@
INITCALLS
__initcall_end = .;
}
+ .root_initcall.init : AT(ADDR(.root_initcall.init) - LOAD_OFFSET) {
+ __root_initcall_start = .;
+ INITCALLS_ROOT
+ __root_initcall_end = .;
+ }
+
.con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
__con_initcall_start = .;
*(.con_initcall.init)
diff -urN linux-2.6.26.orig/drivers/mtd/devices/block2mtd.c linux-2.6.26/drivers/mtd/devices/block2mtd.c
--- linux-2.6.26.orig/drivers/mtd/devices/block2mtd.c 2008-08-13 03:51:05.000000000 +0200
+++ linux-2.6.26/drivers/mtd/devices/block2mtd.c 2008-08-13 04:06:43.000000000 +0200
@@ -20,6 +20,8 @@
#include <linux/buffer_head.h>
#include <linux/mutex.h>
#include <linux/mount.h>
+#include <linux/list.h>
+#include <linux/delay.h>
#define VERSION "$Revision: 1.30 $"
@@ -27,6 +29,12 @@
#define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
#define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args)
+struct retry {
+ struct list_head list;
+ const char *val;
+};
+
+static LIST_HEAD(retry_list);
/* Info for the block device */
struct block2mtd_dev {
@@ -38,10 +46,34 @@
char devname[0];
};
+static int block2mtd_setup2(const char *val);
/* Static info about the MTD, used in cleanup_module */
static LIST_HEAD(blkmtd_device_list);
+static int add_retry(const char *val) {
+ struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL);
+
+ INIT_LIST_HEAD(&r->list);
+ r->val = val;
+ list_add(&r->list, &retry_list);
+
+ return 0;
+}
+
+static int __init process_retries(void) {
+ struct list_head *p, *tmp;
+
+ list_for_each_safe(p, tmp, &retry_list) {
+ struct retry *r = list_entry(p, struct retry, list);
+ block2mtd_setup2(r->val);
+ msleep(100);
+ list_del(p);
+ kfree(r);
+ }
+ return 0;
+}
+rootfs_initcall(process_retries);
static struct page *page_read(struct address_space *mapping, int index)
{
@@ -517,7 +549,9 @@
if (token[2] && (strlen(token[2]) + 1 > 80))
parse_err("mtd device name too long");
- add_device(name, erase_size, token[2]);
+ if (add_device(name, erase_size, token[2]) == NULL) {
+ add_retry(val);
+ }
return 0;
}
diff -urN linux-2.6.26.orig/include/asm-generic/vmlinux.lds.h linux-2.6.26/include/asm-generic/vmlinux.lds.h
--- linux-2.6.26.orig/include/asm-generic/vmlinux.lds.h 2008-08-13 03:51:08.000000000 +0200
+++ linux-2.6.26/include/asm-generic/vmlinux.lds.h 2008-08-13 04:09:04.000000000 +0200
@@ -338,12 +338,14 @@
*(.initcall4s.init) \
*(.initcall5.init) \
*(.initcall5s.init) \
- *(.initcallrootfs.init) \
*(.initcall6.init) \
*(.initcall6s.init) \
*(.initcall7.init) \
*(.initcall7s.init)
+#define INITCALLS_ROOT \
+ *(.initcallrootfs.init)
+
#define PERCPU(align) \
. = ALIGN(align); \
__per_cpu_start = .; \
diff -urN linux-2.6.26.orig/init/do_mounts.c linux-2.6.26/init/do_mounts.c
--- linux-2.6.26.orig/init/do_mounts.c 2008-08-13 03:51:11.000000000 +0200
+++ linux-2.6.26/init/do_mounts.c 2008-08-13 04:00:22.000000000 +0200
@@ -173,16 +173,8 @@
return 1;
}
-static unsigned int __initdata root_delay;
-static int __init root_delay_setup(char *str)
-{
- root_delay = simple_strtoul(str, NULL, 0);
- return 1;
-}
-
__setup("rootflags=", root_data_setup);
__setup("rootfstype=", fs_names_setup);
-__setup("rootdelay=", root_delay_setup);
static void __init get_fs_names(char *page)
{
@@ -358,18 +350,6 @@
{
int is_floppy;
- if (root_delay) {
- printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
- root_delay);
- ssleep(root_delay);
- }
-
- /* wait for the known devices to complete their probing */
- while (driver_probe_done() != 0)
- msleep(100);
-
- md_run_setup();
-
if (saved_root_name[0]) {
root_device_name = saved_root_name;
if (!strncmp(root_device_name, "mtd", 3)) {
diff -urN linux-2.6.26.orig/init/main.c linux-2.6.26/init/main.c
--- linux-2.6.26.orig/init/main.c 2008-08-13 03:51:11.000000000 +0200
+++ linux-2.6.26/init/main.c 2008-08-13 04:06:01.000000000 +0200
@@ -70,6 +70,7 @@
#ifdef CONFIG_X86_LOCAL_APIC
#include <asm/smp.h>
#endif
+#include "do_mounts.h"
/*
* This is one of the first .c files built. Error out early if we have compiler
@@ -737,12 +738,13 @@
extern initcall_t __initcall_start[], __initcall_end[];
+extern initcall_t __root_initcall_start[], __root_initcall_end[];
-static void __init do_initcalls(void)
+static void __init do_initcalls(initcall_t *start, initcall_t *end)
{
initcall_t *call;
- for (call = __initcall_start; call < __initcall_end; call++)
+ for (call = start; call < end; call++)
do_one_initcall(*call);
/* Make sure there is no pending stuff from the initcall sequence */
@@ -763,7 +765,7 @@
usermodehelper_init();
driver_init();
init_irq_proc();
- do_initcalls();
+ do_initcalls(__initcall_start, __initcall_end);
}
static int __initdata nosoftlockup;
@@ -835,6 +837,13 @@
panic("No init found. Try passing init= option to kernel.");
}
+static unsigned int __initdata root_delay;
+static int __init root_delay_setup(char *str)
+{
+ root_delay = simple_strtoul(str, NULL, 0);
+ return 1;
+}
+__setup("rootdelay=", root_delay_setup);
static int __init kernel_init(void * unused)
{
lock_kernel();
@@ -875,7 +884,16 @@
if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
ramdisk_execute_command = NULL;
- prepare_namespace();
+ if (root_delay) {
+ printk(KERN_INFO "Waiting %desc before mounting root device...\n",
+ root_delay);
+ ssleep(root_delay);
+ }
+ while (driver_probe_done() != 0)
+ msleep(100);
+ md_run_setup();
+ do_initcalls(__root_initcall_start, __root_initcall_end);
+ prepare_namespace();
}
/*