0%

更新开发者版本固件

更新至最新的官方稳定版固件

  • 文件:miwifi_r3g_firmware_9be74_2.28.44.bin
  • 系统版本:2.28.44

更新至官方的开发者版本固件

  • 文件:miwifi_r3g_firmware_12f97_2.25.124.bin
  • 系统版本:2.25.124

开启 ssh 权限

  • 下载 MiWiFi App,登录小米账号
  • 绑定 小米路由器 至 小米账号
  • 在小米开放平台申请 ssh 权限,小米开放平台地址:https://www.miwifi.com/miwifi_open.html
  • 下载工具包,每台路由器对应的 miwifi_ssh.bin 文件不一样,不通用

开启流程

  • 确保 U 盘是 FAT 或者 FAT32 格式
  • 将 miwifi_ssh.bin 文件放入 U 盘根目录
  • 断开路由器电源,插上 U 盘,按住 reset 按钮,重新插电启动路由器,等待指示灯变成黄色闪烁状态,松开 reset 按钮
  • 等待路由器重启

ssh 进入路由器

1
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-dss -oCiphers=+3des-cbc root@192.168.31.1

刷入 breed 引导

  • breed 固件下载地址:https://breed.hackpascal.net/
  • 下载 breed-mt7621-xiaomi-r3g.bin 文件
  • 将 U 盘拔出,在 U 盘新建 Breed 目录,将下载的 breed-mt7621-xiaomi-r3g.bin 文件放入 U 盘 Breed 目录
  • 将 U 盘插回路由器
1
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-dss -oCiphers=+3des-cbc root@192.168.31.1
1
mtd write -r /extdisks/sda1/Breed/breed-mt7621-xiaomi-r3g.bin Bootloader
1
2
3
4
5
6
root@XiaoQiang:/# cd /extdisks/sda1/Breed
root@XiaoQiang:/extdisks/sda1/Breed# mtd write -r /extdisks/sda1/Breed/breed-mt7621-xiaomi-r3g.bin Bootloader
Unlocking Bootloader ...

Writing from /extdisks/sda1/Breed/breed-mt7621-xiaomi-r3g.bin to Bootloader ...
Rebooting ...
  • 路由器重启,并且开始闪烁蓝灯
  • 访问 breed 后台,地址:http://192.168.1.1

刷入 openwrt 固件

  • 访问 breed 后台,地址:http://192.168.1.1
  • 环境变量变量编辑,删除 normal_firmware_md5,增加下面内容:
    • 字段:xiaomi.r3g.bootfw
    • 值:2
  • 上传 openwrt 固件
  • 刷入 openwrt
  • 重启,刷入完成
  • 访问 openwrt 后台,地址:http://192.168.1.1

参考文档

normal_firmware_md5
4e166618cd0d7282feeebabadcdd8d3b

新建区分大小写的 APFS 宗卷

磁盘工具 -> 新建

  • 名称:Develop
  • 格式:APFS(区分大小写)

新建的分区在 /Volumes 目录下

安装编译所需依赖

安装 Homebrew

安装前打开代理工具,并开启增强模式。

1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

在终端的配置文件中增加环境变量:

如果使用的终端是 zsh,使用 vim ~/.zshrc;如果使用的终端是 bash,使用 vim ~/.bash_profile

1
2
export PATH=/opt/homebrew/bin:$PATH
export PATH=/opt/homebrew/sbin:$PATH

使环境变量生效:

如果使用的终端是 zsh,使用 vim ~/.zshrc;如果使用的终端是 bash,使用 vim ~/.bash_profile

1
brew -v

终端输出 Homebrew 4.2.11 版本号,说明安装成功。

安装依赖

1
2
brew unlink awk
brew install coreutils diffutils findutils gawk gnu-getopt gnu-tar grep make ncurses pkg-config wget quilt xz python-psutil

添加环境变量

如果使用的终端是 zsh,使用 vim ~/.zshrc;如果使用的终端是 bash,使用 vim ~/.bash_profile

添加以下内容:

1
2
3
4
5
6
7
8
export PATH=/opt/homebrew/opt/make/libexec/gnubin:$PATH
export PATH=/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH
export PATH=/opt/homebrew/opt/findutils/libexec/gnubin:$PATH
export PATH=/opt/homebrew/opt/gnu-getopt/bin:$PATH
export PATH=/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH
export PATH=/opt/homebrew/opt/grep/libexec/gnubin:$PATH
export PATH=/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH
export PATH=/opt/homebrew/opt/make/libexec/gnubin:$PATH

使添加的环境变量生效

如果使用的终端是 zsh,使用 source ~/.zshrc;如果使用的终端是 bash,使用 source ~/.bash_profile

克隆并编译 OpenWrt

克隆 openwrt 源码

在新建的 APFS 分区中克隆 openwrt 源码:

