Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12748 Discussions

Linux - Change the location of a linux fs in flash

Altera_Forum
Contributeur émérite II
1 657 Visites

Hello, does anybody know how to change the location of the linux romfs in flash. I have a small custom board with only 1 MByte flash "available" and therefor i'm currently running my kernel directly from SDRAM (just while i'm testing). How do I change the location of the romfs to begin from addr. 0x0 (in flash) instead of 0x200000??? 

 

I&#39;ve modified the location_on_target in <filesystem>.stf to the following: 

 

<location_on_target offset=&#39;0x0&#39;> 

 

then i&#39;ve modified the following lines in asm-offsets.c: 

 

from: 

DEFINE(KERNEL_FLASH_START, na_flash_kernel); 

 

to: 

DEFINE(KERNEL_FLASH_START, na_flash_kernel+0x200000); 

 

 

from: 

DEFINE(LINUX_ROMFS_START, na_flash_kernel+0x200000); 

 

to: 

DEFINE(LINUX_ROMFS_START, na_flash_kernel+0x0); 

 

 

from: 

DEFINE(LINUX_ROMFS_END, na_flash_kernel_end); 

 

to: 

DEFINE(LINUX_ROMFS_END, na_flash_kernel+0x200000); 

 

but still I get the following kernel panic error: 

 

Using deadline io scheduler microtronix: RAM probe address=0x200000 size=0x4005000 Creating 1 MTD partitions on "RAM": 0x00000000-0x04005000 : "ROMfs" microtronix: set ROMfs to be root filesystem Kernel panic: VFS: Unable to mount root fs on mtdblock0 

 

I guess it&#39;s got something to do with the very large address 0x04005000 but where it comes from I do not know......weird! 

 

The custom board contains: 16Mbit flash (<-unfortunately on the test-board i&#39;m working with the highest address pin from the flash are NOT connected to the Nios II - processor, so for now i&#39;m just running it as a 1MByte flash)/2MByte SDRAM/Cyclone EP1C6/LAN91C113 (<-the same as LAN91C111, but it only operates in 16bit mode) 

 

Hope you can help me! 

 

Regards  

 

Goon
0 Compliments
3 Réponses
Altera_Forum
Contributeur émérite II
635 Visites

Hi Goon, 

 

The mtd map for romfs is defined in drivers/mtd/maps/microtronix.c. It is actually hardcoded there (it would be nicer to use the symbol LINUX_ROMFS_START you modified, but unfortunately it is left out). 

 

The size of the romfs is read from the romfs image on the fly, it is the third word of the romfs image. 

 

Regards, 

wentao
0 Compliments
Altera_Forum
Contributeur émérite II
635 Visites

Hi, wentao. 

Thank you very much. It was just the piece of information I needed to make it work. 

....of course I had to comment out a couple of lines from the microtronix.c file because ioremap_nocache returned 0x0 (NULL), which further on in the file was interpreted as an error. Silly me, I should just have placed my file system at a location different from 0x0 - but it works yeehaa :-) 

 

Regards  

 

Goon
0 Compliments
Altera_Forum
Contributeur émérite II
635 Visites

Hi Goon, 

 

I think commenting them out is the right solution under uClinux. Glad to hear you made it work. 

 

regards, 

wentao
0 Compliments
Répondre