Board logo

标题: Linux最新UBI文件系统介绍(2) [打印本页]

作者: yuyang911220    时间: 2017-6-15 17:20     标题: Linux最新UBI文件系统介绍(2)

4、利用uboot烧写、启动UBIFS镜像
1)烧写UBIFS镜像
OMAP3 DevKit8000 # mmcinit
    OMAP3 DevKit8000 # fatload mmc 0:1 81000000 ubi.img
    reading ubi.img
    12845056 bytes read
    OMAP3 DevKit8000 # nand unlock
    device 0 whole chip
    nand_unlock: start: 00000000, length: 268435456!
    NAND flash successfully unlocked
    OMAP3 DevKit8000 # nand ecc sw
    OMAP3 DevKit8000 # nand erase 680000 7980000
    NAND erase: device 0 offset 0x680000, size 0x7980000
    Erasing at 0x7fe0000 -- 100% complete.
    OK
    OMAP3 DevKit8000 # nand write.i 81000000 680000 $(filesize)
    NAND write: device 0 offset 0x680000, size 0xc40000
    Writing data at 0x12bf800 -- 100% complete.
    12845056 bytes written: OK
烧写过程和烧写内核镜像的过程一致,所以UBI文件系统应该不像yaffs文件系统那样用到了nand的OOB区域。
2)设置UBIFS文件系统作为根文件系统启动的参数
OMAP3 DevKit8000 # setenv bootargs console=ttyS2,115200n8 ubi.mtd=4 root=ubi0:rootfs
    rootfstype=ubifs video=omapfb:mode:4.3inch_LCD
    OMAP3 DevKit8000 # setenv bootcmd nand read.i 80300000 280000 200000/;bootm 80300000
根文件系统的位置在MTD4上
系统启动时会打印出如下和UBI相关的信息:
Creating 5 MTD partitions on "omap2-nand":
    0x00000000-0x00080000 : "X-Loader"
    0x00080000-0x00260000 : "U-Boot"
    0x00260000-0x00280000 : "U-Boot Env"
    0x00280000-0x00680000 : "Kernel"
    0x00680000-0x08000000 : "File System"
    UBI: attaching mtd4 to ubi0
    UBI: physical eraseblock size: 131072 bytes (128 KiB)
    UBI: logical eraseblock size: 129024 bytes
    UBI: smallest flash I/O unit: 2048
    UBI: sub-page size: 512
    UBI: VID header offset: 512 (aligned 512)
    UBI: data offset: 2048
    UBI: attached mtd4 to ubi0
    UBI: MTD device name: "File System"
    UBI: MTD device size: 121 MiB
    UBI: number of good PEBs: 970
    UBI: number of bad PEBs: 2
    UBI: max. allowed volumes: 128
    UBI: wear-leveling threshold: 4096
    UBI: number of internal volumes: 1
    UBI: number of user volumes: 1
    UBI: available PEBs: 0
    UBI: total number of reserved PEBs: 970
    UBI: number of PEBs reserved for bad PEB handling: 9
    UBI: max/mean erase counter: 2/0




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0