/dev/mtdN 是Linux 中的MTD架构中,系统自己实现的mtd分区所对应的字符设备,其里面添加了一些ioctl
mtd-util中的flash_eraseall等工具,就是以这些ioctl为基础而实现的工具,实现一些关于Flash的操作。
/dev/mtdblockN,是Nand Flash驱动中,驱动在用add_mtd_partitions()添加MTD设备分区,而生成的对应的块设备。
mtd char 设备的主设备号是90,而mtd block设备的主设备号是31
此设备号,定义在/include/linux/mtd/mtd.h中 :
#define MTD_CHAR_MAJOR 90 #define MTD_BLOCK_MAJOR 31
# cat /proc/partitions major minor #blocks name
8 0 156290904 sda 8 1 1 sda1 8 5 22330287 sda5 8 6 22330318 sda6 8 7 22330318 sda7 8 8 22330318 sda8 8 9 22330318 sda9 8 10 22330318 sda10 31 0 14080 mtdblock0 31 1 1024 mtdblock1 31 2 1024 mtdblock2 254 0 1921024 mmcblk0 254 1 1920955 mmcblk0p1
# mount rootfs on / type rootfs (rw) proc on /proc type proc (rw,nodiratime) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw) none on /proc/bus/usb type usbfs (rw) /dev/mtdblock1 on /mnt/mtd type jffs2 (rw,noatime) /dev/mmcblk0p1 on /mnt/sdcard type ext3 (rw,data=ordered) /dev/sda9 on /mnt/hddisk type ext3 (rw,data=ordered)
上面中显示的块设备大小,是block的数目,每个block是1KB。