pc上修改jffs2

環境ubuntu 11.04
0、參考文章
http://blog.21ic.com/user1/6297/archives/2010/69706.html

http://hi.baidu.com/5924431/blog/item/11c0cbfa31ee7f3e4e4aea35.html

dd命令詳解
http://blog.chinaunix.net/space.php?uid=20685699&do=blog&id=1571723

一、工具的安裝
sudo apt-get install mtd-utils
二、製作文件系統
Usage: mkfs.jffs2 [OPTIONS]
Make a JFFS2 file system image from an existing directory tree

選項說明
-p, --pad[=SIZE] Pad output to SIZE bytes with 0xFF. If SIZE is
not specified, the output is padded to the end of
the final erase block
-r, -d, --root=DIR Build file system from directory DIR (default: cwd)
-s, --pagesize=SIZE Use page size (max data node size) SIZE (default: 4KiB)
-e, --eraseblock=SIZE Use erase block size SIZE (default: 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 Don't add a cleanmarker to every eraseblock
-o, --output=FILE Output to FILE (default: stdout)
-l, --little-endian Create a little-endian filesystem
-b, --big-endian Create a big-endian filesystem
-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 by root
-U, --squash-uids Squash owners making all files be owned by 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 Display this help text
-v, --verbose Verbose operation
-V, --version Display version information
-i, --incremental=FILE Parse FILE and generate appendage output for it

例如:
生成新的jffs2文件系統:

#mkfs.jffs2 -l -s 0x800 -e 0x20000 -p 0x4000000 -d mtd/ -o Angstrom-x11-image-demo-glibc-at91.rootfs.jffs2

mkfs.jffs2 -l -s 0x800 -e 0x20000 -p 0x4000000 -d rootfs -o at91-jffs2-rootfs

三、在linux的PC上掛載jffs2根文件系統映像
1)加載mtdblock內核模塊
    #modprobe mtdblock
2)加載mtdram內核模塊,將該設備的大小指定爲jffs2根文件系統映像的大小,塊擦除大小(即flash的塊大小)指定爲製作該 jffs2根文件系統時“-e”參數指定的大小,缺省爲64KB。下面兩個參數的單位都是KB。
     #modprobe mtdram total_size=28928 erase_size=128
3)這時將出現MTD設備/dev/mtdblock0,使用dd命令將jffs2根文件系統拷貝到/dev/mtdblock0設備中。 
    # dd if=genericfs.arm_nofpu.jffs2 of=/dev/mtdblock0
4)將保存了jffs2根文件系統的MTD設備掛載到指定的目錄上。
    # mount -t jffs2 /dev/mtdblock0 /mnt/mtd
這樣就可以在/mnt/mtd目錄下看到文件系統內部的全部內容了,可以拷貝,也可以增加,
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章