OpenWrt on RPi - Factory image vs Sysupgrade

For some special applications, I prefer using OpenWrt instead of Raspberry Pi OS.

I understand that the Factory and Sysupgrade images are binary identical (verified).
Unfortunately that also means, that any 'sysupgrade' destroys the partition table on the SD card. Wasn't the sysupgrade supposed to keep the current partition in place?
Imho this is important for RPi as an OpenWrt platform, as most would adjust the partition size to the actual SD card after the first installation.

verifiably false assomption

I had checked the 24.10.0 release for RPi 3:

$ md5sum openwrt-24.10.0-*.img
62be775a63aabc87212d301946ad488d  openwrt-24.10.0-bcm27xx-bcm2710-rpi-3-ext4-factory.img
62be775a63aabc87212d301946ad488d  openwrt-24.10.0-bcm27xx-bcm2710-rpi-3-ext4-sysupgrade.img

Just checked the release files from your link, same:

gunzip openwrt-24.10.1-bcm27xx-bcm2712-rpi-5-ext4-sysupgrade.img.gz 

gzip: openwrt-24.10.1-bcm27xx-bcm2712-rpi-5-ext4-sysupgrade.img.gz: decompression OK, trailing garbage ignored

md5sum openwrt-24.10.1-*.img
8f73b009d168e0e1a890d8143139fd8c  openwrt-24.10.1-bcm27xx-bcm2712-rpi-5-ext4-factory.img
8f73b009d168e0e1a890d8143139fd8c  openwrt-24.10.1-bcm27xx-bcm2712-rpi-5-ext4-sysupgrade.img

So it seems like the sysupgrade .gz comes with some extra bytes, but the image is identical?

Yeah, for the SBC-like and miniPC targets that show both, there's no difference between factory and sysupgrade, since there is no weird flash layout or unmanageable bootloader to deal with.

sysupgrade is dumb and generic, it always overwrites the whole partition table on the installation "disk". It has no specialization for those devices on which it's possible to expand partitions, so you need to do that either before you install the image (using custom build, imagebuilder or ASU) or every time after you install (which, of course, runs into space issues when your packages installs exceed default rootfs space). There's always extroot, but that also incurs some post-upgrade work.

I understood that sysupgrade would preserve some directories (/etc/config...), so the assumption was that it does not reformat the partition, or does it? Will have to look deeper into the process.

Ideally (imho), for SBCs with SD cards and similar, Factory images would replace the whole storage content (and auto-resize the main partition), while Sysupgrades replace files only.

I am running squashfs flavour with data partition in 2nd half of sdcard and it never got damaged.

1 Like

Thank you, going to try that!

Yes, it (optionally) preserves some things, and yes, it still reformats everything. It does the backup/restore by running sysupgrade -b some.file.tar.gz and stashing that before reflashing the image, then running sysupgrade -r ... to restore the contents of the archive.

Run sysupgrade -l to see the list of files being archived, and modify the contents of /etc/sysupgrade.conf to add more more files or locations to the backup.