从eMMC启动路由器
原厂系统为OpenWrt 21, 不支持mt7986, 无法在线安装kmod-mtd-rw
, 需要上传mtd-rw-a53-5.4.ko
到/tmp
目录
cp /tmp/mtd-rw-a53-5.4.ko /lib/modules/5.4.171/ insmod mtd-rw-a53-5.4.ko i_want_a_brick=y
需要可访问外网
opkg install kmod-mtd-rw insmod mtd-rw.ko i_want_a_brick=y modprobe mtd-rw i_want_a_brick=y
mtd erase /dev/mtd0
将snand-preloader
和bl31-uboot
上传到/tmp
目录
(原厂系统与OpenWrt分区名称大小写不同, 擦除时需要区分大小写)
mtd erase BL2 RRE_LOAD=$(ls /tmp/|grep 'snand-preloader') mtd write /tmp/${RRE_LOAD} BL2
mtd erase FIP UBOOT=$(ls /tmp/|grep 'snand-bl31-uboot') mtd write /tmp/${UBOOT} FIP
mtd erase bl2 RRE_LOAD=$(ls /tmp/|grep 'snand-preloader') mtd write /tmp/${RRE_LOAD} bl2
mtd erase fip UBOOT=$(ls /tmp/|grep 'snand-bl31-uboot') mtd write /tmp/${UBOOT} fip
将openwrt-mediatek-filogic-bananapi_bpi-r3-mini-squashfs-sysupgrade.itb
复制到U盘openwrt
文件夹内
重启路由器, 启动时选择0. U-Boot console
, 执行下面的操作
( ( ( OpenWrt ) ) ) [eMMC] U-Boot 2023.07.02-OpenWrt-r23630-842932a63d (Nov 14 2023 - 13:38:11 +0000) 1. Run default boot command. 2. Boot system via TFTP. 3. Boot production system from eMMC. 4. Boot recovery system from eMMC. 5. Load production system via TFTP then write to eMMC. 6. Load recovery system via TFTP then write to eMMC. 7. Load BL31+U-Boot FIP via TFTP then write to eMMC. 8. Load BL2 preloader via TFTP then write to eMMC. 9. Reboot. a. Reset all settings to factory defaults. 0. U-Boot console Press UP/DOWN to move, ENTER to select, ESC to quit
MT7986> usb start starting USB... Bus xhci@11200000: xhci-mtk xhci@11200000: hcd: 0x0000000011200000, ippc: 0x0000000011203e00 xhci-mtk xhci@11200000: ports disabled mask: u3p-0x0, u2p-0x0 xhci-mtk xhci@11200000: u2p:2, u3p:1 Register 300010f NbrPorts 3 Starting the controller USB XHCI 1.10 scanning bus xhci@11200000 for devices... 2 USB Device(s) found scanning usb for storage devices... 1 Storage Device(s) found MT7986> fatload usb 0:1 0x46000000 openwrt/openwrt-mediatek-filogic-bananapi_bpi-r3-mini-initramfs-recovery.itb 40960000 bytes read in 889 ms (43.9 MiB/s) MT7986> bootm
路由器会启动进入恢复模式, 浏览器打开172.16.0.1
, 选择squashfs-sysupgrade
进行刷机
重启后执行下面命令
umount /mnt/ubi0* ubidetach -p /dev/mtd4 ubiformat -y /dev/mtd4 ubiattach -p /dev/mtd4
ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB
刷入recovery(可选, 每次开机自动进入recovery, 慎重)
ubimkvol /dev/ubi0 -n 2 -N recovery -s 40MiB RECOVERY=$(ls /tmp/|grep recovery) ubiupdatevol /dev/ubi0_2 /tmp/${RECOVERY}