OpenWRT 的官网只有详细的小米路由器 3G(第一代,使用的是 NAND Flash 并带 USB 接口) 和 小米路由器 4A 千兆版(硬件和小米路由器 3G V2相同但 bootrom 不一样)详细的刷机教程: MIR 3G 和 mi_router_4a_gigabit_edition。
我试着使用 4A 千兆版刷 3G V2后(使用命令:mtd -e OS1 -r write openwrt.bin OS1),直接变砖,串口提示:
## Booting image at bc180000 ...
Image Name: MIPS OpenWrt Linux-6.6.73
Image Type: MIPS Linux Kernel Image (uncompressed)
Data Size: 3180869 Bytes = 3 MB
Load Address: 80001000
Entry Point: 80001000
Verifying Checksum ... Bad Data CRC
我试着使用另一种方式,将 uboot 的环境变量进行修改,将 uboot 的串口交互开启(环境变量中的 boot_wait
off 修改成 on)。然后使用 uboot 启动 initramfs 后,进入 web 网页升级。这样刷 OpenWRT 可以成功。
下面是步骤:
- 使用 OpenWRTInvasion 工具,使得路由器的 telent 和 ftp 生效(详见:mi_router_4a_gigabit_edition)
- 使用命令 dd if=/dev/mtdXXX of=/var/mtd.bin (mtdXXX 需要通过命令 cat /proc/mtd 找到 Config 区,记得是 mtd2)
- 找一台串口 uboot 交互可用的路由器,将 mtd.bin 文件导入到其 uboot 环境区(注意做好原 uboot 环境变量的备份)
- 修改环境变量中的 boot_wait 从 off 修改为 on
- 导出文件,文件名为mtd2_mod.bin
- 将 mtd2_mod.bin 烧录回 3G V2 路由器
mtd -e Config -r write mtd2_mod.bin Config
- 此时 3G V2 的 uboot 串口交互可打开,通过命令 1 启动下载 initramfs,在 web 网页中升级即可。