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
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
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
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev