For this method to work, you need to copy the file containing the firmware image to the router, preferably into /tmp/, the memory filesystem should be big enough to hold the full image. If not, use wget to get the image via http or ftp and pipe the result into mtd.
Then the image is written to flash using mtd, optionally giving additional options (see below).
The mtd utility was written with simplicity and code size in mind. It's features were derived from the mtd-utils, combining the needed parts into a single small tool providing all the functionality necessary for FreeWRT, and leaving everything out that's not.
mtd provides the following features:
Further it can request your system to reboot. Some of the features mentioned here can also be combined, so it is e.g. possible to immediately reboot the system after the flash has been written.
Mostly, similar to the sample usage shown in the help output should be all that has to be done to write the firmware to flash:
[label=write a previously downloaded new firmware-file into flash] # mtd -e firmware -r write freewrt.bin firmware &Or via wget pipe:
[label=download and write a new firmware-file into flash] # wget -O - http://www.yourserver.com/freewrt.bin | mtd -e firmware -r write - firmware &The parameters explained in detail: