tn3399_openwrt/package/boot/uboot-envtools/files/mediatek_filogic
Chukun Pan 641e4f2f04 mediatek: add Xiaomi Redmi Router AX6000 support
Hardware specification:
  SoC: MediaTek MT7986A 4x A53
  Flash: ESMT F50L1G41LB 128 MB
  RAM: K4A4G165WF-BCWE 512 MB
  Ethernet: 4x 10/100/1000 Mbps
  WiFi1: MT7976GN 2.4GHz ax 4x4
  WiFi2: MT7976AN 5GHz ax 4x4
  Button: Mesh, Reset

Flash instructions:
  1. Gain ssh and serial port access, see the link below:
     https://openwrt.org/toh/xiaomi/redmi_ax6000#installation
  2. Use ssh or serial port to log in to the router, and
     execute the following command:
     nvram set boot_wait=on
     nvram set flag_boot_rootfs=0
     nvram set flag_boot_success=1
     nvram set flag_last_success=1
     nvram set flag_try_sys1_failed=8
     nvram set flag_try_sys2_failed=8
     nvram commit
  3. Set a static ip on the ethernet interface of your computer
     (e.g. default: ip 192.168.31.100, gateway 192.168.31.1)
  4. Download the initramfs image, rename it to initramfs.bin,
     and host it with the tftp server.
  5. Interrupt U-Boot and run these commands:
     setenv mtdparts nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),112640k(ubi)
     saveenv
     tftpboot initramfs.bin
     bootm
  6. After openwrt boots up, use scp or luci web
     to upload sysupgrade.bin to upgrade.

Revert to stock firmware:
  Restore mtdparts back to default, then use the
  vendor's recovery tool (Windows only).

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2022-10-30 14:30:22 +00:00

47 lines
1.2 KiB
Plaintext

#
# Copyright (C) 2021 OpenWrt.org
#
[ -e /etc/config/ubootenv ] && exit 0
touch /etc/config/ubootenv
. /lib/uboot-envtools.sh
. /lib/functions.sh
board=$(board_name)
case "$board" in
bananapi,bpi-r3)
case "$(cmdline_get_var root)" in
/dev/mmc*)
local envdev=$(find_mmc_part "ubootenv" $rootdev)
ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
;;
/dev/mtd*)
local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1"
;;
/dev/ubi*)
. /lib/upgrade/nand.sh
local envubi=$(nand_find_ubi ubi)
local envdev=/dev/$(nand_find_volume $envubi ubootenv)
local envdev2=/dev/$(nand_find_volume $envubi ubootenv2)
ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x1f000" "1"
ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x1f000" "1"
;;
esac
;;
xiaomi,redmi-router-ax6000)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
ubootenv_add_uci_sys_config "/dev/mtd2" "0x0" "0x10000" "0x20000"
;;
esac
config_load ubootenv
config_foreach ubootenv_add_app_config
exit 0