Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1038814
  • 博文数量: 244
  • 博客积分: 6820
  • 博客等级: 准将
  • 技术积分: 3020
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-09 21:33
文章分类

全部博文(244)

文章存档

2013年(1)

2012年(16)

2011年(132)

2010年(3)

2009年(12)

2008年(80)

我的朋友

分类: LINUX

2011-04-15 17:26:50

文件: zlib-1.2.3.tar.gz
大小: 484KB
下载: 下载
文件: mtd-snapshot-20050519.tar.bz2
大小: 1227KB
下载: 下载
制作mtd-util工具:
从网上下载zlib-1.2.3.tar.gz
  

   zlib-1.2.3.tar.gz下载  
  需要先登录

从网上下载 mtd-snapshot-20050519.tar.bz2

下可以下载到 jffs2的源代码
MTD TOOLS生成成功!
http://blog.csdn.net/hongjiujing/archive/2007/09/21/1794530.aspx
有关jffs2文件系统的问题

在pc端制作文件系统,通过uboot烧写到开发板,可参考:
在nand flash上实现JFFS2根文件文件系统
http://www.mcuol.com/Tech/216/28699.htm
 
基本操作摘抄如下:
1.下载MTD工具包
farsight#tar –jxvf mtd-snapshot-20050519.tar.bz2
farsight#cd mtd
farsight#./configure  解压后没有该文件,不知作者怎么做此操作??
farsight#make
farsight#make install

如果系统中没有安装ZLIB库,那么首先安装ZLIB库。具体的安装过程如下:
farsight#tar –zxvf zlib-1.2.3.tar.gz
farsight#cd zlib-1.2.3
farsight#./configure
farsight#make
farsight#make install
完成此步骤后,系统中就有了mkfs.jffs2的工具。
2、制作JFFS2文件镜像
farsight#mkfs.jffs2 -r /source/rootfs -o rootfs.jffs2 -e 0x4000 --pad=0x800000 -n
这样就会生成一个8M大小的rootfs.jffs2的镜像,它也正是JFFS2文件系统的镜像,关于这个命令行里的选项的内容,可以用man a mkfs.jffs2命令来查看内容。

3、设置内核启动参数
   本处用的bootloader是U-BOOT.所以在U-BOOT的命令终端设置如下:
   FS2410#setenv bootargs root=/dev/mtdblock/2 rootfstype=jffs2 rw console=ttySAC0,115200 init=/linuxrc mem=64M

4、配置内核支持JFFS2文件系统
File systems ---> Miscellaneous filesystems --->
  <*>JournallingFlash File System v2 (JFFS2) support
     [*]JFFS2write-bufferingsupport
     [*]AdvancedcompressionoptionsforJFFS2
     [*]JFFS2ZLIBcompressionsupport
     [*]JFFS2RTIMEcompressionsuppor
     [*] JFFS2 RUBIN compression support
 5、下载rootfs.jffs2镜像
   下载到Nand Flash第二个分区。
   FS2410#nand erase 200000 800000
   FS2410#nand write.jffs2 300008000 200000 800000


通过nfs启动后,在开发板上烧写jffs2文件系统可参考:
如何制作和使用Jffs2文件系统
http://blog.csdn.net/hongjiujing/archive/2007/09/21/1794480.aspx
如何制作和使用jffs2文件系统(转)
http://blog.chinaunix.net/u1/43093/showart_343469.htmlhttp://blog.chinaunix.net/u1/43093/showart_343
主要步骤
用arm-linux-gcc编译:zlib-1.2.3.tar.gz, mtd-snapshot-20050519.tar.bz2 最后生成在开发板上可以使用的flash_erase,flash_eraseall, mkfs.jffs2工具放在ramdisk 文件系统中,同时复制用到的库文件libz.so, libz.so.1, libz.so.1.2.3;
   擦除nandflash
   # flash_erase /dev/mtd1
   制作jffs2映像
   # cd /var/tmp
   # mkdir jffs2 (jffs2下的目录可以任意建)
   # mkfs.jffs2 –d jffs2/ -o jffs2.img
   # cp /var/tmp/jffs2/jffs2.img /dev/mtdblock1
   最后# mount -t jffs2 /dev/mtdblock1 /mnt/mtd即可。
 
   如果只是当作普通的jffs2 来使用dataflash或者nandflash,可不必制作 jffs2映像,只需要最后一步
   # mount -t jffs2 /dev/mtdblock1 /mnt/mtd即可。
 
 
其他内容可参考:
嵌入式Linux下JFFS2文件系统的实现

基于s3c2440 yaffs2 文件系统的移植
http://q.163.com/kjava/blog/www_yin/362652432008269461663/#362652432008269461663
 

