免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1256 | 回复: 0
打印 上一主题 下一主题

mkfs.jffs2使用方法 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-03-31 17:33 |只看该作者 |倒序浏览

实例:
mkfs.jffs2 -r rootfs -o rootfs.jffs2 -e 0x4000 --pad=0x1000000 -s 0x200 -n
mkfs.jffs2: Usage: mkfs.jffs2 [OPTIONS]
Make a JFFS2 file system image from an existing directory tree
Options:
-p, --pad[=SIZE]        用16進制表示所要輸出檔案的大小,也就是root.jffs2的size。很重要的
                        是,為了不浪費flash空間,這個值最好符合flash driver的區塊大小。
                        如果不足则使用0xff来填充补满。
-r, -d, --root=DIR      指定要做成image的源資料夾.(默认:当前文件夹)
-s, --pagesize=SIZE     节点页大小(默认: 4KiB)
-e, --eraseblock=SIZE   设定擦除块的大小为(默认: 64KiB)
-c, --cleanmarker=SIZE  Size of cleanmarker (default 12)
-m, --compr-mode=MODE   Select compression mode (default: priortiry)
-x, --disable-compressor=COMPRESSOR_NAME
                        Disable a compressor
-X, --enable-compressor=COMPRESSOR_NAME
                        Enable a compressor
-y, --compressor-priority=PRIORITY:COMPRESSOR_NAME
                        Set the priority of a compressor
-L, --list-compressors Show the list of the avaiable compressors
-t, --test-compression Call decompress and compare with the original (for test)
-n, --no-cleanmarkers   指明不添加清楚标记(nand flash 有自己的校检块,存放相关的信息。)
                        如果挂载后会出现类似:CLEANMARKER node found at 0x0042c000
                        has totlen 0xc != normal 0x0 的警告,则加上-n 就会消失。
-o, --output=FILE       指定輸出image檔案的文件名.(default: stdout)
-l, --little-endian     指定使用小端格式
-b, --big-endian        指定使用大端格式
-D, --devtable=FILE     Use the named FILE as a device table file
-f, --faketime          Change all file times to '0' for regression testing
-q, --squash            Squash permissions and owners making all files
                        be owned byroot
-U, --squash-uids       将所有文件的拥有者设为root用户
-P, --squash-perms      Squash permissions on all files
      --with-xattr      stuff all xattr entries into image
      --with-selinux    stuff only SELinux Labels into jffs2 image
      --with-posix-acl  stuff only POSIX ACL entries into jffs2 image
-h, --help              显示这些文字
-v, --verbose           Verbose operation
-V, --version           显示版本
-i, --incremental=FILE  Parse FILE and generate appendage output for it


生成的rootfs.img可通过u-boot直接烧写至nand flash:
              nand erase 0x200000 0x3e00000//擦写
              tftp 0x30000000 rootfs.img//下载
              nand write.jffs2 0x200000 $(filesize)//烧入






(1)安裝
cvs -d :pserver:anoncvs@cvs.infradead.org:/home/cvs login(password: anoncvs)
cvs -d :pserver:anoncvs@cvs.infradead.org:/home/cvs co mtd
cvs在目錄下建立mtd的目錄
mtd/util 之中有mkfs.jffs2.c這檔案
為了產生mkfs.jffs2,我們必須編譯......
How to compile?
cd ~/sh-linux/utils/jffs2_utils/
make clean
make
cp mkfs.jffs /sbin
如果compile過不了,這裡有現成的bin可以下載
http://sources.redhat.com/jffs2/
最後複製到/sbin目錄下
cp /mtd/mkfs.jffs2 /sbin
(2)建立mkfs.jffs2檔案系統
mkfs.jffs2 -r DIR -o jffs2.image
(jffs2.imag是我們要輸出的檔案名稱)
(參數 -r 跟 -d 都是root dir的意思)
# ./mkfs.jffs2 -d /usr/src/linux/fs/jffs2 -o jffs2test.img

爾後我們可以將此image掛載上去
# cp jffs2test.img /dev/mtd0
(3)mount
mount -t jffs2 /dev/mtdblock0 /mnt/xxx
xxx為自行建立的新資料夾目錄
有掛載就要卸載,umount可以卸載
我們可以在裡面讀寫檔案測試
卸載後應該就看不見了


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/93290/showart_1886542.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP