Can I create a downloadable firmware file on RP4?

I have my OpenWrt firmware setup the way I want it with all drivers wanted/needed. I've done the advanced sysupgrade and all the drivers are out of the overlay now. Can I now create a downloadable factory or sysupgrade format firmware file from my own setup? Or do I just have to manually enter everything into the firmware selector and rebuild it that way? Just wondering if AUC or other utility can do this. Or even make a text file of all the installed drivers I can just paste into the firmware selector? I'm trying to make working backups where I could start from nothing and have everything the way I have it now in case the micro sd card just dies - which has happened to me before.

This is definitely possible.

The RPi (or x86, or other SBC like devices that boot from removable media) is quite unique in this, in that you can clone the sdhc card (externally), on more normal routers this would be dangerous (in-band ECC data, wifi calibration, etc. pp.). Just keep in mind that this (still) isn't safe to be used on a different RPi (or other device), as it may contain mac addresses and other unique identifiers that mustn't come up twice in the same network.

However, it would be actually safer, if you get your configuration sysupgrade safe first (making sure that all configuration ends up in the backup tarball) and include your additional packages via (online-) imagebuilder or asu, as this catches two flies in one trap - allowing you easy recovery and reasonably easy upgrading.

I thought about making an image file I could clone back to another microSD and I just have the one Rp4 (RP5 on backorder). I think having a factory firmware custom built by the firmware selector and a backup archive would be the easy way. What parts of the configuration are not preserved in the backup tarball? I've discovered the hard way that sometimes the archive can't be read when you go to restore it.

23.05.3 has just been released too. When I do an automated firmware upgrade, the storage space always gets reduced to 4GB and I have to go through the process of flashing a factory image, expanding the storage, booting and restoring the backup when you upgrade the firmware version. This is another reason I just have to make a text file of all my packages and drivers and paste it into the firmware selector to make a factory image.

Would a command like this work?

opkg list-installed > /etc/config/installed_packages.txt

Would that text file have all the entries you need to paste into the Firmware Selector to create the factory and/or sysupgrade binary to download?

Should be:

opkg list-installed | cut -f1 -d' ' > /etc/config/installed_packages.txt
1 Like

It's generally not advisable to keep non-uci files under /etc/config/, better choose another location.

1 Like

Good point. Just used that because I'm always going there to edit things.

The command worked to create the text file. Each installed package is on a line by itself. I was able to cut and paste it into the firmware selector in this format and successfully build it. So there we have it. A complete microSD card failsafe backup system.

Make a tarball archive backup
make a text file of all your installed packages
paste the package list into Firmware Selector and build your factory firmware

If your microSD card fails, flash the firmware, restore the backup - all done.

In fact, you probably just need the backup archive and the installed_packages.txt file because if you have a complete failure, you can create the firmware when and if you need it from the firmware selector and restore the backup.

I wonder if this process could be automated? This method to me seems like a good practice. Often when I've lost everything on a computer the trick was to really start from nothing, boot a computer and restore a backup and often I'd neglected to create the stuff I need to restore everything from nothing. I needed something to boot with the program to restore the backups I'd been making.

As far as your OpenWrt router goes, this method seems like an reliable and easy way to do a basic task. And those microSD cards do fail without warning sometimes. Regular routers probably more reliable than the Pi4 and this method would apply to any router I think.

Thanks to all for the hand holding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.