mounting a mtd or a mtblock??

Gianluca gianlucarenzi at eptar.com
Mon May 16 07:29:17 EDT 2005


Hello list!
I have a little problem on using MTD flash device on my embedded-linux system.
My system is a LogicPD LH7A404-11 Sharp ARM9 with kernel 2.6.10 with 
IntelStrataFlash 2x16bit chips addressable at 32bits.
In flash at address from 0x0000 to 0x40000 I have the bootloader (BLOB) and 
from 0x40000 to 0x80000 the bootloader/kernel commandline parameters.
From 0x80000 to 0x200000 I have the compressed zImage of kernel.
From 0x200000 to the end all space is available for user.

I am booting from Compact Flash in read-only mode and create /var /tmp in 
tmpfs in RAM.
I would like to have some files stored and modified, let's say 5/6 times every 
minute and I am worried about power loss.
So I was thinking about jffs2.

<KERNEL LOGS>
Probing "LPD7A40x-10 Flash" at physical address 0x00000000
LPD7A40x-10 Flash: Found 1 x32 devices at 0x0 in 32-bit bank
 Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
Using static partitions on "LPD7A40x-10 Flash"
Creating 4 MTD partitions on "LPD7A40x-10 Flash":
0x00000000-0x00040000 : "BLOB boot loader"
0x00040000-0x00080000 : "BLOB parameters"
0x00080000-0x00200000 : "kernel"
0x00200000-0x00800000 : "user"
</KERNEL LOGS>

Here is the /proc information:

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "BLOB boot loader"
mtd1: 00040000 00020000 "BLOB parameters"
mtd2: 00180000 00020000 "kernel"
mtd3: 00600000 00020000 "user"
# cat /proc/partitions
major minor  #blocks  name

   3     0     125440 hda
   3     1     125333 hda1
  31     0        256 mtdblock0
  31     1        256 mtdblock1
  31     2       1536 mtdblock2
  31     3       6144 mtdblock3
#

What are the correct steps to mount a rw partition in this system?

I know I have to do:

# flash_eraseall -j /dev/mtd[n]
Erasing 128 Kibyte @ xxxxxx -- pp% complete. Cleanmarker written at xxxxxx

and it ends with no error at all.

As I can see 128KiB is the flash erase size. It's wrong! My system is composed 
of 2 Chips 16bit for a total of 32bit!! So the flash erasesize must be 
*DOUBLED*. How to correct this behaviour? Beside, the mount command:

# mount -t jffs2 /dev/mtdblock[n] /mnt/internal-flashdisk

is a piece of code unknown to me.
Why erasing mtd[n] with flash_eraseall command and mounting mtdblock[n] with 
mount comand?
Why not erasing mtdblock[n] and mount mtdblock[n] as mount command uses only 
BLOCK devices? Is this not completely *TRUE*??

Anyway if I try to launch those commands, here is what system gives to me:

[ a very long log...]
...
Empty flash at 0x003de780 ends at 0x003de784
Empty flash at 0x003dfd3c ends at 0x003dfd40
jffs2_scan_eraseblock(): Node at 0x003e0000 {0x1985, 0x4e76, 0x7ecf000c) has 
invalid CRC 0x59a7b0b1 (calculated 0xa3ed5d51)
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x003e0004: 0x000c 
instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x003e0008: 0xb0b1 
instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x003e000c: 0xffff 
instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x003e0010: 0xffff 
instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x003e0014: 0xffff 
instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x003e0018: 0xffff 
instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x003e001c: 0xffff 
instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x003e0020: 0xffff 
instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x003e0024: 0xffff 
instead
Further such events for this erase block will not be printed
Empty flash at 0x003e102c ends at 0x003e1030
Empty flash at 0x003e22b8 ends at 0x003e22bc
[...]
Empty flash at 0x003ffcf4 ends at 0x003ffcf8
jffs2_scan_eraseblock(): Node at 0x00420000 {0x1985, 0xffff, 0xffff000c) has 
invalid CRC 0xffffb0b1 (calculated 0x33cd93a4)
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00420004: 0x000c 
instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00420008: 0xb0b1 
instead
[...]

then it returns to prompt with this message:

Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes
empty_blocks 8, bad_blocks 0, c->nr_blocks 48
mount: /dev/mtdblock3: can't read superblock

Any Help?? Any Clue?


best regards,
-- 
Gianluca Renzi
Eptar s.r.l.
Via Celletta 8/B
40026 Imola (BO) ITALY
Tel.:	+39-0542-609060
Fax.:	+39-0542-609054




More information about the linux-mtd mailing list