to be myself
分类: LINUX
2013-03-03 12:34:34
问题描述:
crw-rw---- 1 root root 90, 0 Apr 23 12:22 /dev/mtd0
crw-rw---- 1 root root 90, 1 Apr 23 12:22 /dev/mtd0ro
crw-rw---- 1 root root 90, 2 Apr 23 12:22 /dev/mtd1
crw-rw---- 1 root root 90, 3 Apr 23 12:22 /dev/mtd1ro
crw-rw---- 1 root root 90, 4 Apr 23 12:22 /dev/mtd2
crw-rw---- 1 root root 90, 5 Apr 23 12:22 /dev/mtd2ro
crw-rw---- 1 root root 90, 6 Apr 23 12:22 /dev/mtd3
crw-rw---- 1 root root 90, 7 Apr 23 12:22 /dev/mtd3ro
crw-rw---- 1 root root 90, 8 Apr 23 12:22 /dev/mtd4
crw-rw---- 1 root root 90, 9 Apr 23 12:22 /dev/mtd4ro
crw-rw---- 1 root root 31, 0 Apr 23 12:22 /dev/mtdblock0
crw-rw---- 1 root root 31, 1 Apr 23 12:22 /dev/mtdblock1
crw-rw---- 1 root root 31, 2 Apr 23 12:22 /dev/mtdblock2
crw-rw---- 1 root root 31, 3 Apr 23 12:22 /dev/mtdblock3
crw-rw---- 1 root root 31, 4 Apr 23 12:22 /dev/mtdblock4
很是奇怪,注册的mtdblock都成了字符设备(@linux2.6.32)
mtdblock*应该为块设备才对。
我一路追踪内核的路径为:
add_mtd_partitions
add_one_partition
add_mtd_device
list_for_each_entry(not, &mtd_notifiers, list)
not->add(mtd);
<==> mtd_notifiers->add(mtd)
<==> blktrans_notifier->blktrans_notify_add(mtd)
list_for_each_entry(tr, &blktrans_majors, list) blktrans_majors = mtdblock_tr
tr->add_mtd(tr, mtd);
<=>mtdblock_tr->add_mtd(tr, mtd) <=>mtdblock_add_mtd(blktrans_majors, mtd)
add_mtd_blktrans_dev(mtd_blktrans_dev) add_mtd_blktrans_dev
init_mtdblock
register_mtd_blktrans
register_mtd_user
list_add(&blktrans_notifier->list, &mtd_notifiers);发现并没有什么问题。
最后韦老师让mdev -s试试。
果不其然,finally succeed!
crw-rw---- 1 root root 90, 0 Apr 23 14:55 /dev/mtd0
crw-rw---- 1 root root 90, 1 Apr 23 14:55 /dev/mtd0ro
crw-rw---- 1 root root 90, 2 Apr 23 14:55 /dev/mtd1
crw-rw---- 1 root root 90, 3 Apr 23 14:55 /dev/mtd1ro
crw-rw---- 1 root root 90, 4 Apr 23 14:55 /dev/mtd2
crw-rw---- 1 root root 90, 5 Apr 23 14:55 /dev/mtd2ro
crw-rw---- 1 root root 90, 6 Apr 23 14:55 /dev/mtd3
crw-rw---- 1 root root 90, 7 Apr 23 14:55 /dev/mtd3ro
crw-rw---- 1 root root 90, 8 Apr 23 14:55 /dev/mtd4
crw-rw---- 1 root root 90, 9 Apr 23 14:55 /dev/mtd4ro
brw-rw---- 1 root root 31, 0 Apr 23 14:55 /dev/mtdblock0
brw-rw---- 1 root root 31, 1 Apr 23 14:55 /dev/mtdblock1
brw-rw---- 1 root root 31, 2 Apr 23 14:55 /dev/mtdblock2
brw-rw---- 1 root root 31, 3 Apr 23 14:55 /dev/mtdblock3
brw-rw---- 1 root root 31, 4 Apr 23 14:55 /dev/mtdblock4
2012-04-23 15:15 发表于百度空间,今搬至CU。