运营商送的是华为的路由器,这个路由器性能还是不错,但是可玩性不足,于是购入了红米AX6s,刷入OpenWrt,来跑一些服务。
下面记录一下OpenWrt的刷入过程:
升级OpenWrt
1.升级开发版固件
登录红米 AX6S 的后台(一般是:192.168.31.1),点击右上角选择-系统升级-选择手动升级,勾选下载好的「内测版」固件,点击开始升级。
2.计算SSH密码
#!/usr/bin/env python3
import sys
import hashlib
if sys.version_info < (3,7):
print("python version is not supported", file=sys.stderr)
sys.exit(1)
# credit goes to zhoujiazhao:
# https://blog.csdn.net/zhoujiazhao/article/details/102578244
salt = {'r1d': 'A2E371B0-B34B-48A5-8C40-A7133F3B5D88',
'others': 'd44fb0960aa0-a5e6-4a30-250f-6d2df50a'}
def get_salt(sn):
if "/" not in sn:
return salt["r1d"]
return "-".join(reversed(salt["others"].split("-")))
def calc_passwd(sn):
passwd = sn + get_salt(sn)
m = hashlib.md5(passwd.encode())
return m.hexdigest()[:8]
if __name__ == "__main__":
if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} <S/N>")
sys.exit(1)
serial = sys.argv[1]
print(calc_passwd(serial))
3.telnet 连接开启 ssh
用root和计算得到的密码telnet上去,输入以下代码:
nvram set ssh_en=1 & nvram set uart_en=1 & nvram set boot_wait=on & nvram set bootdelay=3 & nvram set flag_try_sys1_failed=0 & nvram set flag_try_sys2_failed=1
nvram set flag_boot_rootfs=0 & nvram set "boot_fw1=run boot_rd_img;bootm"
nvram set flag_boot_success=1 & nvram commit & /etc/init.d/dropbear enable & /etc/init.d/dropbear start
4.SSH上去刷入底包
cd /tmp
curl -L https://sebs.oss-cn-shanghai.aliyuncs.com/factory.bin -o factory.bin
mtd -r write /tmp/factory.bin firmware
当然,我是自己编译的原生OpenWrt,这个后面写文章单独说。
Pingback引用通告: 客厅折腾系列 | Bigtan's Blog