MTD root filesystem

The MTD root filesystem is now installed by default in the 20030522 distribution snapshot (for the DragonEngine board), so you don't need to do anything to activate it. This page is for those using an older snapshot.

The upcomming 2.6 kernel will support only MTD block devices, so to prepare this release you might want to try MTD right now. You need to change some configurations options and the board Makefile. Then rebuild everything.

at boot time the log messages should be something like:

...
eth0: cs8900 rev J found at 0x8000040 
cs89x0 media RJ-45, IRQ 9, programmed I/O, MAC 01:80:b2:4e:47:72
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
uclinux[mtd]: RAM probe address=0x1078bc size=0x12b000
Creating 1 MTD partitions on "RAM":
0x00000000-0x0012b000 : "ROMfs"
uclinux[mtd]: set ROMfs to be root filesystem
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 2048 bind 2048)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
VFS: Mounted root (romfs filesystem) readonly.
Freeing unused kernel memory: 40k freed (0xe6000 - 0xef000)
...

Compilation options

Kernel Settings
Processor type and features
Kernel executes from RAM
MemoryTechnologie Device (MTD)
MemoryTechnologie Device (MTD) support Y
Memory partionning support Y
Command line partition table parsing Y
Direct char device access to MTD devices Y
Readonly block device access to MTD devices Y
RAM/ROM/Flash chip drivers
Support for RAM chips in bus mapping Y
Mapping drivers for chip access
Generic uClinux RAM/ROM filesystem support Y
Block devices
ROM disk memory block device (blkmem) N

Makefile change

edit the file uClinux-dist/vendors/Exys/de2/Makefile and do the following change:

replace the lines:

rom0,b,31,0    rom1,b,31,1        rom2,b,31,2      rom3,b,31,3 \
rom4,b,31,4    rom5,b,31,5        rom6,b,31,6      rom7,b,31,7 \
rom8,b,31,8    rom9,b,31,9 \

with the lines:

mtd0,c,90,0    mtd1,c,90,2        mtd2,c,90,4      mtd3,c,90,6 \
mtd4,c,90,8    mtd5,c,90,10       mtd6,c,90,12     mtd7,c,90,14 \
mtdblock0,b,31,0 mtdblock1,b,31,1 mtdblock2,b,31,2 mtdblock3,b,31,3 \
mtdblock4,b,31,4 mtdblock5,b,31,5 mtdblock6,b,31,6 mtdblock7,b,31,7 \

and the lines:

$(CROSS_COMPILE)objcopy -O binary --remove-section=.romvec \
                --remove-section=.text --remove-section=.ramvec \
                --remove-section=.bss --remove-section=.eram \
                $(ROOTDIR)/$(LINUXDIR)/linux $(IMAGEDIR)/linux.data
$(CROSS_COMPILE)objcopy -O binary --remove-section=.ramvec \
                --remove-section=.bss --remove-section=.data \
                --remove-section=.eram \
                --set-section-flags=.romvec=CONTENTS,ALLOC,LOAD,READONLY,CODE \
                $(ROOTDIR)/$(LINUXDIR)/linux $(IMAGEDIR)/linux.text
cat $(IMAGEDIR)/linux.text $(IMAGEDIR)/linux.data $(ROMFSIMG) > $(IMAGE)

with the lines:

$(CROSS_COMPILE)objcopy -O binary $(ROOTDIR)/$(LINUXDIR)/linux $(IMAGE)
cat $(ROMFSIMG) >> $(IMAGE)
sig