一、ubi驱动调试
主要在drivers/mtd/ubi/debug.c中,可以看到ubi 相关vid ec数据结构相关的信息
drivers/mtd/ubi/debug.c
----ubi_dump_ec_hdr
---ubi_dump_vid_hdr
---ubi_debugfs_init中debugfs_create_dir("ubi",...)
ubi驱动中打印当前操作ubi文件系统的进程信息:
#define ubi_dbg_msg(type, fmt, ...) \
pr_info("UBI DBGGER " type " (pid number %d): " fmt "\n", current->pid, \
##__VA_ARGS__)
ubi调试节点如下:
ls /sys/kernel/debug/ubi5/
chk_fastmap tst_emulate_bitflips
chk_gen tst_emulate_io_failures
chk_io tst_emulate_power_cut
detailed_erase_block_info tst_emulate_power_cut_max
tst_disable_bgt tst_emulate_power_cut_min
drivers/mtd/mtdpart.c中:
allocate_partition函数中会打印各个mtd的地址范围:如开机启动的mtd地址范围就是在如下地方打印;
printk(KERN_NOTICE "0x%012llx-0x%012llx : \"%s\"\n", (unsigned long long)slave->offset,
(unsigned long long)(slave->offset + slave->mtd.size), slave->mtd.name);
二、ubi均衡损耗
驱动代码:drivers/mtd/ubi/wl.c
zcat /proc/config.gz | grep UBI_WL
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_WL_TH