Make flashable image from current installation

In case someone is still looking for this.
I became aware of this nifty process recently.

First do this to find which partition holds the firmware image.

root@openwrt:~# cat /proc/mtd 
dev: size erasesize name
mtd0: 00030000 00010000 "u-boot"
mtd1: 007a0000 00010000 "firmware"
mtd2: 00180000 00010000 "kernel"
mtd3: 00620000 00010000 "rootfs"
mtd4: 001c0000 00010000 "rootfs_data"
mtd5: 00020000 00010000 "tplink"
mtd6: 00010000 00010000 "art"

So now I know that mtd1 holds firmware, run this command to create image:

root@openwrt:~#dd if=/dev/mtd1 of=/tmp/firmware.bin
15616+0 records in
15616+0 records out

Now you can use firmware.bin file to re-flash your router.