Skip to content

Commit

Permalink
添加小米4A千兆版v2机型
Browse files Browse the repository at this point in the history
lede源码中暂无此机型,其他源码均已支持
  • Loading branch information
hugcabbage committed Sep 5, 2023
1 parent c9819e9 commit 2209b00
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-immortalwrt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ on:
- 'redmi-ac2100'
- 'xiaomi-ac2100'
- 'xiaomi-4a-gigabit'
- 'xiaomi-4a-gigabit-v2'
- 'xiaomi-3g-v2'
- 'xiaomi-3g'
- 'xiaomi-4'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-lienol-openwrt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ on:
type: choice
options:
- 'xiaomi-4a-gigabit'
- 'xiaomi-4a-gigabit-v2'
- 'xiaomi-3g-v2'
- 'xiaomi-cr6608'
- 'xiaomi-cr6606'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-openwrt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ on:
- 'redmi-ac2100'
- 'xiaomi-ac2100'
- 'xiaomi-4a-gigabit'
- 'xiaomi-4a-gigabit-v2'
- 'xiaomi-3g-v2'
- 'xiaomi-3g'
- 'xiaomi-4'
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

> 选择机型:
默认为小米4A千兆版。点开下拉框,可以选择不同的机型。
点开下拉框,可以选择不同的机型。

> 上传到release:
Expand Down Expand Up @@ -195,6 +195,9 @@ Actions流程顺利完成后,去release(或者artifact)下载你的固件,re
<tr>
<td>小米4A千兆版</td>
</tr>
<tr>
<td>小米4A千兆版v2</td>
</tr>
<tr>
<td>小米4A百兆版</td>
</tr>
Expand Down Expand Up @@ -227,7 +230,7 @@ Actions流程顺利完成后,去release(或者artifact)下载你的固件,re