实现过程中遇到的ECC的问题:
1.把make menuconfig中的
Device Drivers --->
Memory Technology Devices (MTD) --->
NAND Flash Kevice Drivers--->
  [*] S3C2410 NAND Hardware ECC
选中后,系统不能正常启动
 
2.要把  drivers/mtd/nand/s3c2410.c 的ecc校验:
chip->eccmod = NAND_ECC_SOFT改为:
chip->eccmod = NAND_ECC_NONE
则每次启动时提示:
Reading data from NAND FLASH without ECC is not recommended
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e154: 0xfbeb instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e154: 0xfbeb instead
Further such events for this erase block will not be printed
Empty flash at 0x0050e280 ends at 0x0050e284
Empty flash at 0x0050e2d4 ends at 0x0050e2d8
Reading data from NAND FLASH without ECC is not recommended
VFS:Mounted root (jffs2 filesystem).
Mounted devfs on /dev
Freeing init memory:92K
Reading data from NAND FLASH without ECC is not recommended
Reading data from NAND FLASH without ECC is not recommended
starting pid 17,tty '': '/etc/init.d/rcS'
Cannot run '/etc/init.d/rcS': No such file or directory
Reading data from NAND FLASH without ECC is not recommended
jffs2_get_inode_nodes(): Data CRC failed on node at 0x0068d888: Read 0xf0b01ebl, calculated 0xfd24ef86
jffs2_get_inode_nodes(): Data CRC failed on node at 0x0050f2c4: Read 0x18e8b547, calculated 0xcdd71ab0
jffs2_get_inode_nodes(): CRC failed on node at 0x0068e9d4: Read 0xffffffff, calculated 0xb4c178b1
starting pid 18, Reding data from NAND FLASH without ECC is not recommended
tty '': '/bin/sh'
每次执行命令时会提示:
Reading data from NAND FLASH without ECC is not recommended
Writing data without ECC to NAND-FLASH is not recommended

3.不选择[] S3C2410 NAND Hardware ECC;且chip->eccmod = NAND_ECC_SOFT保持不变,则启动时会提示,但进入提示符操作没有问题。
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
mtd->read(0x3c0c bytes from 0x50c3f4) returned ECC error
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e154: 0xfbeb instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e158: 0xffcf instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e15c: 0xfee9 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e160: 0xeeff instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e164: 0xfffb instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e168: 0xfdef instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e16c: 0xffff instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e170: 0x9ffd instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e174: 0x79ff instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0050e178: 0xfdff instead
Further such events for this erase block will not be printed
Empty flash at 0x0050e280 ends at 0x0050e284
Empty flash at 0x0050e2d4 ends at 0x0050e2d8
Empty flash at 0x0050e424 ends at 0x0050e428
Empty flash at 0x0050e530 ends at 0x0050e534
Empty flash at 0x0050e56c ends at 0x0050e570
Empty flash at 0x0050e604 ends at 0x0050e608
Empty flash at 0x0050e668 ends at 0x0050e66c
Empty flash at 0x0050e714 ends at 0x0050e718
Empty flash at 0x0050e728 ends at 0x0050e72c
Empty flash at 0x0050e7e8 ends at 0x0050e7ec
Empty flash at 0x0050e7f0 ends at 0x0050e7f4
Empty flash at 0x0050fb58 ends at 0x0050fc00
mtd->read(0x400 bytes from 0x68c000) returned ECC error
mtd->read(0x397c bytes from 0x68c684) returned ECC error
Empty flash at 0x0068de88 ends at 0x0068e000
Empty flash at 0x0068ea28 ends at 0x0068ec00
jffs2_scan_eraseblock(): Node at 0x0068ee58 {0x1985, 0xa002, 0x00000081) has invalid CRC 0xd964e529 (calculated 0x8197bd60)
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0068ee5c: 0x0081 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0068ee60: 0xe529 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0068ee64: 0x023f instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0068ee68: 0x0026 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0068ee6c: 0x81a4 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0068ee74: 0x004a instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0068ee78: 0x00ed instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0068ee7c: 0x00ed instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0068ee80: 0x00ed instead
Further such events for this erase block will not be printed
VFS: Mounted root (jffs2 filesystem).
Mounted devfs on /dev
Freeing init memory: 92K
init started: BusyBox v1.7.3 (2008-08-20 09:39:18 CST)
starting pid 17, tty '': '/etc/init.d/rcS'
Cannot run '/etc/init.d/rcS': No such file or directory
Please press Enter to activate this console. mtd->read(0x44 bytes from 0x68d888) returned ECC error
阅读(1196) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~