Hi lance and other guys: May I have you a question about attaching the romfs to the kernel image
Can I do that without blkmem(kernel 2.4)? Or do that without MTD(kernel 2.6)? I just check my kernel 2.4 config,the romfs is inside the image.ram with the blkmem enabled.after I removing the blkmem support,the Kernel got panic : Kernel command line: root=/dev/ram0 initrd=0x0c074540,146k keepini(I modified the default command line so that the kernel can load the romfs at the correct address) trd Calibrating delay loop... 35.84 BogoMIPS Memory: 8MB = 8MB total Memory: 7328KB available (543K code, 149K data, 36K init) Dentry cache hash table entries: 1024 (order: 1, 8192 bytes) Inode cache hash table entries: 512 (order: 0, 4096 bytes) Mount cache hash table entries: 512 (order: 0, 4096 bytes) Buffer cache hash table entries: 1024 (order: 0, 4096 bytes) Page-cache hash table entries: 2048 (order: 1, 8192 bytes) POSIX conformance testing by UNIFIX Linux NET4.0 for Linux 2.4 Based upon Swansea University Computer Society NET3.039 Starting kswapd Samsung S3C44B0X UART driver version 0.1 <[EMAIL PROTECTED]> ttyS0 (irq = 3) is a builtin Samsung S3C44B0X UART RAMDISK driver initialized: 16 RAM disks of 1024K size 1024 blocksize ******* VFS: test name = </dev/root> VFS: fs_name = <romfs> VFS: root name <01:00> ******* VFS: tried fs_name = <romfs> err= -22 case -EBUSY & EINVAL Kernel panic: 2VFS: Unable to mount root fs on 01:00 Thankļ¼ rui >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of ext >Lance Spaulding >Sent: Tuesday, May 08, 2007 12:19 AM >To: uClinux development list >Subject: Re: [uClinux-dev] add ROMfs in RAM at the end of >kernel (_ebss) > >Hi Shaunglin, > >I've attached the kernel config and the console log during >boot for one of the platforms where I use a ram-based rom >filesystem (an ARM Realview EB board with an mpcore tile in >this case). This should show you how to coniigure MTD to get >things working. Note that using a ram disk is unrelated to >placing a romfs filesystem in ram. > >Hope this helps, >Lance > > > >Shuanglin Wang wrote: >> Hi Lance, >> >> Thanks for your help. I tried both ways remove "root=/dev/ram0" and >> add "rootfstype=romfs". But I got exactly same error result: >> >> //------------------------------------ kernel log >> -------------------------------// >> >> RAMDISK driver initialized: 1 RAM disks of 1024K size 1024 blocksize >> uclinux[mtd]: RAM probe address=0xf2450 size=0x1e000 Creating 1 MTD >> partitions on "RAM": >> 0x00000000-0x0001e000 : "ROMfs" >> mtd: Giving out device 0 to ROMfs >> uclinux[mtd]: set ROMfs to be root filesystem >> VFS: Cannot open root device "<NULL>" or unknown-block(31,0) Please >> append a correct "root=" boot option Kernel panic - not >syncing: VFS: >> Unable to mount root fs on >> unknown-block(31,0) >> >> >//-------------------------------------------------------------------- >> ------------// >> >> >> Would you please help me clarify several questions: >> >> 1. What should "root=?" be, if I remove "root=/dev/ram0" from kernel >> command line? >> >> 2. If romfs is located in main memory, should the kernel include the >> ramdisk module? >> >> 3. ROOT_DEV is (31,0), set in uclinux.c, do you think that should be >> correct one for mounting funciton? >> >> 4. There are several global variables defined in uclinux.c, like >> uclinux_ram_mtdinfo, uclinux_ram_map and uclinux_romfs. They are >> initialized in uclinux.c, but I can't find where and how they have >> been used directly or indirectly in later mounting procedure. >> >> BTW, can you send me a kernel configure file you have? I guess i >> didn't config the kernel coreectly. >> >> Thanks, >> Shuanglin >> >> >> >> Lance Spaulding wrote: >> >>> Hi Shaunglin, >>> >>> Try removing the 'root=/dev/ram0' from your command line. You can >>> add 'rootfstype=romfs' if you want but it should work w/o it. >>> >>> Thanks, >>> Lance >>> >>> Shuanglin Wang wrote: >>> >>> >>>> Hi Lance, >>>> >>>> I'm doing similar things. I patched the kernel with your >code, but i >>>> got an kernel panic. The boot log is: >>>> >>>> >/------------------------------------------------------------------- >>>> --/ >>>> Kernel command line: root=/dev/ram0 >>>> ... >>>> io scheduler noop registered (default) >>>> atmel_usart.0: ttyS0 at MMIO 0xf800f000 (irq = 11) is a >ATMEL_SERIAL >>>> RAMDISK driver initialized: 1 RAM disks of 1024K size 1024 >blocksize >>>> uclinux[mtd]: RAM probe address=0xf02f0 size=0x1e000 >Creating 1 MTD >>>> partitions on "RAM": >>>> 0x00000000-0x0001e000 : "ROMfs" >>>> mtd: Giving out device 0 to ROMfs >>>> uclinux[mtd]: set ROMfs to be root filesystem Generic platform RAM >>>> MTD, (c) 2004 Simtec Electronics >>>> VFS: Can't find a romfs filesystem on dev ram0. >>>> No filesystem could mount root, tried: romfs Kernel panic - not >>>> syncing: VFS: Unable to mount root fs on >>>> unknown-block(1,0) >>>> >/------------------------------------------------------------------- >>>> --/ >>>> >>>> I made further test on it. And it seems it get an empty >super inode >>>> from romfs. >>>> >>>> Did I miss something in kernel configuration or kernel >command line? >>>> >>>> Thansk a lot. >>>> >>>> Shuanglin >>>> >>>> >>>> >>>> >>>> Lance Spaulding wrote: >>>> >>>> >>>>> Mickael Sergent wrote: >>>>> >>>>> >>>>> >>>>>> Hello, >>>>>> >>>>>> I'm trying to port uclinux 2.6.x on dev. board based on >>>>>> ARM946-E-S. (I use uClinux-dist 20070130) >>>>>> >>>>>> I would like to have kernel and ROMfs entirely in RAM >but it seems >>>>>> to be impossible on ARM architecture. >>>>>> >>>>>> On uclinux 2.4 version a switch >(CONFIG_RAM_ATTACHED_ROMFS) can be >>>>>> used to do this. >>>>>> >>>>>> Does an equivalent exist in 2.6 version ? >>>>>> >>>>>> >>>>>> I tried to use CONFIG_MTD_UCLINUX_EBSS (after having >defined _ebss >>>>>> symbol in the end of kernel) but it doesn't solve >problem (because >>>>>> RAM where is stored ROMfs is used by uclinux), so a patch is >>>>>> needed to reserve ROMfs memory >>>>>> >>>>>> Do you know another solution to put ROMfs at the end of kernel ? >>>>>> >>>>>> Thanks a lot ! >>>>>> >>>>>> Best regards, >>>>>> >>>>>> Mickael. >>>>>> >>>>>> >------------------------------------------------------------------ >>>>>> ------ >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> uClinux-dev mailing list >>>>>> [email protected] >>>>>> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev >>>>>> This message was resent by [email protected] To >unsubscribe >>>>>> see: >>>>>> http://mailman.uclinux.org/mailman/options/uclinux-dev >>>>>> >>>>>> >>>>> Hi Mickael, >>>>> >>>>> We use a ram based rom filesystem on our ARM products (including >>>>> ones using an arm946). I've attached a small patch of >the changes >>>>> I made to get this to work. Note that we use little-endian >>>>> exclusively so if you are using big-endian you will need >to change >>>>> the code slightly. >>>>> Thanks, >>>>> Lance >>>>> >>>>> >>>>> >------------------------------------------------------------------- >>>>> ----- >>>>> >>>>> >>>>> diff -Naur >>>>> uClinux-dist.orig/linux-2.6.x/arch/arm/kernel/head-common.S >>>>> uClinux-dist/linux-2.6.x/arch/arm/kernel/head-common.S >>>>> --- uClinux-dist.orig/linux-2.6.x/arch/arm/kernel/head-common.S >>>>> 2006-06-28 01:22:16.000000000 -0600 >>>>> +++ uClinux-dist/linux-2.6.x/arch/arm/kernel/head-common.S >>>>> 2007-04-18 17:57:48.000000000 -0600 @@ -10,7 +10,6 @@ >>>>> * published by the Free Software Foundation. >>>>> * >>>>> */ >>>>> - >>>>> .type __switch_data, %object >>>>> __switch_data: >>>>> .long __mmap_switched >>>>> @@ -41,7 +40,6 @@ >>>>> ldrne fp, [r4], #4 >>>>> strne fp, [r5], #4 >>>>> bne 1b >>>>> - >>>>> mov fp, #0 @ Clear BSS (and zero fp) >>>>> 1: cmp r6, r7 >>>>> strcc fp, [r6],#4 >>>>> @@ -215,3 +213,41 @@ >>>>> bl __lookup_machine_type >>>>> mov r0, r5 >>>>> ldmfd sp!, {r4 - r6, pc} >>>>> + >>>>> +#ifdef CONFIG_MTD_UCLINUX >>>>> + .type __relocate_romfs, %function >>>>> +__relocate_romfs: >>>>> + adr r4, romfsinfo >>>>> + ldmia r4!, {r6, r7} >>>>> + bic r6, r6, #0xc0000000 >>>>> + bic r7, r7, #0xc0000000 >>>>> + + /* move the ram based rom filesystem to its correct final >>>>> location... */ >>>>> + /* the value is stored >>>>> big-endian */ >>>>> + mov fp, #0 >>>>> + add r4,r6,#8 >>>>> + ldrb r4,[r4] >>>>> + orr fp, fp, r4, LSL #24 >>>>> + add r4,r6,#9 >>>>> + ldrb r4,[r4] >>>>> + orr fp, fp, r4, LSL #16 >>>>> + add r4,r6,#10 >>>>> + ldrb r4,[r4] >>>>> + orr fp, fp, r4, LSL #8 >>>>> + add r4,r6,#11 >>>>> + ldrb r4,[r4] >>>>> + orr fp, fp, r4, LSL #0 >>>>> + add r4, r6, fp >>>>> + add fp, r7, fp >>>>> + sub r6, r6, #4 >>>>> +1: ldr r5, [r4] >>>>> + str r5, [fp] >>>>> + sub r4, r4, #4 >>>>> + sub fp, fp, #4 >>>>> + cmp r4, r6 >>>>> + bne 1b >>>>> + mov pc, lr >>>>> +romfsinfo: >>>>> + .long __bss_start @ r6 >>>>> + .long _end @ r7 >>>>> +#endif >>>>> diff -Naur >>>>> uClinux-dist.orig/linux-2.6.x/arch/arm/kernel/head-nommu.S >>>>> uClinux-dist/linux-2.6.x/arch/arm/kernel/head-nommu.S >>>>> --- uClinux-dist.orig/linux-2.6.x/arch/arm/kernel/head-nommu.S >>>>> 2007-01-29 18:55:08.000000000 -0700 >>>>> +++ uClinux-dist/linux-2.6.x/arch/arm/kernel/head-nommu.S >>>>> 2007-04-19 08:25:58.000000000 -0600 @@ -16,7 +16,6 @@ >>>>> >>>>> #include <asm/assembler.h> >>>>> #include <asm/mach-types.h> >>>>> -#include <asm/procinfo.h> >>>>> #include <asm/ptrace.h> >>>>> #include <asm/asm-offsets.h> >>>>> #include <asm/thread_info.h> >>>>> @@ -41,6 +40,9 @@ >>>>> ldr r1, =machine_arch_type @ find the machine type >>>>> msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ >ensure svc mode >>>>> @ and irqs disabled >>>>> +#ifdef CONFIG_MTD_UCLINUX >>>>> + bl __relocate_romfs >>>>> +#endif #ifndef CONFIG_CPU_CP15 >>>>> ldr r9, =CONFIG_PROCESSOR_ID >>>>> #else >>>>> diff -Naur uClinux-dist.orig/linux-2.6.x/arch/arm/kernel/head.S >>>>> uClinux-dist/linux-2.6.x/arch/arm/kernel/head.S >>>>> --- uClinux-dist.orig/linux-2.6.x/arch/arm/kernel/head.S >>>>> 2006-11-29 19:03:00.000000000 -0700 >>>>> +++ uClinux-dist/linux-2.6.x/arch/arm/kernel/head.S 2007-04-19 >>>>> 08:27:23.000000000 -0600 >>>>> @@ -16,7 +16,6 @@ >>>>> >>>>> #include <asm/assembler.h> >>>>> #include <asm/domain.h> >>>>> -#include <asm/procinfo.h> >>>>> #include <asm/ptrace.h> >>>>> #include <asm/asm-offsets.h> >>>>> #include <asm/memory.h> >>>>> @@ -73,6 +72,9 @@ >>>>> msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ >ensure svc mode >>>>> @ and irqs disabled >>>>> mrc p15, 0, r9, c0, c0 @ get processor id >>>>> +#ifdef CONFIG_MTD_UCLINUX >>>>> + bl __relocate_romfs >>>>> +#endif bl __lookup_processor_type @ r5=procinfo >>>>> r9=cpuid >>>>> movs r10, r5 @ invalid processor (r5=0)? >>>>> beq __error_p @ yes, error 'p' >>>>> diff -Naur uClinux-dist.orig/linux-2.6.x/arch/arm/mm/init.c >>>>> uClinux-dist/linux-2.6.x/arch/arm/mm/init.c >>>>> --- uClinux-dist.orig/linux-2.6.x/arch/arm/mm/init.c 2006-11-29 >>>>> 19:03:01.000000000 -0700 >>>>> +++ uClinux-dist/linux-2.6.x/arch/arm/mm/init.c 2007-04-19 >>>>> 08:28:11.000000000 -0600 >>>>> @@ -99,6 +99,23 @@ >>>>> unsigned int start_pfn, bank, bootmap_pfn; >>>>> >>>>> start_pfn = PAGE_ALIGN(__pa(&_end)) >> PAGE_SHIFT; >>>>> +#ifdef CONFIG_MTD_UCLINUX >>>>> + { >>>>> + /* If using a romfs in ram, move the >>>>> bitmap */ >>>>> + extern char _ebss; >>>>> + unsigned char *p; >>>>> + unsigned romfslen; >>>>> + unsigned ressiz; >>>>> + p=(unsigned char *)&_ebss; >>>>> + romfslen=p[8]; >>>>> + romfslen=(romfslen<<8)+p[9]; >>>>> + romfslen=(romfslen<<8)+p[10]; >>>>> + romfslen=(romfslen<<8)+p[11]; >>>>> + ressiz=((unsigned)p+romfslen); >>>>> + start_pfn=PAGE_ALIGN(__pa(ressiz)) >> PAGE_SHIFT; >>>>> + } >>>>> + +#endif >>>>> bootmap_pfn = 0; >>>>> >>>>> for_each_nodebank(bank, mi, node) { diff -Naur >>>>> uClinux-dist.orig/linux-2.6.x/arch/arm/mm/mmu.c >>>>> uClinux-dist/linux-2.6.x/arch/arm/mm/mmu.c >>>>> --- uClinux-dist.orig/linux-2.6.x/arch/arm/mm/mmu.c 2006-11-29 >>>>> 16:28:08.000000000 -0700 >>>>> +++ uClinux-dist/linux-2.6.x/arch/arm/mm/mmu.c 2007-04-19 >>>>> 08:33:23.000000000 -0600 >>>>> @@ -601,6 +601,24 @@ >>>>> reserve_bootmem_node(pgdat, __pa(swapper_pg_dir), >>>>> PTRS_PER_PGD * sizeof(pgd_t)); >>>>> >>>>> +#ifdef CONFIG_MTD_UCLINUX >>>>> + { >>>>> + /* If using a romfs in ram reserve this >>>>> memory... */ >>>>> + extern char _ebss; >>>>> + unsigned char *p; >>>>> + unsigned romfslen; >>>>> + unsigned ressiz; >>>>> + p=(unsigned char *)&_ebss; >>>>> + romfslen=p[8]; >>>>> + romfslen=(romfslen<<8)+p[9]; >>>>> + romfslen=(romfslen<<8)+p[10]; >>>>> + romfslen=(romfslen<<8)+p[11]; >>>>> + ressiz=((unsigned)p+romfslen); >>>>> + ressiz=((ressiz+4095)&0xfffff000); /* align on page >>>>> boundary */ >>>>> + reserve_bootmem_node(pgdat, __pa(p), >(ressiz-(unsigned)p)); \ >>>>> + } >>>>> +#endif >>>>> + >>>>> /* >>>>> * Hmm... This should go elsewhere, but we really >really need to >>>>> * stop things allocating the low memory; ideally we need a >>>>> better diff -Naur >uClinux-dist.orig/linux-2.6.x/arch/arm/mm/nommu.c >>>>> uClinux-dist/linux-2.6.x/arch/arm/mm/nommu.c >>>>> --- uClinux-dist.orig/linux-2.6.x/arch/arm/mm/nommu.c >2006-12-12 >>>>> 07:16:47.000000000 -0700 >>>>> +++ uClinux-dist/linux-2.6.x/arch/arm/mm/nommu.c 2007-04-18 >>>>> 18:03:16.000000000 -0600 >>>>> @@ -6,11 +6,14 @@ >>>>> #include <linux/module.h> >>>>> #include <linux/mm.h> >>>>> #include <linux/pagemap.h> >>>>> +#include <linux/bootmem.h> >>>>> >>>>> #include <asm/cacheflush.h> >>>>> #include <asm/io.h> >>>>> #include <asm/page.h> >>>>> >>>>> +#include <asm/mach/arch.h> >>>>> + >>>>> #include "mm.h" >>>>> >>>>> extern void _stext, __data_start, _end; @@ -36,6 +39,24 @@ >>>>> * alloc_page breaks with error, although it is not >NULL, but "0." >>>>> */ >>>>> reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE); >>>>> + >>>>> +#ifdef CONFIG_MTD_UCLINUX >>>>> + { >>>>> + /* Lance: If using a romfs in ram reserve this >>>>> memory... */ >>>>> + extern char _ebss; >>>>> + unsigned char *p; >>>>> + unsigned romfslen; >>>>> + unsigned ressiz; >>>>> + p=(unsigned char *)&_ebss; >>>>> + romfslen=p[8]; >>>>> + romfslen=(romfslen<<8)+p[9]; >>>>> + romfslen=(romfslen<<8)+p[10]; >>>>> + romfslen=(romfslen<<8)+p[11]; >>>>> + ressiz=((unsigned)p+romfslen); >>>>> + ressiz=((ressiz+4095)&0xfffff000); /* align on page >>>>> boundary */ >>>>> + reserve_bootmem_node(pgdat, __pa(p), >(ressiz-(unsigned)p)); \ >>>>> + } >>>>> +#endif >>>>> } >>>>> >>>>> /* >>>>> diff -Naur >uClinux-dist.orig/linux-2.6.x/drivers/mtd/maps/uclinux.c >>>>> uClinux-dist/linux-2.6.x/drivers/mtd/maps/uclinux.c >>>>> --- uClinux-dist.orig/linux-2.6.x/drivers/mtd/maps/uclinux.c >>>>> 2006-10-11 01:07:52.000000000 -0600 >>>>> +++ uClinux-dist/linux-2.6.x/drivers/mtd/maps/uclinux.c > 2007-04-19 >>>>> 08:01:09.000000000 -0600 >>>>> @@ -23,6 +23,7 @@ >>>>> #include <asm/io.h> >>>>> >>>>> >/****************************************************************** >>>>> **********/ >>>>> >>>>> >>>>> +#define CONFIG_MTD_UCLINUX_EBSS /* Lance: this isn't defined in >>>>> +the >>>>> config system */ >>>>> >>>>> #ifdef CONFIG_MTD_UCLINUX_EBSS >>>>> #define MAP_TYPE "map_ram" >>>>> @@ -75,7 +76,7 @@ >>>>> unsigned long addr = (unsigned long) >CONFIG_MTD_UCLINUX_ADDRESS; >>>>> >>>>> mapp = &uclinux_map; >>>>> - mapp->phys = addr; >>>>> + mapp->phys = __pa(addr); /* Lance: changed to get real phys >>>>> addr */ >>>>> mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(addr + 8)))); >>>>> mapp->bankwidth = 4; >>>>> >>>>> >>>>> >>>>> >------------------------------------------------------------------- >>>>> ----- >>>>> >>>>> >>>>> _______________________________________________ >>>>> uClinux-dev mailing list >>>>> [email protected] >>>>> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev >>>>> This message was resent by [email protected] To unsubscribe >>>>> see: >>>>> http://mailman.uclinux.org/mailman/options/uclinux-dev >>>>> >>>>> >>>> _______________________________________________ >>>> uClinux-dev mailing list >>>> [email protected] >>>> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev >>>> This message was resent by [email protected] To unsubscribe >>>> see: >>>> http://mailman.uclinux.org/mailman/options/uclinux-dev >>>> >>>> >>> >>> _______________________________________________ >>> uClinux-dev mailing list >>> [email protected] >>> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev >>> This message was resent by [email protected] To unsubscribe >>> see: >>> http://mailman.uclinux.org/mailman/options/uclinux-dev >>> >>> >>> >>> >> _______________________________________________ >> uClinux-dev mailing list >> [email protected] >> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev >> This message was resent by [email protected] To >unsubscribe see: >> http://mailman.uclinux.org/mailman/options/uclinux-dev >> > > _______________________________________________ uClinux-dev mailing list [email protected] http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by [email protected] To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev
