mtd

 

介紹

mtd (Memory Technology Device)

 


mtd (Memory Technology Device)

 

mtd 是一個類似 dd 的工具來,

mtd  [option] <command> <device / label>

command:

  • erase <dev>                                          # erase all data on device 
  • write <imagefile>|-                                # write <imagefile> (use - for stdin) to device 
  • verify <imagefile>|-                                # verify <imagefile> (use - for stdin) to device

查看 flash 的分區情況:

cat /proc/mtd

dev:    size   erasesize  name
mtd0: 00020000 00010000 "u-boot" <-- boot loader
mtd1: 000e5e00 00010000 "kernel" <-- firmware
mtd2: 002ea200 00010000 "rootfs" <-- firmware
mtd3: 00170000 00010000 "rootfs_data"
mtd4: 00010000 00010000 "art"
mtd5: 003d0000 00010000 "firmware"

裝置檔:

/dev/mtdX

Backup方式:

dd if=/dev/mtd0 of=/tmp/boot.backup

reset:

# -r => reboot after successful command

mtd -r erase rootfs_data

還原:

mtd -r write /tmp/original_firmware.bin firmware