0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2025-09-25 16:12:32 +00:00
Files
Fil Dunsky 150f181700 mediatek: add Huasifei WH3000 Pro support
**Huasifei WH3000 Pro**
Portable Wi-Fi 6 travel router based on MediaTek MT7981A SoC. MT7981B+MT7976CN+RTL8221B Dual Core 1.3GHZ with 5G modems module and PWM Fan.

**Specifications**
SoC: Filogic 820 MT7981A (1.3GHz)
RAM: DDR4 1GB
Flash: eMMC 8GB
WiFi: 2.4GHz and 5GHz with 3 antennas
Ethernet:
1x WAN (10/100/1000M)
1x LAN (10/100/1000/2500M)
USB: 1x USB 3.0 port
Two buttons: power/reset and mode (BTN_0)
LEDS: blue, red, blue+red=pink
UART: 3.3V, TX, RX, GND / 115200 8N1

**Installation via U-Boot rescue**
1. Set static IP 192.168.1.2 on your computer and default route as 192.168.1.1
2. Connect to the WAN port and hold the reset button while booting the device.
3. Wait for the LED to blink 5 times, and release the reset button.
4. Open U-boot web page on your browser at http://192.168.1.1
5. Select the OpenWRT sysupgrade image, upload it, and start the upgrade.
6. Wait for the router to flash the new firmware.
7. Wait for the router to reboot itself.

