Chinaunix首页 | 论坛 | 博客
  • 博客访问: 962685
  • 博文数量: 175
  • 博客积分: 2788
  • 博客等级: 少校
  • 技术积分: 2060
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-25 12:25
个人简介

知之者不如好之,好之者不如乐之

文章分类

全部博文(175)

文章存档

2016年(1)

2015年(20)

2014年(8)

2013年(68)

2012年(16)

2011年(35)

2010年(1)

2008年(26)

分类: LINUX

2008-08-20 16:25:09

文件: 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
阅读(5590) | 评论(1) | 转发(1) |
给主人留下些什么吧!~~

yxl4282008-11-21 09:56:16

请问1.下载MTD工具包的Makefile中 LINUXDIR = /usr/src/linux-arm-2.4-ds 你是怎么改的?我文件系统里根本就没有它,改成我内核的/usr/src/linux-headers-2.6.20-15 这个都是小问题,还有个问题,Make的时候,提示/mtd/kernel里没有Makefile文件: scripts/Makefile.build:17: /home/wfy/Desktop/mtd/kernel/Makefile: No such file or directory make[2]: *** 没有规则可以创建目标“/home/wfy/Desktop/mtd/kernel/Makefile”。 停止 你又是怎么搞的??