Hi!
If you ever wanted to do update your WRT remotely without losing customized files (like ssh keys, wink stored on it, the following tiny .c program might help. (Credits go to mjn3 and his trx replacement for all information about the trx file structure and an example of how to work with it.) It copies a file supplied on stdin into the trx firmware image's otherwise unused third partition and updates the checksum accordingly. It does this mmapping the firmware image and thus works on the WRT itself.
If you attach a tar file to the image,
(cd / && tar cz /my/files*
| trx_update_payload openwrt-linux.trx -)
the payload can be extracted on the first boot after flashing by a simple shell command like:
cd /
&& dd if=/dev/mtdblock/1
bs=4
skip=$(($(trx_update_payload
/dev/mtdblock/1 --ofs)/4))
| tar xz
- no additional tools needed. Just keep in mind that the payload data must not be too much, else you'll nuke your nvram data. It the program is not compiled with NDEBUG defined, it'll warn you if this would happen.
I really don't know if it's the best way to do it but it "works for me(TM)".
Greetings,
Gunter