日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

jffs2制作与烧写

發布時間:2023/12/20 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 jffs2制作与烧写 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

JFFS2全名是Journalling Flash File System Version2.
最早只支持Nor Flash,自2.6版以后開始支持Nand Flash。

JFFS2是Flash上應用最廣的一個日志結構文件系統。它提供的垃圾機制,不需要馬上對擦寫越界的塊進行擦寫,而只需要將其設置一個標志,表明為臟塊,當可用的塊數不足時,垃圾機制才開始處理這些節點。同時,由于JFFS2基于日志結構,在意外掉電后仍然可以保持數據的完整性,而不會丟失數據。

1.制作jffs2文件系統,需要用到工具mkfs.jffs2.
mkfs.jffs2 -r nfs -o fs.jffs2 -e 0x10000 -s 0x10000 -l -n
注:SST6401的擦出塊和每塊的大小都按32KiWord即64KiB計算,0x10000。
注:此外可查看內核提供的塊大小:cat /proc/mtd.
注:若指定塊大小不對時:Empty flash at 0x00347ff0 ends at 0x00348000。
注:若未加-n則:CLEANMARKER node found at 0x0042c000 has totlen 0xc != normal 0x0

Mkfs.jffs2各參數的意義如下:
-r:指定要做成image的目錄名。


-o:指定輸出image的文件名。


-e:每一塊要擦除的block size,默認是64KB.要注意,不同的flash, 其block size會不一樣,三星的K9F2G08U0A的block size為0x20000(從其datasheet里可以找到)。在沒有加-e選項是,啟動會出現以下錯誤:at91sam user.warn kernel: Empty flash at 0x00f0fffc ends at 0x00f10000。因此,若有類似的錯誤,加上-e選項,并配置nandflash的塊大小,即可消除。


--pad(-p):用16進制來表示所要輸出文件的大小,也就是fs.jffs2的大小,如果實際大小不足此設定的大小,則用0xFF補足。也可以不用此選項,生成的文件系統的大小跟本身大小一致,暫時還不知道有和妙用,但是加上后會少出現很多錯誤。


-n,-no-cleanmarkers:指明不添加清楚標記(nandflash有自己的校檢塊,存放相關的信息)。如果掛載后會出現類似:CLEANMARKER node found at 0x0042c000 has totlen 0xc != normal 0x0的警告,則加上-n就會消失。


-l,--little-endian:指定使用小端格式。

2.燒寫
NorFlash:

mkfs.jffs2 -r nfs -o fs.jffs2 -e 0x10000? -l -n
erase 10380000 107fffff;
//tftp 20008000 rootfs_3gvideo_20141201.jffs2;
//cp.b 0x20008000 0x10380000 0x2aca28;
tftp 20008000 fs.jffs2;
cp.b 0x20008000 0x10380000 0x34bac0;

NandFlash:

mkfs.jffs2 -r rootfs -o rootfs.jffs2 -e 0x20000 -n????? ;K9F2G08

tftp 0x21100000 rootfs.jffs2
nand erase 0x8a0000 0x400000? ;擦出整個分區
nand write.jffs2 21100000 0x8a0000 0x230e10? ;寫到/dev/mtd3
setenv bootargs root=/dev/mtdblock3 rootfstype=jffs2 rw console=ttyS0,115200 init=/linuxrc mem=64M

?3.? mkfs.jffs2用法

~$mkfs.jffs2 --help
mkfs.jffs2: Usage: mkfs.jffs2 [OPTIONS]
Make a JFFS2 file system image from an existing directory tree

Options:
? -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
? -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

轉載于:https://www.cnblogs.com/embedded-linux/p/4823931.html

總結

以上是生活随笔為你收集整理的jffs2制作与烧写的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。