make menuconfig 进行修改
Device Drivers --->
<*> Memory Technology Device (MTD) support --->
<*> Enable UBI - Unsorted block images --->
--- Enable UBI - Unsorted block images
(4096) UBI wear-leveling threshold (NEW)
(1) Percentage of reserved eraseblocks for bad eraseblocks handling (NEW)
< > MTD devices emulation driver (gluebi) (NEW)
[ ] UBI debugging (NEW)
File systems --->
[*] Miscellaneous filesystems --->
<*> UBIFS file system support
[*] Extended attributes support
[*] Advanced compression options
[*] LZO compression support (NEW)
[*] ZLIB compression support (NEW)
[ ] Enable debugging support (NEW)
这里是个小关键,其中要确保:
Device Drivers --->
<*> Memory Technology Device (MTD) support --->
<*> NAND Device Support --->
--- NAND Device Support
[ ] Verify NAND page writes
不然在开发板启动会出现u-boot 5号错误
ubi_io_write: error -5 while writing 512 bytes to PEB 78:512, written 0 byte
然后 make 生成
制作映像文件:
制作了一个mkfs.ubifs工具,这个工具就是用来制作ubifs映像的一个工具。
因为mkfs.ubifs工具制作的文件系统映像,在uboot中烧录这种映像文件的方式过于复杂,既要使uboot支持nandflash分区,又要在uboot中激活这个分区,再通过ubi write命令烧录这个映像。所以我们换一种比较容易的方式来移植这个文件系统
在制作mkfs.jffs2和mkfs.ubifs工具时,其实还有一个ubinize工具是同时生成的,它的作用是将mkfs.ubifs制作的映像转换为可以直接用nand write命令烧录的映像文件。
通过你应有的途径得到 build_ubifs.sh 脚本,然后生成 rootfs.ubifs
之后添加 u-boot 对 ubifs 支持
set bubifs 'tftp 30008000 rootfs.ubifs;nand erase 6e00000 9000000;nand write 30008000 6e00000 900000'
set bootargs_ubifs 'console=ttyS0,115200 mem=64M ubi.mtd=6 root=ubi0:rootfs rootwait rootfstype=ubifs rw'
set bootargs 'console=ttyS0,115200 mem=64M ubi.mtd=6 root=ubi0:rootfs rootwait rootfstype=ubifs rw'
set bootcmd_rootfs 'nand read 30008000 100000 400000;bootm 30008000'
set bootcmd 'run bootcmd_rootfs'
save
其中 1. rootfs.ubifs是你脚本文件生成的名字
2. nand erase 到擦掉你所放文件系统的分区(要和你的内核分区对应)
3. mnt 也要对应你内核的分区,也就是你写进文件系统的分区号
接着下载内核及ubifs文件系统,boot重启,然后进入开发板界面 mount命令才看你的文件系统