1
2
cd /Volumes/Develop
git clone --depth=1 https://github.com/openwrt/openwrt.git

为 openwrt 增加常用插件

openwrt/package/ 目录下增加 my-package 目录,用于保存自己新增的插件。

1
2
cd openwrt
mkdir -p ./package/my-package

增加 OpenClash 插件

  • 克隆 OpenClash 插件源码时,一定要增加 --depth=1 参数。
1
2
cd ./package/my-package
git clone --depth=1 https://github.com/vernesong/OpenClash.git

更新并安装配置

回到 openwrt 目录

1
2
./scripts/feeds update -a
./scripts/feeds install -a

配置 openwrt

openwrt 目录

1
make menuconfig

Target System (MediaTek Ralink MIPS)
Subtarget (MT7621 based boards)
Target Profile (Xiaomi Mi Router 3G)

Base system —>

如果增加了 OpenClash 插件,在 LuCI 中选中 luci-app-openclash 时,会默认增加dnsmasq-full,此时需要取消选中 dnsmasq,不然编译时会提示重复,出现编译错误。

< > dnsmasq………………………………………. DNS and DHCP server

LuCI —>

  1. Collections

<> luci………………. LuCI interface with Uhttpd as Webserver (default)
-
- luci-light…………… LuCI interface with Uhttpd as Webserver (light)

  1. Modules

Translations —>
<*> Chinese Simplified (zh_Hans)

<> luci-compat…………………………… LuCI compatibility libraries
-
- luci-lua-runtime………………………… LuCI Lua runtime libraries

<*> luci-mod-dashboard……………………………. LuCI Dashboard Pages

  1. Applications

<*> luci-app-openclash………………………….. LuCI support for clash

  1. Themes
  2. Protocols
  3. Libraries

Utilities —>

Editors —>
<*> vim-full………………….. Vi IMproved - enhanced vi editor (Normal)

Shells —>
<*> zsh…………………………………………………. The Z shell

编译

1
make -j$(nproc) V=s

重新编译

openwrt 目录

1
2
3
rm -rf ./tmp && rm -rf .config
make menuconfig
make -j10 V=s

参考

更新

