Make flashable image from current installation

I am currently running pandora box 19.02 on my Xiaomi 3g which is running perfectly including the 2.4Ghz wifi. Unfortunately there is a lot of unneeded packages installed and default language is Chinese. So I removed everything which is not essential for the system and came up with a very slim and good working setup.

Now I am wondering how I could turn my setup into a flashable bin file?
Is there a way of getting a flashable bin file from the actual firmware running on your system?? I would really like to have it as a backup in case something goes wrong.

any help is highly appreciated!

You can likely make the backups easilly; but since you don't know how the OEM setup image flashing, you probably need to restore the partitions like you backed them up - or by using TFTP to restore each one back to the original location.

An option may be to use an utility like binwalk as a comparison and reference tool to configure the backup files like an original BIN file from the manufacturer.

Personally, I believe it's safer to TFTP or use the same tools employed to backup the device.

Thanks for the suggestions!

I finally used the imagebuilder for Pandorabox and made a flashable image containing just the stuff I need. Works very nicely :slight_smile:

by the way, is it allowed to share these images here (they contain proprietary drivers from Mediatek)?

Not unless you can fulfill all the requirements of all the licenses that apply to everything in the image, which is exceptionally unlikely.

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.

Don't mean to piggy-back the OP, but I was wondering there was a router or an xDSL modem-router running an outdated version of Linux-based firmware, is it technically possible to "extract" the drivers form that firmware and have them included in a build of different firmware based on a newer kernel?

I'm not talking about redistributing that as it would likely violate license terms, but rather trying to understand how separable drivers are in an OEM firmware.

Use of dd is not appropriate for NAND.

Use of any low-level tool to write data, especially across versions subjects the user to corruption of data, in some cases making the device perform poorly, lose function, or brick completely. Use of such tools is not recommended for users without a good understanding of the internals of their device, as well as the differences between hex and decimal numbers and arithmetic.

Depends on how the drivers are used. For GPL reasons, proprietary code is typically not compiled into the kernel, but used as a module or stand-alone callables (RIL in a cell phone, for example). These modules are plain files or linkable binaries. Firmware is typically a “blob” to the Linux world. They may be plain files, or stored in a file or on a partition at a known location.

1 Like

okay - thanks, I won't share the files!

for the ones of you that have like me massive problems with the mt76 drivers I recommend to look into the image builder of pandorabox, the firmware runs perfectly.

I know that the kernel is from ancient times but the performance is so much better, no hangs no low speeds and a very responsive internet connection via wifi!

I already thought to sell the router again but with this firmware it as actually usable!

There are newer MTK drivers available here and, perhaps, on master as well. I don't have an MTK device, so I haven't followed it too carefully, but one reference that I find through search is