[U-Boot] [OT] initrd problem with m68k linux

Wolfgang Wegner
2010-04-07T11:30:55Z

Hi,

I found the problem: the linux kernel 2.6.25 from the freescale LTIB
is missing support for initrd via U-Boot.

With the patch below I was able to use an initramfs from a seperate
image, I suppose initrd should work, too. It is a quick hack, but it
works for me and I wanted to give the solution after having asked
here.

Regards,
Wolfgang

diff -ur linux-2.6.25_orig_for_diff/arch/m68k/coldfire/config.c linux-2.6.25/arch/m68k/coldfire/config.c
--- linux-2.6.25_orig_for_diff/arch/m68k/coldfire/config.c 2010-01-25 17:27:29.000000000 +0100
+++ linux-2.6.25/arch/m68k/coldfire/config.c 2010-04-07 11:53:56.000000000 +0200
@@ -33,6 +33,7 @@
#include <asm/movs.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
+#include <linux/initrd.h>

#include <asm/mcfsim.h>

@@ -128,6 +129,14 @@
uboot_info.cmd_line_start = (*(u32 *)(uboot_info_stk+12)) + offset;
uboot_info.cmd_line_stop = (*(u32 *)(uboot_info_stk+16)) + offset;

+ if(uboot_info.initrd_start && uboot_info.initrd_end &&
+ (uboot_info.initrd_end > uboot_info.initrd_start)) {
+ initrd_start = uboot_info.initrd_start;
+ initrd_end = uboot_info.initrd_end;
+ printk(KERN_INFO "initrd at 0x%lx:0x%lx\n",
+ initrd_start, initrd_end);
+ }
+
/* copy over mac addresses */
memcpy(uboot_enet0, uboot_info.bdi->bi_enet0addr, 6);
memcpy(uboot_enet1, uboot_info.bdi->bi_enet1addr, 6);
diff -ur linux-2.6.25_orig_for_diff/arch/m68k/kernel/setup.c linux-2.6.25/arch/m68k/kernel/setup.c
--- linux-2.6.25_orig_for_diff/arch/m68k/kernel/setup.c 2010-01-25 17:27:29.000000000 +0100
+++ linux-2.6.25/arch/m68k/kernel/setup.c 2010-04-07 11:53:30.000000000 +0200
@@ -341,6 +341,19 @@

paging_init();

+#if defined(CONFIG_COLDFIRE)
+ if (initrd_start && initrd_end &&
+ (initrd_end > initrd_start)) {
+ unsigned long initrd_size = initrd_end - initrd_start;
+ reserve_bootmem_node(__virt_to_node(phys_to_virt(initrd_start)),
+ initrd_start, initrd_size,
+ BOOTMEM_DEFAULT);
+ initrd_start = (unsigned long)phys_to_virt(initrd_start);
+ initrd_end = initrd_start + initrd_size;
+ printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
+ }
+#endif
+
#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
for (i = 1; i < m68k_num_memory; i++)
free_bootmem_node(NODE_DATA(i), m68k_memory[i].addr,