最近一直在调试cramfs,yaffs2,ubi
由于cramfs压缩比较厉害,导致挂载时间较长,应用程序也需要较长时间加载,内存使用也较大,因此一直寻找能替代cramfs的文件系统。
叫优秀的除了jffs2(评价一般般)外,就剩下yaffs2和ubi了。

先是调试yaffs2.我的内核版本是linux-2.6.32.17,yaffs2已经有支持了。在内核直接选上就可以了。

yaffs2 压缩比太低
40M的空间,写入(有部分会写不进去)后读取出来得到25M-26M的内容
修改内核配置
 |      <*>   YAFFS2 file system support                                             | | 
  | |      -*-     512 byte / page devices                                              | | 
  | |      [ ]       Use older-style on-NAND data format with pageStatus byte           | | 
  | |      [ ]         Lets Yaffs do its own ECC                                        | | 
  | |      -*-     2048 byte (or larger) / page devices                                 | | 
  | |      [*]       Autoselect yaffs2 format                                           | | 
  | |      [*]       Disable YAFFS from doing ECC on tags by default                    | | 
  | |      [ ]       Disable lazy loading                                               | | 
  | |      [*]     Turn off wide tnodes                                                 | | 
  | |      [ ]     Force chunk erase check                                              | | 
  | |      [*]     Cache short names in RAM                                             | | 
  | |      [ ]     Empty lost and found on boot                                         | | 
  | |      [ ]     Disable yaffs2 block refreshing                                      | | 
  | |      [ ]     Disable yaffs2 background processing                                 | |

  后正常 


下面的工作就是在uboot里面烧写yaffs了。
到yaffs2utils开源项目上下载工具yaffs2utils-0.2_pre3.tar.gz
解压
tar -zxvf yaffs2utils-0.2_pre3.tar.gz
make即可生成工具
mkyaffs2 unyaffs2


#mkyaffs2 modules modules.yaffs.img
mkyaffs2-0.2.0_pre3: image building tool for YAFFS2
stage 1: scanning directory ""... [done]
scanning complete, total 7 objects.
stage 2: making image "modules.yaffs.img"
[=================================================================================================================================================] 7/7 100%
operation complete.
7 objects in 96 NAND pages

# ls -alh modules.yaffs.img
-rw-r--r-- 1 root root 198K 2011-07-06 15:12 modules.yaffs.img
#mkyaffs2 -h
mkyaffs2-0.2.0_pre3: image building tool for YAFFS2
Usage: mkyaffs2 [-e] [-h] [-v] [-p size] [-o file] dirname imgfile
mkyaffs2: A utility to make the yaffs2 image
version: 0.2.0_pre3
options:
-h display this help message and exit.
-e convert endian differed from local machine.
-v verbose details instead of progress bar.
-p size page size of target device (512|2048 bytes, default: 2048).
-o file load external oob image file.
制作
mkyaffs2 rootfs/ rootfs.yaffs.img

tftp 0x80700000 rootfs.yaffs.img

引导信息
[ 2.660000] NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)
[ 2.670000] nand_bbt: ECC error while reading bad block table
[ 2.680000] Creating 8 MTD partitions on "davinci_nand.0":
[ 2.680000] 0x000000000000-0x000000080000 : "bootloader"
[ 2.700000] 0x000000080000-0x000000100000 : "params"
[ 2.710000] 0x000000100000-0x000000400000 : "kernel"
[ 2.720000] 0x000000400000-0x000001200000 : "rootfs"
[ 2.730000] 0x000001200000-0x000001300000 : "driver"
[ 2.740000] 0x000001300000-0x000003b00000 : "app"
[ 2.750000] 0x000003b00000-0x000003f00000 : "config"
[ 2.770000] 0x000003f00000-0x000008000000 : "ext"
[ 2.780000] davinci_nand davinci_nand.0: controller rev. 2.3


[ 4.840000] yaffs: dev is 32505859 name is "mtdblock3"
[ 4.840000] yaffs: passed flags ""
[ 4.850000] yaffs: Attempting MTD mount on 31.3, "mtdblock3"
[ 4.870000] yaffs_read_super: isCheckpointed 0
[ 4.880000] VFS: Mounted root (yaffs2 filesystem) on device 31:3.
[ 4.890000] Freeing init memory: 512K
[ 4.890000] Warning: unable to open an initial console.
[ 4.900000] Failed to execute /linuxrc. Attempting defaults...
[ 4.900000] Kernel panic - not syncing: No init found. Try passing init= option to kernel.
[ 4.910000] Backtrace:
[ 4.910000] [<c008c5f4>] (dump_backtrace+0x0/0x114) from [<c039db94>] (dump_stack+0x18/0x1c)
[ 4.920000] r7:00000000 r6:00000000 r5:00000000 r4:c04d05f0
[ 4.930000] [<c039db7c>] (dump_stack+0x0/0x1c) from [<c039dbec>] (panic+0x54/0x12c)
[ 4.940000] [<c039db98>] (panic+0x0/0x12c) from [<c0088634>] (init_post+0xdc/0x104)
[ 4.940000] r3:00000000 r2:c42bfe00 r1:c0504000 r0:c0436543
[ 4.950000] [<c0088558>] (init_post+0x0/0x104) from [<c00084c0>] (kernel_init+0xe8/0x118)
[ 4.960000] r5:00000000 r4:c04cfec0
[ 4.960000] [<c00083d8>] (kernel_init+0x0/0x118) from [<c00a0d88>] (do_exit+0x0/0x668)
[ 4.970000] r5:00000000 r4:00000000

从上面的情况看是挂载失败了。网上查了些资料,感觉是因为uboot对大块flash的支持不够,导致写入的yaffs的ECC问题,因而挂载失败。

yaffs2-source.tar

make
utils$ ./mkyaffs2image -h
mkyaffs2image: image building tool for YAFFS2 built Jul 5 2011
usage: mkyaffs2image dir image_file [convert]
dir the directory tree to be converted
image_file the output file to hold the image
'convert' produce a big-endian image from a little-endian machine


尝试使用

sudo tar -zxvf mkyaffs2image.gz
[sudo] password for ti:
usr/sbin/mkyaffs2image
usr/sbin/mkyaffs2image-128M


Logo

更多推荐