mkfs.ubifs -r filesystem/ -F -o ubifs.img -m 2048 -e 126976 -c 1580
ubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 2048 ubinize.cfg
執行以上兩句製作文件系統,每個參數也要根據自己的flash設置,這個信息一般啓動的時候會有的。
內核也有要修改的地方,我的內核版本是3.2.0.這裏要打一個補丁
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -718,8 +718,12 @@ static int fixup_free_space(struct ubifs_info *c)
lnum = ubifs_next_log_lnum(c, lnum);
}
- /* Fixup the current log head */
- err = fixup_leb(c, c->lhead_lnum, c->lhead_offs);
+ /*
+ * Fixup the log head which contains the only a CS node at the
+ * beginning.
+ */
+ err = fixup_leb(c, c->lhead_lnum,
+ ALIGN(UBIFS_CS_NODE_SZ, c->min_io_size));
if (err)
goto out;
否則出現以下錯誤
UBIFS error (pid 1): replay_log_leb: first log node at LEB 3:0 is not CS nodeUBIFS error
(pid 1): replay_log_leb: log error detected while replaying the log at LEB 3:0
這個錯誤的原因是'fixup_free_space()中計算空空間開始地址爲c->lhead_offs。正確的應該爲一直是0
重新編譯內核。
把生成的ubi.img和uimage拷貝到NANDFLASH相應的空間,把evm設置成從nandflash啓動。ok。
ps: mtd-utils編譯http://processors.wiki.ti.com/index.php/UBIFS_Support#Compilling_UBIFS_Tools