3.小米4A千兆版和小米3Gv2需修改分区才能在breed直刷,参考该[帖子](https://www.right.com.cn/forum/thread-4052254-1-1.html),本项目中已修改好。

4.小米4A千兆版和小米3Gv2闪存小,若编译插件太多,包体积超出16064K,则不会生成sysupgrade.bin。
4.小米4A千兆版和小米3Gv2闪存小(仅16MB),若编译插件太多,包体积超出闪存上限,则不会生成sysupgrade.bin。

---

Expand Down
13 changes: 11 additions & 2 deletions extra-files/modify-xiaomi-router-4a-3g-v2.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/sh

AIMFILE=target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi
AIMFILE=target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi
AIDFILE=target/linux/ramips/dts/mt7621_youhua_wr1200js.dts
[ ! -e "$AIMFILE" ] && AIMFILE=target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi

SPECIFIC_LINE=$(sed -n '/&spi0/=' $AIMFILE)
BASE_TEXT=$(sed '/&spi0/,/^};/d' $AIMFILE)
Expand All @@ -11,7 +12,15 @@ sed -n '/&spi0/,/^};/p' $AIDFILE >> $AIMFILE
echo "$BASE_TEXT" | sed -n "$SPECIFIC_LINE,\$p" >> $AIMFILE
sed -i "${SPECIFIC_LINE}d" $AIMFILE

EXFILE=target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts
MT7621MK=target/linux/ramips/image/mt7621.mk

if [ -e "$EXFILE" ]; then
sed -i 's/partition@180000/partition@50000/' $EXFILE
sed -i 's/0x180000 0xe70000/0x50000 0xfa0000/' $EXFILE
sed -i 's/partitions {/partitions: partitions {/' $AIMFILE
sed -i '/Device\/xiaomi_mi-router-4a-gigabit-v2/,/Mi Router 4A/ s/14784k/16000k/' $MT7621MK
fi

sed -i '/Device\/xiaomi_mi-router-4a-gigabit/,/Mi Router 4A/ s/14848k/16064k/' $MT7621MK
sed -i '/Device\/xiaomi_mi-router-3g-v2/,/mir3g-v2/ s/14848k/16064k/' $MT7621MK
sed -i '/Device\/xiaomi_mi-router-3g-v2/,/Mi Router 3G/ s/14848k/16064k/' $MT7621MK
2 changes: 1 addition & 1 deletion extra-files/transit.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def produce_temp_workfiles(headers: dict, model: str, temp: str):
num = '1'
shutil.copyfile(num + '.clone.sh', tc2 := temp + '.clone.sh')
shutil.copyfile(num + '.modify.sh', tm1 := temp + '.modify.sh')
if model == 'xiaomi-4a-gigabit' or model == 'xiaomi-3g-v2':
if model == 'xiaomi-4a-gigabit' or model == 'xiaomi-3g-v2' or model == 'xiaomi-4a-gigabit-v2':
with open(tm1, 'a') as f:
f.write('\n. extra-files/modify-xiaomi-router-4a-3g-v2.sh\n')
return tc1, tc2, tm1
Expand Down
3 changes: 2 additions & 1 deletion preset-immortalwrt/headers.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"xiaomi-ac2100": ["1", "ramips", "mt7621", "xiaomi_mi-router-ac2100"],
"redmi-ax6s": ["1", "mediatek", "mt7622", "xiaomi_redmi-router-ax6s"],
"xiaomi-4a-gigabit": ["2", "ramips", "mt7621", "xiaomi_mi-router-4a-gigabit"],
"xiaomi-4a-gigabit-v2": ["2", "ramips", "mt7621", "xiaomi_mi-router-4a-gigabit-v2"],
"xiaomi-3g-v2": ["2", "ramips", "mt7621", "xiaomi_mi-router-3g-v2"],
"phicomm-k2p": ["2", "ramips", "mt7621", "phicomm_k2p"],
"xiaomi-4a-100m": ["2", "ramips", "mt76x8", "xiaomi_mi-router-4a-100m"],
Expand All @@ -18,4 +19,4 @@
"glinet-microuter-n300": ["2", "ramips", "mt76x8", "glinet_microuter-n300"],
"miwifi-mini": ["2", "ramips", "mt7620", "xiaomi_miwifi-mini"],
"miwifi-r3": ["2", "ramips", "mt7620", "xiaomi_miwifi-r3"]
}
}
3 changes: 2 additions & 1 deletion preset-lienol-openwrt/headers.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"xiaomi-ac2100": ["1", "ramips", "mt7621", "xiaomi_mi-router-ac2100"],
"redmi-ax6s": ["1", "mediatek", "mt7622", "xiaomi_redmi-router-ax6s"],
"xiaomi-4a-gigabit": ["2", "ramips", "mt7621", "xiaomi_mi-router-4a-gigabit"],
"xiaomi-4a-gigabit-v2": ["2", "ramips", "mt7621", "xiaomi_mi-router-4a-gigabit-v2"],
"xiaomi-3g-v2": ["2", "ramips", "mt7621", "xiaomi_mi-router-3g-v2"],
"phicomm-k2p": ["2", "ramips", "mt7621", "phicomm_k2p"],
"xiaomi-4a-100m": ["2", "ramips", "mt76x8", "xiaomi_mi-router-4a-100m"],
Expand All @@ -18,4 +19,4 @@
"glinet-microuter-n300": ["2", "ramips", "mt76x8", "glinet_microuter-n300"],
"miwifi-mini": ["2", "ramips", "mt7620", "xiaomi_miwifi-mini"],
"miwifi-r3": ["2", "ramips", "mt7620", "xiaomi_miwifi-r3"]
}
}
3 changes: 2 additions & 1 deletion preset-openwrt/headers.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"xiaomi-ac2100": ["1", "ramips", "mt7621", "xiaomi_mi-router-ac2100"],
"redmi-ax6s": ["1", "mediatek", "mt7622", "xiaomi_redmi-router-ax6s"],
"xiaomi-4a-gigabit": ["2", "ramips", "mt7621", "xiaomi_mi-router-4a-gigabit"],
"xiaomi-4a-gigabit-v2": ["2", "ramips", "mt7621", "xiaomi_mi-router-4a-gigabit-v2"],
"xiaomi-3g-v2": ["2", "ramips", "mt7621", "xiaomi_mi-router-3g-v2"],
"phicomm-k2p": ["2", "ramips", "mt7621", "phicomm_k2p"],
"xiaomi-4a-100m": ["2", "ramips", "mt76x8", "xiaomi_mi-router-4a-100m"],
Expand All @@ -18,4 +19,4 @@
"glinet-microuter-n300": ["2", "ramips", "mt76x8", "glinet_microuter-n300"],
"miwifi-mini": ["2", "ramips", "mt7620", "xiaomi_miwifi-mini"],
"miwifi-r3": ["2", "ramips", "mt7620", "xiaomi_miwifi-r3"]
}
}

0 comments on commit 2209b00

Please sign in to comment.