Mirror only - Please move to https://github.com/immortalwrt/immortalwrt
修訂 | 5ef0e58d80d1d78bcac036a7ca911b881ca771bc (tree) |
---|---|
時間 | 2023-01-30 00:20:15 |
作者 | Dmitry Sokolov <e323w@prot...> |
Commiter | Tianling Shen |
ramips: mt7621: add support for Xiaomi Mi Router 4A Gigabit v2
Device is the same as Xiaomi Mi Router 4A Gigabit, except of:
- 5G WiFi is MT7663
- addresses of leds, wifi and eth ports are slightly changed
Specs:
MAC addresses:
Installation:
Factory firmware is based on a custom OpenWrt 17.x.
Installation is the same as for Xiaomi Mi Router 4A Gigabit.
Probably the easiest way to install is to use the script from
this repository: https://github.com/acecilia/OpenWRTInvasion/pull/155
In a more advanced case, you can do everything yourself:
- gain access to the device through one of the exploits described
- upload sysupgrade image to /tmp
- overwrite stock firmware:
Recovery:
Recovery procedure is the same as for Xiaomi Mi Router 4A Gigabit.
Possible options can be found here:
https://openwrt.org/inbox/toh/xiaomi/xiaomi_mi_router_4a_gigabit_edition
One of the ways is to use another router with OpenWrt:
- connect both routers by their LAN ports
- download stock firmware from [1]
- place it inside /tmp/test.bin on the main router
- configure PXE/TFTP on the main router
- power off 4Av2, hold Reset button, power on
- as soon as image download via TFTP starts, Reset can be released
- blinking blue wan LED will indicate the end of the flashing process,
[1] http://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/r4av2/miwifi_r4av2_firmware_release_2.30.28.bin
Signed-off-by: Dmitry Sokolov <e323w@proton.me>
(cherry picked from commit 39e4f03fd335d5b5d1259d74fc3f00ad09e7796c)
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
@@ -1,23 +1,12 @@ | ||
1 | 1 | // SPDX-License-Identifier: GPL-2.0-or-later OR MIT |
2 | 2 | |
3 | -#include "mt7621.dtsi" | |
4 | - | |
5 | -#include <dt-bindings/gpio/gpio.h> | |
6 | -#include <dt-bindings/input/input.h> | |
3 | +#include "mt7621_xiaomi_mi-router-4a-common.dtsi" | |
7 | 4 | |
8 | 5 | / { |
9 | 6 | aliases { |
10 | - led-boot = &led_status_yellow; | |
11 | - led-failsafe = &led_status_yellow; | |
12 | - led-running = &led_status_blue; | |
13 | - led-upgrade = &led_status_yellow; | |
14 | 7 | label-mac-device = &wan; |
15 | 8 | }; |
16 | 9 | |
17 | - chosen { | |
18 | - bootargs = "console=ttyS0,115200n8"; | |
19 | - }; | |
20 | - | |
21 | 10 | leds { |
22 | 11 | compatible = "gpio-leds"; |
23 | 12 |
@@ -31,107 +20,16 @@ | ||
31 | 20 | gpios = <&gpio 10 GPIO_ACTIVE_LOW>; |
32 | 21 | }; |
33 | 22 | }; |
34 | - | |
35 | - keys { | |
36 | - compatible = "gpio-keys"; | |
37 | - | |
38 | - reset { | |
39 | - label = "reset"; | |
40 | - gpios = <&gpio 18 GPIO_ACTIVE_LOW>; | |
41 | - linux,code = <KEY_RESTART>; | |
42 | - }; | |
43 | - }; | |
44 | -}; | |
45 | - | |
46 | -&spi0 { | |
47 | - status = "okay"; | |
48 | - | |
49 | - flash@0 { | |
50 | - compatible = "jedec,spi-nor"; | |
51 | - reg = <0>; | |
52 | - spi-max-frequency = <50000000>; | |
53 | - m25p,fast-read; | |
54 | - | |
55 | - partitions { | |
56 | - compatible = "fixed-partitions"; | |
57 | - #address-cells = <1>; | |
58 | - #size-cells = <1>; | |
59 | - | |
60 | - partition@0 { | |
61 | - label = "u-boot"; | |
62 | - reg = <0x0 0x30000>; | |
63 | - read-only; | |
64 | - }; | |
65 | - | |
66 | - partition@30000 { | |
67 | - label = "u-boot-env"; | |
68 | - reg = <0x30000 0x10000>; | |
69 | - read-only; | |
70 | - }; | |
71 | - | |
72 | - partition@40000 { | |
73 | - label = "Bdata"; | |
74 | - reg = <0x40000 0x10000>; | |
75 | - read-only; | |
76 | - }; | |
77 | - | |
78 | - factory: partition@50000 { | |
79 | - label = "factory"; | |
80 | - reg = <0x50000 0x10000>; | |
81 | - read-only; | |
82 | - }; | |
83 | - | |
84 | - partition@60000 { | |
85 | - label = "crash"; | |
86 | - reg = <0x60000 0x10000>; | |
87 | - read-only; | |
88 | - }; | |
89 | - | |
90 | - partition@70000 { | |
91 | - label = "cfg_bak"; | |
92 | - reg = <0x70000 0x10000>; | |
93 | - read-only; | |
94 | - }; | |
95 | - | |
96 | - partition@80000 { | |
97 | - label = "overlay"; | |
98 | - reg = <0x80000 0x100000>; | |
99 | - read-only; | |
100 | - }; | |
101 | - | |
102 | - firmware: partition@180000 { | |
103 | - compatible = "denx,uimage"; | |
104 | - label = "firmware"; | |
105 | - reg = <0x180000 0xe80000>; | |
106 | - }; | |
107 | - }; | |
108 | - }; | |
109 | 23 | }; |
110 | 24 | |
111 | -&pcie { | |
112 | - status = "okay"; | |
25 | +&wifi0 { | |
26 | + mediatek,mtd-eeprom = <&factory 0x8000>; | |
27 | + ieee80211-freq-limit = <5000000 6000000>; | |
113 | 28 | }; |
114 | 29 | |
115 | -&pcie0 { | |
116 | - wifi@0,0 { | |
117 | - compatible = "pci14c3,7662"; | |
118 | - reg = <0x0000 0 0 0 0>; | |
119 | - mediatek,mtd-eeprom = <&factory 0x8000>; | |
120 | - ieee80211-freq-limit = <5000000 6000000>; | |
121 | - }; | |
122 | -}; | |
123 | - | |
124 | -&pcie1 { | |
125 | - wifi@0,0 { | |
126 | - compatible = "pci14c3,7603"; | |
127 | - reg = <0x0000 0 0 0 0>; | |
128 | - mediatek,mtd-eeprom = <&factory 0x0000>; | |
129 | - ieee80211-freq-limit = <2400000 2500000>; | |
130 | - }; | |
131 | -}; | |
132 | - | |
133 | -&gmac0 { | |
134 | - mtd-mac-address = <&factory 0xe000>; | |
30 | +&wifi1 { | |
31 | + mediatek,mtd-eeprom = <&factory 0x0000>; | |
32 | + ieee80211-freq-limit = <2400000 2500000>; | |
135 | 33 | }; |
136 | 34 | |
137 | 35 | &switch0 { |
@@ -153,10 +51,3 @@ | ||
153 | 51 | }; |
154 | 52 | }; |
155 | 53 | }; |
156 | - | |
157 | -&state_default { | |
158 | - gpio { | |
159 | - groups = "jtag", "uart2", "uart3", "wdt"; | |
160 | - function = "gpio"; | |
161 | - }; | |
162 | -}; |
@@ -0,0 +1,123 @@ | ||
1 | +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT | |
2 | + | |
3 | +#include "mt7621.dtsi" | |
4 | + | |
5 | +#include <dt-bindings/gpio/gpio.h> | |
6 | +#include <dt-bindings/input/input.h> | |
7 | + | |
8 | +/ { | |
9 | + aliases { | |
10 | + led-boot = &led_status_yellow; | |
11 | + led-failsafe = &led_status_yellow; | |
12 | + led-running = &led_status_blue; | |
13 | + led-upgrade = &led_status_yellow; | |
14 | + }; | |
15 | + | |
16 | + chosen { | |
17 | + bootargs = "console=ttyS0,115200n8"; | |
18 | + }; | |
19 | + | |
20 | + keys { | |
21 | + compatible = "gpio-keys"; | |
22 | + | |
23 | + reset { | |
24 | + label = "reset"; | |
25 | + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; | |
26 | + linux,code = <KEY_RESTART>; | |
27 | + }; | |
28 | + }; | |
29 | +}; | |
30 | + | |
31 | +&spi0 { | |
32 | + status = "okay"; | |
33 | + | |
34 | + flash@0 { | |
35 | + compatible = "jedec,spi-nor"; | |
36 | + reg = <0>; | |
37 | + spi-max-frequency = <50000000>; | |
38 | + m25p,fast-read; | |
39 | + | |
40 | + partitions: partitions { | |
41 | + compatible = "fixed-partitions"; | |
42 | + #address-cells = <1>; | |
43 | + #size-cells = <1>; | |
44 | + | |
45 | + partition@0 { | |
46 | + label = "u-boot"; | |
47 | + reg = <0x0 0x30000>; | |
48 | + read-only; | |
49 | + }; | |
50 | + | |
51 | + partition@30000 { | |
52 | + label = "u-boot-env"; | |
53 | + reg = <0x30000 0x10000>; | |
54 | + read-only; | |
55 | + }; | |
56 | + | |
57 | + partition@40000 { | |
58 | + label = "Bdata"; | |
59 | + reg = <0x40000 0x10000>; | |
60 | + read-only; | |
61 | + }; | |
62 | + | |
63 | + factory: partition@50000 { | |
64 | + label = "factory"; | |
65 | + reg = <0x50000 0x10000>; | |
66 | + read-only; | |
67 | + }; | |
68 | + | |
69 | + partition@60000 { | |
70 | + label = "crash"; | |
71 | + reg = <0x60000 0x10000>; | |
72 | + read-only; | |
73 | + }; | |
74 | + | |
75 | + partition@70000 { | |
76 | + label = "cfg_bak"; | |
77 | + reg = <0x70000 0x10000>; | |
78 | + read-only; | |
79 | + }; | |
80 | + | |
81 | + partition@80000 { | |
82 | + label = "overlay"; | |
83 | + reg = <0x80000 0x100000>; | |
84 | + read-only; | |
85 | + }; | |
86 | + | |
87 | + firmware: partition@180000 { | |
88 | + compatible = "denx,uimage"; | |
89 | + label = "firmware"; | |
90 | + reg = <0x180000 0xe80000>; | |
91 | + }; | |
92 | + }; | |
93 | + }; | |
94 | +}; | |
95 | + | |
96 | +&pcie { | |
97 | + status = "okay"; | |
98 | +}; | |
99 | + | |
100 | +&pcie0 { | |
101 | + wifi0: wifi@0,0 { | |
102 | + compatible = "mediatek,mt76"; | |
103 | + reg = <0x0000 0 0 0 0>; | |
104 | + }; | |
105 | +}; | |
106 | + | |
107 | +&pcie1 { | |
108 | + wifi1: wifi@0,0 { | |
109 | + compatible = "mediatek,mt76"; | |
110 | + reg = <0x0000 0 0 0 0>; | |
111 | + }; | |
112 | +}; | |
113 | + | |
114 | +&gmac0 { | |
115 | + mtd-mac-address = <&factory 0xe000>; | |
116 | +}; | |
117 | + | |
118 | +&state_default { | |
119 | + gpio { | |
120 | + groups = "jtag", "uart2", "uart3", "wdt"; | |
121 | + function = "gpio"; | |
122 | + }; | |
123 | +}; |
@@ -0,0 +1,79 @@ | ||
1 | +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT | |
2 | + | |
3 | +#include "mt7621_xiaomi_mi-router-4a-common.dtsi" | |
4 | + | |
5 | +/ { | |
6 | + compatible = "xiaomi,mi-router-4a-gigabit-v2", "mediatek,mt7621-soc"; | |
7 | + model = "Xiaomi Mi Router 4A Gigabit Edition v2"; | |
8 | + | |
9 | + aliases { | |
10 | + label-mac-device = &wan; | |
11 | + }; | |
12 | + | |
13 | + leds { | |
14 | + compatible = "gpio-leds"; | |
15 | + | |
16 | + led_status_blue: status_blue { | |
17 | + label = "blue:status"; | |
18 | + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; | |
19 | + }; | |
20 | + | |
21 | + led_status_yellow: status_yellow { | |
22 | + label = "yellow:status"; | |
23 | + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; | |
24 | + }; | |
25 | + | |
26 | + wan_blue { | |
27 | + label = "blue:wan"; | |
28 | + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; | |
29 | + }; | |
30 | + | |
31 | + wan_yellow { | |
32 | + label = "yellow:wan"; | |
33 | + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; | |
34 | + }; | |
35 | + }; | |
36 | +}; | |
37 | + | |
38 | +&partitions { | |
39 | + partition@180000 { | |
40 | + // size changed against to the common dtsi | |
41 | + reg = <0x180000 0xe70000>; | |
42 | + }; | |
43 | + | |
44 | + partition@ff0000 { | |
45 | + label = "Config"; | |
46 | + reg = <0xff0000 0x10000>; | |
47 | + read-only; | |
48 | + }; | |
49 | +}; | |
50 | + | |
51 | +&wifi0 { | |
52 | + mediatek,mtd-eeprom = <&factory 0x0000>; | |
53 | + ieee80211-freq-limit = <2400000 2500000>; | |
54 | +}; | |
55 | + | |
56 | +&wifi1 { | |
57 | + mediatek,mtd-eeprom = <&factory 0x8000>; | |
58 | + ieee80211-freq-limit = <5000000 6000000>; | |
59 | +}; | |
60 | + | |
61 | +&switch0 { | |
62 | + ports { | |
63 | + port@1 { | |
64 | + status = "okay"; | |
65 | + label = "lan1"; | |
66 | + }; | |
67 | + | |
68 | + port@2 { | |
69 | + status = "okay"; | |
70 | + label = "lan2"; | |
71 | + }; | |
72 | + | |
73 | + wan: port@3 { | |
74 | + status = "okay"; | |
75 | + label = "wan"; | |
76 | + mtd-mac-address = <&factory 0xe006>; | |
77 | + }; | |
78 | + }; | |
79 | +}; |
@@ -1564,6 +1564,17 @@ define Device/xiaomi_mi-router-4a-gigabit | ||
1564 | 1564 | endef |
1565 | 1565 | TARGET_DEVICES += xiaomi_mi-router-4a-gigabit |
1566 | 1566 | |
1567 | +define Device/xiaomi_mi-router-4a-gigabit-v2 | |
1568 | + $(Device/dsa-migration) | |
1569 | + $(Device/uimage-lzma-loader) | |
1570 | + IMAGE_SIZE := 14784k | |
1571 | + DEVICE_VENDOR := Xiaomi | |
1572 | + DEVICE_MODEL := Mi Router 4A | |
1573 | + DEVICE_VARIANT := Gigabit Edition v2 | |
1574 | + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap | |
1575 | +endef | |
1576 | +TARGET_DEVICES += xiaomi_mi-router-4a-gigabit-v2 | |
1577 | + | |
1567 | 1578 | define Device/xiaomi_mi-router-ac2100 |
1568 | 1579 | $(Device/xiaomi_nand_separate) |
1569 | 1580 | DEVICE_MODEL := Mi Router AC2100 |
@@ -104,6 +104,9 @@ tplink,re650-v1) | ||
104 | 104 | ucidef_set_led_netdev "eth_act" "LAN act" "green:eth_act" "lan" "tx rx" |
105 | 105 | ucidef_set_led_netdev "eth_link" "LAN link" "green:eth_link" "lan" "link" |
106 | 106 | ;; |
107 | +xiaomi,mi-router-4a-gigabit-v2) | |
108 | + ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link" | |
109 | + ;; | |
107 | 110 | xiaomi,mi-router-ac2100) |
108 | 111 | ucidef_set_led_netdev "wan-blue" "WAN (blue)" "blue:wan" "wan" |
109 | 112 | ;; |
@@ -49,7 +49,8 @@ ramips_setup_interfaces() | ||
49 | 49 | xiaomi,mi-router-3g|\ |
50 | 50 | xiaomi,mi-router-3g-v2|\ |
51 | 51 | xiaomi,mi-router-4|\ |
52 | - xiaomi,mi-router-4a-gigabit) | |
52 | + xiaomi,mi-router-4a-gigabit|\ | |
53 | + xiaomi,mi-router-4a-gigabit-v2) | |
53 | 54 | ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" |
54 | 55 | ;; |
55 | 56 | gnubee,gb-pc1) |