How to convert .RMT to .BIN for OpenRG Bootloader (RGLoader)

I recently encountered a situation while loading firmware into an Actiontec MI424-WR router, when I found myself without a bootable firmware, and the OpenRG bootloader would vehemently refuse to load .rmt files.

The MI424-WR has two sections in its Flash for firmware. The stock firmware available from Actiontec is, of course, a RMT. (I did in fact have the .bin dump of the entire flash chip, but I wasn't about to attempt to make the bootloader overwrite itself.)

After comparing hex dumps, I came to the conclusion that .rmt files are .bin files with a 148-byte header. All you have to do to create a .bin that is ready to be downloaded by the router is to use the following command:

dd if=firmware.rmt of=firmware.bin bs=1 skip=147

Such that the resulting "firmware.bin" file begins with 0xE2 0x8F 0xA0 like other .img files built for this router. I'm not sure if the "magic" will be the same for other machines, but that's what it seems to be for the MI424-WR running on the stock bootloader (OpenRG).

I hope this saves someone some hassle. As usual, no guarantees of accuracy or completeness ;-)

Trackback URL for this post: