Chinaunix

标题: 关于挂载jffs2 fs 的问题。 [打印本页]

作者: wz1988001    时间: 2010-05-09 00:41
标题: 关于挂载jffs2 fs 的问题。
本帖最后由 wz1988001 于 2010-05-09 10:52 编辑

您好,我想在我的  /dev/mtd0 下挂载 jffs2 文件系统。
现在我的开发板的启动信息如下:

/*************************** 5-9  *****************************/
Auto detecting flash ...ok!!!
Protected 2 sectors
Flash: 2 MB
                                                                                
                                                                                
ARMboot 2.0.0 (Dec 14 2006 - 16:42:48 - Author:Winn Mobile:130.9442.4880)
                                                                                
ARMboot code: 00380000 -> 00390df8
DRAM Configuration:
Bank #0: 00000000 7 MB
*** Using default environment
Initializing switch...done
Hit any key to stop autoboot:  0
Copy 0xfff00000 to ram(0x00700000) ... done.
## Starting application at 0x00700000 ...
Uncompressing Linux................................. done, booting the kernel.
Uncompressing application ..................................done.
Author: YanHua (139.8040.2130 yan.hua@263.net).
Processor: ARM Arm946id(wb) revision 1
Architecture: MV88E62x8
On node 0 totalpages: 3542
zone(0): 0 pages.
zone(1): 3542 pages.
BUG: wrong zone alignment, it will crash
zone(2): 0 pages.
Kernel command line: console=ttyS0,38400 root=/dev/rom0
Calibrating delay loop... 73.11 BogoMIPS
Memory: 13MB = 13MB total
Memory: 12884KB available (870K code, 209K data, 40K init)
Dentry cache hash table entries: 2048 (order: 2, 16384 bytes)
Inode cache hash table entries: 1024 (order: 1, 8192 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: 4096 (order: 2, 16384 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB.
Serial driver version 5.05c (2001-07-0 with no serial options enabled
ttyS00 at 0x8000c840 (irq = 11) is a 16550A
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk images:
0: E00000-EF1FFF [VIRTUAL E00000-EF1FFF] (RO)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
firefox flash device: 200000 at ffe00000
Amd/Fujitsu Extended Query Table v1.0 at 0x0040
number of CFI chips: 1
Creating 3 MTD partitions on "FIREFOX flash device":
0x00000000-0x00020000 : "user partition 1 (128KB)"
mtd: Giving out device 0 to user partition 1 (128KB)
0x00020000-0x00100000 : "user partition 2 (896KB)"
mtd: Giving out device 1 to user partition 2 (896KB)
0x00100000-0x00200000 : "kernel and armboot partition (1024KB)"
mtd: Giving out device 2 to kernel and armboot partition (1024KB)
init_mtdchar: allocated major number 90.
init_mtdblock: allocated major number 31.
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 512 bind 512)
ip_tables: (C) 2000-2002 Netfilter core team
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 40K
Shell invoked to run file: /etc/rc
Using /lib/modules/2.4.19-uc1/kernel/fs/ext2/ext2.o
Using /lib/modules/unimac.o
User's Net Config:
        VLAN 1 (LAN):
                MAC address = 00:00:19:19:21:22
                Port Set = { 1, 2, 3, 4, 5 }
        VLAN 2 (WAN):
                MAC address = 00:00:20:20:21:23
                Port Set = { 0, 5 }
QD initiated
Switch Information:
        Device Name      = 88E6218 (Firefox-HG)
        Revision         = 2
        Device Number    = 0
        Device Enabled   = Yes
        Base Reg Address = 0
        Number of Ports  = 7
        CPU Port         = 5
                                                                                
Init: User network configuration initialized
Execution Finished, Exiting
Execution Finished, Exiting
                                                                                
Sash command shell (version 1.1.1)
/>




挂载时的情况如下:
/> mount -t jffs2 /dev/mtdblock0 /mnt
mount: Mounting /dev/mtdblock0 on /mnt failed: Device or resource busy


/> cat /proc/mtd  (这里也很奇怪,为什么erasesize 会不一至)
dev:    size   erasesize  name
mtd0: 00020000 00010000 "user partition 1 (128KB)"
mtd1: 000e0000 00020000 "user partition 2 (896KB)"
mtd2: 00100000 00020000 "kernel and armboot partition (1024KB)"


照我的分区mtd0应该是 128kb的,怎么erase的时候会是  65536???
/> erase /dev/mtd0
MTD_open
Erase Total 1 UnMTD_ioctl
its
MTD_ioctl
Erase Unit Size MTD_ioctl
Performing Flash Erase of length 65536 at offset 0x0waiting for erase to comple.MTD Erase fail<6>MTD_close
ure: Input/output error
/>

求达人相助!!!万分感谢。
作者: wz1988001    时间: 2010-05-10 18:10
这个问题我好像解决了。之前用BLKMEM_MAJOR 30  而MTD_BLOCK_MAJOR 31出现了这个问题。现在改成前者31而后者30 就没有这个mount: Mounting /dev/mtdblock0 on /mnt failed: Device or resource busy问题了。
而/
> cat /proc/mtd  (这里也很奇怪,为什么erasesize 会不一至)
dev:    size   erasesize  name
mtd0: 00020000 00010000 "user partition 1 (128KB)"
mtd1: 000e0000 00020000 "user partition 2 (896KB)"
mtd2: 00100000 00020000 "kernel and armboot partition (1024KB)"
这个问题还是存在。


关于第三个问题:
照我的分区mtd0应该是 128kb的,怎么erase的时候会是  65536???
/> erase /dev/mtd0
MTD_open
Erase Total 1 UnMTD_ioctl
its
MTD_ioctl
Erase Unit Size MTD_ioctl
Performing Flash Erase of length 65536 at offset 0x0waiting for erase to comple.MTD Erase fail<6>MTD_close
ure: Input/output error
/>

在网上搜了一下。
mtd0/mtdblock0 refers to whole flash
mtd1/mtdblock1 refers to first partition,
mtd2/mtdblock2 refers to second partition
后来我试了一下擦 mtdblock1   就是128KB没问题了。


不过现在
/> cd tmp
/var/tmp> ls
/var/tmp> mkdir jffs2
/var/tmp> cd jffs2
/var/tmp/jffs2> mkdir haha
/var/tmp/jffs2> ls
haha
/var/tmp/jffs2> cd ..
/var/tmp> ls
jffs2
/var/tmp> mkfs.jffs2 -d /var/tmp/jffs2 -o /var/tmp/jffs2.img --pad=0x20000 -n
/var/tmp> ls
jffs2
/var/tmp>
我在建立这个印象文件时怎么都不成功。。。也不报错。就是得不到这个印象文件。
网上有一种说法说是,不需要印象文件也行,只要直接挂载就可以。我试了一下:
/mnt> mount -t jffs2 /dev/mtdblock1 /mnt/
mtdblock_open
ok
jffs2_scan_empty(): Empty block at 0x0000017c ends at 0x00010000 (with 0x2003198
5)! Marking dirty
CLEANMARKER node found at 0x00010000, not first node in block (0x00000000)
/mnt> ls
/mnt> ls
/mnt> ls
/mnt> Last[3] is ffff, datum is 1985
Write clean marker to block at 0x000a0000 failed: -5
Last[3] is ffff, datum is 1985
Write clean marker to block at 0x00080000 failed: -5

/mnt>
/mnt> mkdir xx
mkdir: Cannot create directory `xx': Read-only file system
/mnt> cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / romfs ro 0 0
/proc /proc proc rw 0 0
/dev/ram0 /var ext2 rw 0 0
/dev/ram1 /etc ext2 rw 0 0
/dev/mtdblock1 /mnt jffs2 rw 0 0
/mnt>

在挂载信息里显示的是 rw 可读写的。可实际用起来是只读的。这是为什么呢???




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2