initrd problem with m68k linux
Subsystems (2)
Dear all,
I know it is a little off-topic for this list, but maybe it is somewhat related to U-Boot. I really do not know at which stage I am making a mistake here.
I have a MCF54455 board running U-Boot and a slightly modified kernel from Freescale (linux 2.6.25). I can boot the system using initramfs by including the (initial) root fs into the kernel via CONFIG_INITRAMFS_SOURCE. CONFIG_SYS_BOOTMAPSZ is set to 64MB:
#define CONFIG_SYS_BOOTMAPSZ (CONFIG_SYS_SDRAM_BASE + (64 << 20))
Now I wanted to split the images and load the initrd as a seperate
image. So I made a cramfs image:/usr/sbin/mkcramfs rootfs rootfs.cramfs/usr/local/bin/mkimage -n 'Test Ramdisk Image' -A m68k -O linux -T ramdisk -C none -d rootfs.cramfs rootfs.img
Then I load both images via tftp:
-> tftp 0x42000000 192.168.1.100:rootfs.img [...]
-> tftp 0x44000000 192.168.1.100:uImage [...]
-> setenv bootargs "initrd=/dev/ram rw root=ram0" -> setenv initrd_high 0x44000000
-> bootm 0x44000000 0x42000000
## Booting kernel from Legacy Image at 44000000 ...
Image Name: Linux-2.6.25 Created: 2010-04-06 13:14:42 UTC Image Type: M68K Linux Kernel Image (gzip compressed) Data Size: 1318376 Bytes = 1.3 MB
Load Address: 40020000
Entry Point: 40020000
Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 42000000 ...
Image Name: Test Ramdisk Image Created: 2010-04-06 11:23:36 UTC Image Type: M68K Linux RAMDisk Image (uncompressed) Data Size: 6213632 Bytes = 5.9 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Loading Ramdisk to 43a13000, end 44000000 ... OK
Linux version 2.6.25 (router at labor2.local) (gcc version 4.3.3 (Sourcery G++ Lite
4.3-209) ) #46 Tue Apr 6 15:14:31 CEST 2010
starting up linux startmem 0x402f0000, endmem 0x48000000, size 125
MB
console [ttyS0] enabled
** availmem=0x402f2000 pa(am)=0x402f2000
** mstart=0x402f0000 mend=0x47ffe000
bpfn=0x20000 minpfn=0x20178 maxpfn=0x23fff
dma: phys base=0x402f2000 phys end=0x40ffffff virt base=0xef000000 mda=0xefffffff pa(mda)=0x40ffffff
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16312 Kernel command line: initrd=/dev/ram rw root=/dev/ram
[...]prepare_namespacerd_load_image
1, from = /initrd.image
List of all partitions:
0100 32767 ram0 (driver?) 0101 32767 ram1 (driver?) 0102 32767 ram2 (driver?) 0103 32767 ram3 (driver?) No filesystem could mount root, tried: ext3 ext2 cramfs minix msdos vfat romfs Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
As can be seen, I added some printks to see what is going on at all. rd_load_image() fails at
in_fd = sys_open(from, O_RDONLY, 0);
because "from" is set to "/initrd.image", which is not available. But where should it come from if there is no root fs yet?
Could anybody point me to where I should look for the mistake? Can it be a problem in my U-Boot configuration, or is it definitely a problem with the kernel [configuration]?
Thanks for any comments!
Regards,
Wolfgang
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
arch/m68k/coldfire/config.c +9 -0
@@ -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 );
arch/m68k/kernel/setup.c +13 -0
@@ -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,