Repairing FIT image overlay FS in recovery or on a Linux PC

I've been trying to apply https://github.com/openwrt/mt76/pull/954 to fix the very low TX power limit on my Banana Pi R4 with BE14 wireless card. Not wanting to needlessly rebuild and reflash 24.10.1, I configured my source tree with https://downloads.openwrt.org/releases/24.10.1/targets/mediatek/filogic/config.buildinfo, then removed a bunch of kernel modules (and only things built as modules) that I don't need, primarily support for hardware I don't have, like many non-Mediatek wireless chipsets.

I then installed the resulting mt76 kernel module packages, and rebooted my router. This resulted in my router booting to recovery.

No problem, I thought, I'll just mount_root and rm the files from the upper overlay. Except mount_root seems to do nothing. No output, but no overlay mounted either.

Seems like SD card/eMMC support is missing from recovery, as the only block devices I can see are NAND.

Ok, I'll just pull the SD card out and mount the overlay on my Debian x86-64 laptop. Except the partition is a FIT image, and it's one that u-boot-tools doesn't recognize, i.e. dumpimage doesn't work.

This then led me down the rabbit hole to https://git.openwrt.org/project/fstools.git, specifically libfstools/fit.c, when searching for /dev/fitrw. This looks like kernel code, but seems pretty clearly to be userspace code based on header usage. Then I ran out of time.

I did of course search the web for everything I could think of related to fixing overlays in recovery or on a Linux PC. Not finding anything, I'm starting this thread.

Time to ask for help. Does anyone have a recipe I can use to fix my overlay, either on an OpenWrt device, or on a Linux PC?

I'm amenable to rebuilding recovery with whatever support is missing to be able to mount the overlay FS appended to the FIT image. I also have another OpenWrt device I could use to mount the SD card via USB.

Thanks for any constructive suggestions. Obviously I'm trying not to lose my overlay (again).

Edit: I somehow didn't think to try booting to failsafe mode, despite routinely doing this on my older OpenWrt router. So I did that, but even after removing the offending kernel modules from /overlay/upper, it still kept booting to recovery.

I ended up starting over, reimaging my SD card from 24.10.1. For some reason, the router seemed to keep booting into recovery until I finally attached serial and forced it to boot from the SD card from the U-Boot menu. Then it formatted /dev/fitrw anew and mounted the overlay.

So I think if I had just attached serial earlier (after failsafe and removing bad kernel modules from the overlay), I might have been able to keep my overlay, rather than having to start over. (I had a backup, but it was just sysupgrade -b, and was missing a number of things.)

Anyway, after spending way too many hours on this, I would still find it useful to know how to mount/fix the overlay from any Linux system. It seems like this should be doable with device-mapper, if you could get the starting offset and length of the overlay from within the production FIT partition.