1
2
3
4
5
6
7
8
9
10
11
gg@RaspberryPi:~ $ sudo apt update
Hit:1 https://mirrors.tuna.tsinghua.edu.cn/debian bullseye InRelease
Get:2 https://mirrors.tuna.tsinghua.edu.cn/debian bullseye-updates InRelease [44.1 kB]
Get:3 https://mirrors.tuna.tsinghua.edu.cn/debian bullseye-backports InRelease [49.0 kB]
Hit:4 https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security InRelease
Hit:5 https://mirrors.tuna.tsinghua.edu.cn/raspberrypi bullseye InRelease
Fetched 93.0 kB in 2s (51.8 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
阅读全文 »

OpenWrt

编译 OpenWrt

PVE 安装 Synology NAS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# 解压文件
root@HomeLab:~/files# unzip arpl-1.1-beta2a.img.zip
Archive: arpl-1.1-beta2a.img.zip
inflating: arpl.img
root@HomeLab:~/files# ls -lt
total 2361440
-rw-r--r-- 1 root root 135880678 Mar 4 15:06 arpl-1.1-beta2a.img.zip
-rw-r--r-- 1 root root 1073741824 Feb 28 01:33 arpl.img
-rw-r--r-- 1 root root 1208483840 Feb 25 22:11 openwrt-x86-64-generic-ext4-combined.img
# 挂载镜像文件
root@HomeLab:~/files# qm importdisk 101 /root/files/arpl.img local-lvm
importing disk '/root/files/arpl.img' to VM 101 ...
Logical volume "vm-101-disk-0" created.
transferred 0.0 B of 1.0 GiB (0.00%)
transferred 12.0 MiB of 1.0 GiB (1.17%)
transferred 24.0 MiB of 1.0 GiB (2.34%)
transferred 36.0 MiB of 1.0 GiB (3.52%)
transferred 48.0 MiB of 1.0 GiB (4.69%)
transferred 60.0 MiB of 1.0 GiB (5.86%)
transferred 72.0 MiB of 1.0 GiB (7.03%)
transferred 84.0 MiB of 1.0 GiB (8.20%)
transferred 96.1 MiB of 1.0 GiB (9.38%)
transferred 108.0 MiB of 1.0 GiB (10.55%)
transferred 120.0 MiB of 1.0 GiB (11.72%)
transferred 132.0 MiB of 1.0 GiB (12.89%)
transferred 144.0 MiB of 1.0 GiB (14.06%)
transferred 156.0 MiB of 1.0 GiB (15.23%)
transferred 168.0 MiB of 1.0 GiB (16.41%)
transferred 180.0 MiB of 1.0 GiB (17.58%)
transferred 192.0 MiB of 1.0 GiB (18.75%)
transferred 204.0 MiB of 1.0 GiB (19.92%)
transferred 216.0 MiB of 1.0 GiB (21.09%)
transferred 228.0 MiB of 1.0 GiB (22.27%)
transferred 240.0 MiB of 1.0 GiB (23.44%)
transferred 252.0 MiB of 1.0 GiB (24.61%)
transferred 264.0 MiB of 1.0 GiB (25.78%)
transferred 276.0 MiB of 1.0 GiB (26.95%)
transferred 287.9 MiB of 1.0 GiB (28.12%)
transferred 300.0 MiB of 1.0 GiB (29.30%)
transferred 312.0 MiB of 1.0 GiB (30.47%)
transferred 324.0 MiB of 1.0 GiB (31.64%)
transferred 336.0 MiB of 1.0 GiB (32.81%)
transferred 348.0 MiB of 1.0 GiB (33.98%)
transferred 360.0 MiB of 1.0 GiB (35.16%)
transferred 372.0 MiB of 1.0 GiB (36.33%)
transferred 384.0 MiB of 1.0 GiB (37.50%)
transferred 396.0 MiB of 1.0 GiB (38.67%)
transferred 408.0 MiB of 1.0 GiB (39.84%)
transferred 420.0 MiB of 1.0 GiB (41.02%)
transferred 432.0 MiB of 1.0 GiB (42.19%)
transferred 444.0 MiB of 1.0 GiB (43.36%)
transferred 456.0 MiB of 1.0 GiB (44.53%)
transferred 468.0 MiB of 1.0 GiB (45.70%)
transferred 480.1 MiB of 1.0 GiB (46.88%)
transferred 492.0 MiB of 1.0 GiB (48.05%)
transferred 504.0 MiB of 1.0 GiB (49.22%)
transferred 516.0 MiB of 1.0 GiB (50.39%)
transferred 528.0 MiB of 1.0 GiB (51.56%)
transferred 540.0 MiB of 1.0 GiB (52.73%)
transferred 552.0 MiB of 1.0 GiB (53.91%)
transferred 564.0 MiB of 1.0 GiB (55.08%)
transferred 576.0 MiB of 1.0 GiB (56.25%)
transferred 588.0 MiB of 1.0 GiB (57.42%)
transferred 600.0 MiB of 1.0 GiB (58.59%)
transferred 612.0 MiB of 1.0 GiB (59.77%)
transferred 624.0 MiB of 1.0 GiB (60.94%)
transferred 636.0 MiB of 1.0 GiB (62.11%)
transferred 648.0 MiB of 1.0 GiB (63.28%)
transferred 660.0 MiB of 1.0 GiB (64.45%)
transferred 671.9 MiB of 1.0 GiB (65.62%)
transferred 684.0 MiB of 1.0 GiB (66.80%)
transferred 696.0 MiB of 1.0 GiB (67.97%)
transferred 708.0 MiB of 1.0 GiB (69.14%)
transferred 720.0 MiB of 1.0 GiB (70.31%)
transferred 732.0 MiB of 1.0 GiB (71.48%)
transferred 744.0 MiB of 1.0 GiB (72.66%)
transferred 756.0 MiB of 1.0 GiB (73.83%)
transferred 768.0 MiB of 1.0 GiB (75.00%)
transferred 780.0 MiB of 1.0 GiB (76.17%)
transferred 792.0 MiB of 1.0 GiB (77.34%)
transferred 804.0 MiB of 1.0 GiB (78.52%)
transferred 816.0 MiB of 1.0 GiB (79.69%)
transferred 828.0 MiB of 1.0 GiB (80.86%)
transferred 840.0 MiB of 1.0 GiB (82.03%)
transferred 852.0 MiB of 1.0 GiB (83.20%)
transferred 864.1 MiB of 1.0 GiB (84.38%)
transferred 876.0 MiB of 1.0 GiB (85.55%)
transferred 888.0 MiB of 1.0 GiB (86.72%)
transferred 900.0 MiB of 1.0 GiB (87.89%)
transferred 912.0 MiB of 1.0 GiB (89.06%)
transferred 924.0 MiB of 1.0 GiB (90.23%)
transferred 936.0 MiB of 1.0 GiB (91.41%)
transferred 948.0 MiB of 1.0 GiB (92.58%)
transferred 960.0 MiB of 1.0 GiB (93.75%)
transferred 972.0 MiB of 1.0 GiB (94.92%)
transferred 984.0 MiB of 1.0 GiB (96.09%)
transferred 996.0 MiB of 1.0 GiB (97.27%)
transferred 1008.0 MiB of 1.0 GiB (98.44%)
transferred 1020.0 MiB of 1.0 GiB (99.61%)
transferred 1.0 GiB of 1.0 GiB (100.00%)
transferred 1.0 GiB of 1.0 GiB (100.00%)
Successfully imported disk as 'unused0:local-lvm:vm-101-disk-0'