mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 09:12:39 +00:00
f11e6e221e
**SoC**: MediaTek MT7981B 2x A53
**Flash**: ESMT F50L1G41LB 128MB
**RAM**: NT52B128M16JR-FL 256MB
**Ethernet**: 4x 10/100/1000 Mbps
**Switch**: MediaTek MT7531AE
**WiFi**: MediaTek MT7976C
**Buttons**: Reset, Mesh
**Power**: DC 12V 1A
1. Get ssh access. Supported stock firmware **1.0.47**
```
curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0Anvram%20set%20ssh_en%3D1%0A"
curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0Anvram%20commit%0A"
curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0Ased%20-i%20's%2Fchannel%3D.*%2Fchannel%3D%22debug%22%2Fg'%20%2Fetc%2Finit.d%2Fdropbear%0A"
curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=*******/api/misystem/arn_switch" -d "open=1&model=1&level=%0A%2Fetc%2Finit.d%2Fdropbear%20start%0A"
curl -X POST "http://192.168.31.1/cgi-bin/luci/;stok=********/api/misystem/arn_switch" -d "open=1&model=1&level=%0Apasswd%20-d%20root%0A
```
2. Backup stock partitions
```
nanddump -f /tmp/BL2.bin /dev/mtd1
nanddump -f /tmp/Nvram.bin /dev/mtd2
nanddump -f /tmp/Bdata.bin /dev/mtd3
nanddump -f /tmp/Factory.bin /dev/mtd4
nanddump -f /tmp/FIP.bin /dev/mtd5
nanddump -f /tmp/ubi.bin /dev/mtd8
nanddump -f /tmp/KF.bin /dev/mtd12
```
Then transfer them to your computer in a safe place.
3. Get firmware information `cat /proc/cmdline`
4. Copy openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-initramfs-factory.ubi to **/tmp** and flash
If **firmware=0**
```
ubiformat /dev/mtd9 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-initramfs-factory.ubi
nvram set boot_wait=on
nvram set uart_en=1
nvram set flag_boot_rootfs=1
nvram set flag_last_success=1
nvram set flag_boot_success=1
nvram set flag_try_sys1_failed=0
nvram set flag_try_sys2_failed=0
nvram commit
reboot
```
If **firmware=1**
```
ubiformat /dev/mtd8 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-initramfs-factory.ubi
nvram set boot_wait=on
nvram set uart_en=1
nvram set flag_boot_rootfs=0
nvram set flag_last_success=0
nvram set flag_boot_success=1
nvram set flag_try_sys1_failed=0
nvram set flag_try_sys2_failed=0
nvram commit
reboot
```
Then reboot your router, it should boot to the OpenWrt initramfs system now.
5. Flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-squashfs-sysupgrade.bin
`sysupgrade -n /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-squashfs-sysupgrade.bin`
1. Flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb
`ubiformat /dev/mtd8 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb`
`reboot`
2. Install kmod-mtd-rw
`opkg update && opkg install kmod-mtd-rw`
`insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1`
3. Format ubi and create new ubootenv volume
```
ubidetach -p /dev/mtd8; ubiformat /dev/mtd8 -y; ubiattach -p /dev/mtd8
ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB
ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB
```
4. *(Optional **-10Mb** free space) Add recovery boot feature.*
```
ubimkvol /dev/ubi0 -n 2 -N recovery -s 10MiB
ubiupdatevol /dev/ubi0_2 /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb
```
5. Flash Openwrt U-Boot
```
mtd write /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-preloader.bin BL2
mtd write /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-bl31-uboot.fip FIP
```
6. Flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-squashfs-sysupgrade.itb
`sysupgrade -n /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-squashfs-sysupgrade.itb`
1. Force flash openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb
`sysupgrade -F -n /tmp/openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb`
2. Format ubi and Nvram
```
ubidetach -p /dev/mtd8; ubiformat /dev/mtd8 -y; ubiattach -p /dev/mtd8
mtd erase Nvram
```
3. Install kmod-mtd-rw
`opkg update && opkg install kmod-mtd-rw`
`insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1`
4. Flash stock images from backup
```
mtd write /tmp/BL2.bin BL2
mtd write /tmp/FIP.bin FIP
mtd write /tmp/ubi.bin ubi
```
Then reboot your router, waiting it finished rollback in minutes.
`ubiformat /dev/mtd7 -y -f /tmp/ubi.bin`
Then reboot your router, waiting it finished rollback in minutes.
Signed-off-by: Dim Fish <dimfish@gmail.com>
(cherry picked from commit
|
||
---|---|---|
.. | ||
000-mtk-20-configs-mt7622-enable-environment-for-mt7622_rfb.patch | ||
050-mt7622-enable-pstore.patch | ||
051-mt7986-enable-pstore.patch | ||
052-mt7981-enable-pstore.patch | ||
100-00-clk-remove-log_ret-from-clk_get_rate.patch | ||
100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch | ||
100-03-mtd-mtk-snand-add-support-for-SPL.patch | ||
100-04-env-add-support-for-generic-MTD-device.patch | ||
100-05-mtd-add-a-new-mtd-device-type-for-NMBM.patch | ||
100-06-mtd-add-core-facility-code-of-NMBM.patch | ||
100-07-mtd-nmbm-add-support-for-mtd.patch | ||
100-08-common-board_r-add-support-to-initialize-NMBM-after-.patch | ||
100-09-cmd-add-nmbm-command.patch | ||
100-10-cmd-mtd-add-markbad-subcommand-for-NMBM-testing.patch | ||
100-11-env-add-support-for-NMBM-upper-MTD-layer.patch | ||
100-12-mtd-mtk-snand-add-NMBM-support-for-SPL.patch | ||
100-13-cmd-add-a-new-command-for-NAND-flash-debugging.patch | ||
100-14-mtd-spi-nor-add-support-to-read-flash-unique-ID.patch | ||
100-15-cmd-sf-add-support-to-read-flash-unique-ID.patch | ||
100-16-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch | ||
100-17-common-spl-spl_nand-enable-CONFIG_SYS_NAND_U_BOOT_OF.patch | ||
100-18-board-mt7629-add-support-for-booting-from-SPI-NAND.patch | ||
100-19-board-mt7622-use-new-spi-nand-driver.patch | ||
100-20-board-mt7981-add-reference-board-using-new-spi-nand-.patch | ||
100-21-mtd-spi-nor-add-more-flash-ids.patch | ||
100-22-mtd-spi-nand-backport-from-upstream-kernel.patch | ||
100-23-mmc-mtk-sd-add-support-to-display-verbose-error-log.patch | ||
100-24-cmd-ubi-make-volume-find-create-remove-APIs-public.patch | ||
100-25-cmd-ubi-allow-creating-volume-with-all-free-spaces.patch | ||
100-26-env-ubi-add-support-to-create-environment-volume-if-.patch | ||
100-27-mtd-ubi-add-support-for-UBI-end-of-filesystem-marker.patch | ||
100-29-board-mediatek-wire-up-NMBM-support.patch | ||
101-01-arm-mediatek-retrieve-ram_base-from-dts-node-for-arm.patch | ||
101-02-board-mediatek-update-config-headers.patch | ||
101-03-spi-mtk_spim-get-spi-clk-rate-only-once.patch | ||
101-04-spi-mtk_spim-clear-IRQ-enable-bits.patch | ||
101-05-serial-mtk-initial-priv-data-before-using.patch | ||
101-06-reset-mediatek-check-malloc-return-valaue-before-use.patch | ||
101-07-i2c-mediatek-fix-I2C-usability-for-MT7981.patch | ||
101-08-arm-dts-enable-i2c-support-for-MediaTek-MT7981.patch | ||
101-09-pwm-mtk-add-support-for-MediaTek-MT7988-SoC.patch | ||
101-10-clk-mediatek-add-clock-driver-support-for-MediaTek-M.patch | ||
101-11-reset-mediatek-add-reset-definition-for-MediaTek-MT7.patch | ||
101-12-pinctrl-mediatek-convert-most-definitions-to-const.patch | ||
101-13-pinctrl-mediatek-fix-the-return-value-in-driving-con.patch | ||
101-14-pinctrl-mediatek-add-pinmux_set-ops-support.patch | ||
101-15-pinctrl-mediatek-add-pinctrl-driver-for-MT7988-SoC.patch | ||
101-16-net-mediatek-connect-switch-to-PSE-only-when-startin.patch | ||
101-17-net-mediatek-optimize-the-switch-reset-delay-wait-ti.patch | ||
101-18-net-mediatek-fix-direct-MDIO-clause-45-access-via-So.patch | ||
101-19-net-mediatek-add-missing-static-qualifier.patch | ||
101-20-net-mediatek-add-support-for-SGMII-1Gbps-auto-negoti.patch | ||
101-21-arm-dts-medaitek-convert-gmac-link-mode-to-2500base-.patch | ||
101-22-net-mediatek-add-support-for-GMAC-USB3-PHY-mux-mode-.patch | ||
101-23-arm-dts-mediatek-add-infracfg-registers-to-support-G.patch | ||
101-24-net-mediatek-add-USXGMII-support.patch | ||
101-25-net-mediatek-add-support-for-NETSYS-v3.patch | ||
101-26-net-mediatek-add-support-for-MediaTek-MT7988-SoC.patch | ||
101-27-tools-mtk_image-use-uint32_t-for-ghf-header-magic-an.patch | ||
101-28-arm-mediatek-add-support-for-MediaTek-MT7988-SoC.patch | ||
101-29-board-mediatek-add-MT7988-reference-boards.patch | ||
102-ram-mediatek-include-linux-sizes.h-for-SZ_-macros.patch | ||
103-mt7988-enable-pstore.patch | ||
105-configs-add-usefull-stuff-to-mt7988-rfb.patch | ||
106-configs-sync-mt7981-rfb-storage.patch | ||
107-configs-add-useful-options-to-mt7981-rfb.patch | ||
108-dts-arm64-mt7981-rfb-add-mtd-partitions.patch | ||
110-no-kwbimage.patch | ||
120-use-xz-instead-of-lzma.patch | ||
130-fix-mkimage-host-build.patch | ||
131-spi-mtk_spim-prevent-global-pll-clock-override.patch | ||
200-cmd-add-imsz-and-imszb.patch | ||
211-cmd-bootmenu-custom-title.patch | ||
220-cmd-env-readmem.patch | ||
230-cmd-add-pstore-check.patch | ||
280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch | ||
300-force-pylibfdt-build.patch | ||
301-mt7622-generic-reset-button-ignore-env.patch | ||
302-mt7623-generic-reset-button-ignore-env.patch | ||
303-mt7986-generic-reset-button-ignore-env.patch | ||
304-mt7981-generic-reset-button-ignore-env.patch | ||
305-mt7988-generic-reset-button-ignore-env.patch | ||
400-update-bpir2-defconfig.patch | ||
401-update-u7623-defconfig.patch | ||
402-update-bananapi-bpi-r64-device-tree.patch | ||
403-add-bananapi_bpi-r64-snand.patch | ||
404-add-bananapi_bpi-r64_defconfigs.patch | ||
405-dts-mt7623n-bpi-r2-fix-leds.patch | ||
406-dts-mt7623n-bpi-r2-uart0-force-highspeed.patch | ||
410-add-linksys-e8450.patch | ||
412-add-ubnt-unifi-6-lr.patch | ||
420-add-support-for-RAVPower-RP-WD009.patch | ||
430-add-bpi-r3.patch | ||
431-add-xiaomi_redmi-ax6000.patch | ||
432-add-tplink-xdr608x.patch | ||
433-add-qihoo_360t7.patch | ||
434-add-xiaomi_mi-router-wr30u.patch | ||
435-add-h3c_magic-nx30-pro.patch | ||
436-add-glinet-mt6000.patch | ||
437-add-cmcc_rax3000m.patch | ||
438-add-jcg_q30-pro.patch | ||
439-add-zyxel_ex5601-t0.patch | ||
440-add-xiaomi_mi-router-ax3000t.patch | ||
500-board-mt7623-fix-mmc-detect.patch |