使用命令前用cat /proc/mtd 查看一下mtdchar字符設(shè)備;或者用ls -l /dev/mtd*
#cat /proc/mtd
dev: size erasesize name
mtd0: 00c00000 00020000 “ROOTFS”
mtd1: 00200000 00020000 “BOOTLOADER”
mtd2: 00200000 00020000 “KERNEL”
mtd3: 03200000 00020000 “NAND ROOTFS partition”
mtd4: 04b00000 00020000 “NAND DATAFS partition”
為了更詳細(xì)了解分區(qū)信息用mtd_debug命令
ps:fstab文件中mount硬盤時(shí),盡量使用uuid,而不應(yīng)該使用/dev/sdb4這樣的驅(qū)動(dòng)文件。例如:mount /dev/cdrom /cdrom/dev:dev 是設(shè)備英文縮寫。mount /dev/ad0s1 /mnt/1 mount /dev/ad0s2 /mnt/2 mount /dev/ad0s3 /mnt/3 mount /dev/ad0s4 /mnt/4。
mtd.type = MTD_NORFLASH
mtd.flags =
mtd.size = 12582912 (12M)
mtd.erasesize = 131072 (128K)
mtd.oobblock = 1
mtd.oobsize = 0
throw new executorexception("unknown statement type: " + ms.getstatementtype())。[::] new [placement] new-type-name [new-initializer][::] new [placement] ( type-name ) [new-initializer]。new product name: la division with 20 of new type: new products new type: 99% new origin: new brand in wuhan city of hubei province: extension of the chu kang new quantity: 5000 kg packaging description: 1 kg。
regions = 0
命令:flash_erase
作用:擦出指定范圍內(nèi)flash的內(nèi)容,如果不指定,默認(rèn)擦出起始位置的第一塊,使相應(yīng)flash變?yōu)槿?
用法:
pthread_mutex_destroy(&(cnt.lock))。pthread_mutex_unlock(&(((ct_sum*)cnt)->lock))。pthread_mutex_lock(&(((ct_sum*)cnt)->lock))。
MTD-device:待擦出的分區(qū),如/dev/mtd0
start:起始位置設(shè)置,這里必須設(shè)置為0×20000(128K)的整數(shù)倍
cnt: 從start開始計(jì)算,要擦出的塊數(shù)
lock: 寫保護(hù)
eg: ./flash_erase /dev/mtd0 0×40000 5 //擦出mtd0分區(qū)上從0×40000開始的5塊數(shù)據(jù) ,128K/塊
命令:flash_eraseall
作用:擦出整個(gè)分區(qū)的數(shù)據(jù),同時(shí)也會(huì)作壞塊檢測(cè)
用法:
flash_eraseall [OPTION] MTD_DEVICE