一、解锁ssh
CR660X刷机风险较大,所以要先解锁ssh telnet uart这些,防止刷坏
1、设置路由器
破解CR660X路由器需要另一台路由器辅助,这里使用openwrt系统的路由器进行操作(因为比较方便)
(1)准备一台已经刷好Openwrt系统的路由器,使用ssh/uart登录上去
输入cd /usr/lib/lua/luci/controller/admin/
然后vi xqsystem.lua
将下面的代码复制进去
module("luci.controller.admin.xqsystem", package.seeall)
function index()
local page = node("api")
page.target = firstchild()
page.title = ("")
page.order = 100
page.index = true
page = node("api","xqsystem")
page.target = firstchild()
page.title = ("")
page.order = 100
page.index = true
entry({"api", "xqsystem", "token"}, call("getToken"), (""), 103, 0x08)
end
local LuciHttp = require("luci.http")
function getToken()
local result = {}
result["code"] = 0
result["token"] = "; nvram set ssh_en=1; nvram commit; sed -i 's/channel=.*/channel=\"debug\"/g' /etc/init.d/dropbear; /etc/init.d/dropbear start;"
LuciHttp.write_json(result)
end
当然这一步也可以在电脑上创建好上传到对应的目录。
(2)关闭当前路由器的dhcp功能,设置网关IP为169.254.31.1
同时需要更改wifi密码,保证不会有设备连接到该路由器。5G和2.4G不要使用同一个ssid
(3)访问http://169.254.31.1/cgi-bin/luci/api/xqsystem/token
正常显示即成功
{"token":"; nvram set ssh_en=1; nvram commit; sed -i 's\/channel=.*\/channel=\"debug\"\/g' \/etc\/init.d\/dropbear; \/etc\/init.d\/dropbear start;","code":0}
2、设置CR660X
(1)获取token
使用密码登录到路由器后台,地址栏即显示
(2)设置ssh
将下面这一条的<stok>
ssid
password
换成你的,然后复制到地址栏回车
http://192.168.10.1/cgi-bin/luci/;stok=<stok>/api/misystem/extendwifi_connect?ssid=openwrt&password=12345678
返回{"msg":"connect succces!","code":0}
之后执行下一条,将下面这一条的<stok>
换成你的 注意 xxx不用修改
http://192.168.10.1/cgi-bin/luci/;stok=<stok>/api/xqsystem/oneclick_get_remote_token?username=xxx&password=xxx&nonce=xxx
返回 这里如果出现问题检查上面的步骤是否出错,或者连接5Gwifi试一下
{"token":"; nvram set ssh_en=1; nvram commit; sed -i 's/channel=.*/channel=\u0022debug\u0022/g' /etc/init.d/dropbear; /etc/init.d/dropbear start;","code":0}
(3)固化
现在不要重启路由器,直接ssh登录,用户名的root,密码是路由器背面印的登录密码
进入后输入
nvram set boot_wait=on
nvram set bootdelay=5
nvram set uart_en=1
nvram set telnet_en=1
nvram set ssh_en=1
nvram commit
(4)备份
使用mtd工具备份分区并下载到本地
dd if=/dev/mtd0 of=/tmp/bootloader.bin
或者
nanddump /dev/mtd0 -f /tmp/bootloader.img
推荐全备份
二、刷openwrt
将编译好的firmware.bin和overlay.bin刷入到firmware和overlay即可
老毛子只需要刷到firmware
mtd write /tmp/openwrt-ramips-mt7621-xiaomi_mi-router-cr6606-squashfs-firmware.bin firmware
mtd -r write /tmp/openwrt-ramips-mt7621-xiaomi_mi-router-cr6606-squashfs-overlay.bin overlay
转自 openting.cn