**Installation via sysupgrade**
Just flash sysupgrade file via [LuCI upgrade page](http://192.168.1.1/cgi-bin/luci/admin/system/flash) without saving the settings.

**Installation via SSH**
Upload the file to the router `/tmp` directory, `ssh root@192.168.1.1` and issue a command:
```
sysupgrade -n /tmp/openwrt-mediatek-filogic-huasifei_wh3000-pro-squashfs-sysupgrade.bin
```

**Factory MAC**
You can find your Factory MAC which is mentioned on the box at `/dev/mmcblck0p2` partition `factory` starting from `0x4`
```
dd if=/dev/mmcblk0p2 bs=1 skip=4 count=6 | hexdump -C
```

Cherry-picked from 949d0bd77a

Fixed `green` to `blue` LED in dts, added `SUPPORTED_DEVICES += huasifei,fudy-pro` - to make sysupgrade compatible with factory QWRT/Lede fork firmware.

Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/19315
(cherry picked from commit db1de8d21f)
Link: https://github.com/openwrt/openwrt/pull/19391
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-07-22 00:16:25 +02:00

267 lines
5.2 KiB
Bash
Executable File

REQUIRE_IMAGE_METADATA=1
RAMFS_COPY_BIN='fitblk'
asus_initial_setup()
{
# initialize UBI if it's running on initramfs
[ "$(rootfs_type)" = "tmpfs" ] || return 0
ubirmvol /dev/ubi0 -N rootfs
ubirmvol /dev/ubi0 -N rootfs_data
ubirmvol /dev/ubi0 -N jffs2
ubimkvol /dev/ubi0 -N jffs2 -s 0x3e000
}
xiaomi_initial_setup()
{
# initialize UBI and setup uboot-env if it's running on initramfs
[ "$(rootfs_type)" = "tmpfs" ] || return 0
local mtdnum="$( find_mtd_index ubi )"
if [ ! "$mtdnum" ]; then
echo "unable to find mtd partition ubi"
return 1
fi
local kern_mtdnum="$( find_mtd_index ubi_kernel )"
if [ ! "$kern_mtdnum" ]; then
echo "unable to find mtd partition ubi_kernel"
return 1
fi
ubidetach -m "$mtdnum"
ubiformat /dev/mtd$mtdnum -y
ubidetach -m "$kern_mtdnum"
ubiformat /dev/mtd$kern_mtdnum -y
if ! fw_printenv -n flag_try_sys2_failed &>/dev/null; then
echo "failed to access u-boot-env. skip env setup."
return 0
fi
fw_setenv -s - <<-EOF
boot_wait on
uart_en 1
flag_boot_rootfs 0
flag_last_success 1
flag_boot_success 1
flag_try_sys1_failed 8
flag_try_sys2_failed 8
EOF
local board=$(board_name)
case "$board" in
xiaomi,mi-router-ax3000t|\
xiaomi,mi-router-wr30u-stock)
fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),34816k(ubi),34816k(ubi1),32768k(overlay),12288k(data),256k(KF)"
;;
xiaomi,redmi-router-ax6000-stock)
fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),30720k(ubi),30720k(ubi1),51200k(overlay)"
;;
esac
}
platform_do_upgrade() {
local board=$(board_name)
case "$board" in
abt,asr3000|\
bananapi,bpi-r3|\
bananapi,bpi-r3-mini|\
bananapi,bpi-r4|\
bananapi,bpi-r4-poe|\
cmcc,a10-ubootmod|\
cmcc,rax3000m|\
cudy,tr3000-v1-ubootmod|\
gatonetworks,gdsp|\
h3c,magic-nx30-pro|\
jcg,q30-pro|\
jdcloud,re-cp-03|\
mediatek,mt7981-rfb|\
mediatek,mt7988a-rfb|\
mercusys,mr90x-v1-ubi|\
netis,nx31|\
nokia,ea0326gmp|\
openwrt,one|\
netcore,n60|\
qihoo,360t7|\
routerich,ax3000-ubootmod|\
tplink,tl-xdr4288|\
tplink,tl-xdr6086|\
tplink,tl-xdr6088|\
tplink,tl-xtr8488|\
xiaomi,mi-router-ax3000t-ubootmod|\
xiaomi,redmi-router-ax6000-ubootmod|\
xiaomi,mi-router-wr30u-ubootmod|\
zyxel,ex5601-t0-ubootmod)
fit_do_upgrade "$1"
;;
acer,predator-w6|\
acer,predator-w6d|\
acer,vero-w6m|\
arcadyan,mozart|\
glinet,gl-mt2500|\
glinet,gl-mt6000|\
glinet,gl-x3000|\
glinet,gl-xe3000|\
huasifei,wh3000|\
huasifei,wh3000-pro|\
smartrg,sdg-8612|\
smartrg,sdg-8614|\
smartrg,sdg-8622|\
smartrg,sdg-8632|\
smartrg,sdg-8733|\
smartrg,sdg-8733a|\
smartrg,sdg-8734)
CI_KERNPART="kernel"
CI_ROOTPART="rootfs"
emmc_do_upgrade "$1"
;;
asus,rt-ax52|\
asus,rt-ax59u|\
asus,tuf-ax4200|\
asus,tuf-ax6000)
CI_UBIPART="UBI_DEV"
CI_KERNPART="linux"
nand_do_upgrade "$1"
;;
cudy,wr3000h-v1)
CI_UBIPART="ubi"
nand_do_upgrade "$1"
;;
cudy,re3000-v1|\
cudy,wr3000-v1|\
yuncore,ax835|\
wavlink,wl-wn573hx3)
default_do_upgrade "$1"
;;
dlink,aquila-pro-ai-m30-a1|\
dlink,aquila-pro-ai-m60-a1)
fw_setenv sw_tryactive 0
nand_do_upgrade "$1"
;;
mercusys,mr80x-v3|\
mercusys,mr90x-v1|\
tplink,archer-ax80-v1|\
tplink,re6000xd)
CI_UBIPART="ubi0"
nand_do_upgrade "$1"
;;
ubnt,unifi-6-plus)
CI_KERNPART="kernel0"
EMMC_ROOT_DEV="$(cmdline_get_var root)"
emmc_do_upgrade "$1"
;;
unielec,u7981-01*)
local rootdev="$(cmdline_get_var root)"
rootdev="${rootdev##*/}"
rootdev="${rootdev%p[0-9]*}"
case "$rootdev" in
mmc*)
CI_ROOTDEV="$rootdev"
CI_KERNPART="kernel"
CI_ROOTPART="rootfs"
emmc_do_upgrade "$1"
;;
*)
CI_KERNPART="fit"
nand_do_upgrade "$1"
;;
esac
;;
xiaomi,mi-router-ax3000t|\
xiaomi,mi-router-wr30u-stock|\
xiaomi,redmi-router-ax6000-stock)
CI_KERN_UBIPART=ubi_kernel
CI_ROOT_UBIPART=ubi
nand_do_upgrade "$1"
;;
*)
nand_do_upgrade "$1"
;;
esac
}
PART_NAME=firmware
platform_check_image() {
local board=$(board_name)
local magic="$(get_magic_long "$1")"
[ "$#" -gt 1 ] && return 1
case "$board" in
bananapi,bpi-r3|\
bananapi,bpi-r3-mini|\
bananapi,bpi-r4|\
bananapi,bpi-r4-poe|\
cmcc,rax3000m)
[ "$magic" != "d00dfeed" ] && {
echo "Invalid image type."
return 1
}
return 0
;;
*)
nand_do_platform_check "$board" "$1"
return $?
;;
esac
return 0
}
platform_copy_config() {
case "$(board_name)" in
bananapi,bpi-r3|\
bananapi,bpi-r3-mini|\
bananapi,bpi-r4|\
bananapi,bpi-r4-poe|\
cmcc,rax3000m)
if [ "$CI_METHOD" = "emmc" ]; then
emmc_copy_config
fi
;;
acer,predator-w6|\
acer,predator-w6d|\
acer,vero-w6m|\
arcadyan,mozart|\
glinet,gl-mt2500|\
glinet,gl-mt6000|\
glinet,gl-x3000|\
glinet,gl-xe3000|\
huasifei,wh3000|\
huasifei,wh3000-pro|\
jdcloud,re-cp-03|\
smartrg,sdg-8612|\
smartrg,sdg-8614|\
smartrg,sdg-8622|\
smartrg,sdg-8632|\
smartrg,sdg-8733|\
smartrg,sdg-8733a|\
smartrg,sdg-8734|\
ubnt,unifi-6-plus)
emmc_copy_config
;;
esac
}
platform_pre_upgrade() {
local board=$(board_name)
case "$board" in
asus,rt-ax52|\
asus,rt-ax59u|\
asus,tuf-ax4200|\
asus,tuf-ax6000)
asus_initial_setup
;;
xiaomi,mi-router-ax3000t|\
xiaomi,mi-router-wr30u-stock|\
xiaomi,redmi-router-ax6000-stock)
xiaomi_initial_setup
;;
esac
}