Test device: ath79 mikrotik wap-g on snapshot r15165-66d12ce667
sysupgrade: settings lost
settings are found and restored on sysupgrade (after the initial 4K_SECTORS=y to 4K_SECTORS=n upgrade)
lose write access for routerboot soft_config (which explicitly requires CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y, as Openwrt partial erase target/linux/generic/pending-5.4/411-mtd-partial_eraseblock_write.patch had a merge error which was rendering devices unbootable at the time.)
target/linux/generic/pending-5.4/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch stopped functioning with linux 4.19
Now all partitions have a 4K erase block if CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
This causes mount_root to fail to find upgrade settings where the image is expecting 64K blocksize.
grep --binary-files=text -E 'overlay|upgrade|reboot|mount' ath79_mikrotik_wap-g_sysupgrade_loses_settings
[ 8.892059] mount_root: switching to jffs2 overlay
[ 8.899647] overlayfs: upper fs does not support tmpfile.
Mon Dec 7 13:25:31 UTC 2020 upgrade: Sending TERM to remaining processes ... logd hostapd wpa_supplicant netifd odhcpd ntpd dnsmasq ubusd askfirst urngd
Mon Dec 7 13:25:34 UTC 2020 upgrade: Sending KILL to remaining processes ...
Mon Dec 7 13:25:35 UTC 2020 upgrade: Switching to ramdisk...
Mon Dec 7 13:25:38 UTC 2020 upgrade: Performing system upgrade...
Appending jffs2 data from /tmp/sysupgrade.tgz to firmware..
Mon Dec 7 13:26:21 UTC 2020 upgrade: Upgrade completed
Mon Dec 7 13:26:22 UTC 2020 upgrade: Rebooting system...
umount: can't unmount /dev: Resource busy
umount: can't unmount /tmp: Resource busy
[ 175.677595] reboot: Restarting system
[ 8.611437] mount_root: no usable overlay filesystem found, using tmpfs overlay
[ 117.356605] overlayfs: upper fs does not support tmpfile.
Maybe one of these workarounds could be applied for while/if there is no fix for the 4K blocksize problem:
Make soft_config read-only on all the devices, and unset CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
Tweak mount_root so that it can find the sysupgrade settings
Each ones comes at a price. With the first one, soft_config will not be modifiable from the userspace. With the second one, writing to SPI will remain very slow although, most likely, this should only be noticeable when sysupgrading, I guess not for single-file editions.
Any ideas on how to implement the second idea, if even possible?