Filogic ubootmod recovery
On a number of Mediatek Filogic devices it is possible to install a custom uboot which uses a different partition layout and allows the use of more of the flash space compared to the factory uboot. This mainline version of uboot and the corresponding OpenWrt builds are labeled 'ubootmod'. Next to the larger usable flash space these builds have another advantage which is a feature-rich uboot with very robust built in recovery options.
If normal boot is unsuccessful uboot will fall back to the internal recovery image. If the internal recovery image does not boot either it will fall back to running a tftpboot loop. This recovery behaviour can also be forced by pressing the reset button while powering on the router. The tftp recovery expects the tftp server to be at 192.168.1.254 and a file name 'openwrt-mediatek-filogic-manufacturer_model-ubootmod-initramfs-recovery.itb' for example: openwrt-mediatek-filogic-acer_predator-w6x-ubootmod-initramfs-recovery.itb
Here's the ubootmod logic represented as a text flowchart:
Power On
│
▼
U-Boot Environment
│
▼
run _firstboot ? (first init)
│
▼
run boot_first
│
┌────────────┴────────────┐
│ │
▼ ▼
Reset button pressed? No reset
│ │
Yes │ │
▼ ▼
Turn on recovery LED Show boot menu
│
▼
boot_tftp_recovery
(load recovery via TFTP)
│
▼
set flag_recover=1
│
▼
run boot_default
│
▼
flag_recover exists?
│
┌───────┴────────┐
│ │
Yes No
│ │
│ ▼
│ run bootcmd
│ │
│ ▼
│ pstore check succeeds?
│ │
│ ┌────────┴────────┐
│ │ │
│ Yes No
│ │ │
│ ▼ ▼
│ boot_recovery boot_ubi
│ │
│ ▼
│ boot_production
│ │
│ Production OK?
│ │
│ ┌──────────┴─────────┐
│ │ │
│ Yes No
│ │ │
│ ▼ ▼
│ Boot OpenWrt boot_recovery
│ │
│ Recovery OK?
│ │
│ ┌───────────┴──────────┐
│ │ │
│ Yes No
│ │ │
│ ▼ ▼
│ Boot OpenWrt boot_tftp_forever
│ │
│ ▼
│ Infinite TFTP Recovery
│ (retry every second)
│
▼
boot_recovery
│
Recovery OK?
│
┌──────┴──────┐
│ │
Yes No
│ │
▼ ▼
Boot OpenWrt TFTP Recovery Loop