Table of Contents

FIXME This page is a Work In Progress. The goal is to make it similar to opkg and then link to it as often as possible

MTD

mtd is a utility we use to write to an MTD (Memory Technology Device). Please read the Notes to learn more. cd /tmp wget http://www.example.org/original_firmware.bin mtd -r write /tmp/original_firmware.bin firmware

Invocation

Usage: mtd [<options> ...] <command> [<arguments> ...] <device>[:<device>...]

Writing to MTD

unlock <dev> unlock the device
refresh <dev> refresh mtd partition
erase <dev> erase all data on device
write <imagefile>|- write <imagefile> (use - for stdin) to device
jffs2write <file> append <file> to the jffs2 partition on the device
fixtrx <dev> fix the checksum in a trx header on first boot

Options

-q quiet mode (once: no [w] on writing, twice: no status messages)
-n write without first erasing the blocks
-r reboot after successful command
-f force write without trx checks
-e <device> erase <device> before executing the command
-d <name> directory for jffs2write, defaults to "tmp"
-j <name> integrate <file> into jffs2 data when writing an image
-o offset offset of the image header in the partition(for fixtrx)
-F <part>[:<size>[:<entrypoint>]][,<part>…] alter the fis partition table to create new partitions replacing the partitions provided as argument to the write command (only valid together with the write command)

Examples

To write linux.trx to mtd4 labeled as linux and reboot afterwards:

mtd -r write linux.trx linux

mtd vs dd

The differences between dd (disc dump) and mtd are … TODO

Notes