-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathgenerate_conf_file.sh
executable file
·145 lines (126 loc) · 3.61 KB
/
generate_conf_file.sh
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
gen_conf() {
#设备完整名称
local device="$1"
#调整cpu_type
local cpu_type
if [ $# -eq 2 ]; then
cpu_type="$2"
fi
local target2="$(echo "$device" | sed 's/_DEVICE_.*$//g')"
local target1="$(echo "$target2" | sed 's/_.*$//g')"
local device_short="$(echo "$device" | sed 's/^.*_DEVICE_//g')"
echo "Processing: device $device_short"
mkdir -p ./conf
# 文件不删空有可能导致配置错误
rm -f .config .config.old
# LEDE源码有坑,以下这行是处理LEDE源码坑,避免make defconfig的时候出错。
make -C scripts/config clean >/dev/null 2>&1
cat >.config <<-EOF
CONFIG_TARGET_${target1}=y
CONFIG_TARGET_${target2}=y
CONFIG_TARGET_${device}=y
CONFIG_DEVEL=y
CONFIG_CCACHE=y
EOF
if [ -n "$WITHOUT_NAS_PKG" ] && [ "$WITHOUT_NAS_PKG" -eq 1 ]; then
rm -f tmp/info/.targetinfo-*
make defconfig CONFIG_DEFAULT_WITHOUT_NAS_PACKAGES=1 >/dev/null
fi
rm -f tmp/info/.targetinfo-*
make defconfig >/dev/null
local line_str
local line_str_rep
if [ -n "$cpu_type" ]; then
line_str="$(grep '^CONFIG_TARGET_OPTIMIZATION=' .config)"
line_str_rep="$(echo "$line_str" | sed "s/-mtune=[^[[:space:]\"]*/-mtune=${cpu_type}/g")"
sed -i "s/$line_str/$line_str_rep/g" .config
fi
cp -f .config "conf/.config.$device_short"
rm -f .config .config.old
echo ""
echo "Complete: written to conf/.config.$device_short"
echo ""
}
process_devices() {
devices=$1
local cpu_type=$2
local n=${#devices[@]}
for i in $(seq 0 $(expr $n - 1)); do
gen_conf "${devices[i]}" $cpu_type
done
}
###################################################
rm -rf conf/
mkdir -p conf/
rm -rf tmp/
###################################################
### ar71xx 74kc without USB
WITHOUT_NAS_PKG=1
devices=(
"ar71xx_generic_DEVICE_tl-wr841-v8"
"ar71xx_generic_DEVICE_tl-wr841-v8-cn"
"ar71xx_generic_DEVICE_tl-wr941nd-v6"
"ar71xx_generic_DEVICE_tl-wr941nd-v6-cn"
"ar71xx_generic_DEVICE_tl-wr941n-v7"
"ar71xx_generic_DEVICE_tl-wr885n-v1"
"ar71xx_generic_DEVICE_mw450r-v3"
"ar71xx_generic_DEVICE_phicomm-k2t"
)
process_devices $devices "74kc"
### ar71xx 24kc without USB
devices=(
"ar71xx_generic_DEVICE_tl-wr740n-v3"
"ar71xx_generic_DEVICE_tl-wr740n-v4"
"ar71xx_generic_DEVICE_tl-wr841-v3"
"ar71xx_generic_DEVICE_tl-wr841-v5"
"ar71xx_generic_DEVICE_tl-wr841-v7"
"ar71xx_generic_DEVICE_tl-wr841-v9"
)
process_devices $devices
unset WITHOUT_NAS_PKG
###################################################
### ar71xx 74kc with USB
devices=(
"ar71xx_generic_DEVICE_csac"
"ar71xx_generic_DEVICE_domywifi-dw33d"
"ar71xx_generic_DEVICE_hq55"
"ar71xx_generic_DEVICE_tl-wdr7500-v3"
"ar71xx_generic_DEVICE_tl-wdr4310-v1"
"ar71xx_generic_DEVICE_tl-wr1041n-v2"
"ar71xx_generic_DEVICE_tl-wr842n-v2"
"ar71xx_generic_DEVICE_tl-wr842n-v2-cn"
)
process_devices $devices "74kc"
# ar71xx 24kc with USB
devices=(
"ar71xx_generic_DEVICE_tl-wr941nd-v2"
"ar71xx_generic_DEVICE_tl-wr842n-v3"
)
process_devices $devices
### 7621 with USB
devices=(
"ramips_mt7621_DEVICE_wr1200js"
"ramips_mt7621_DEVICE_newifi-d1"
"ramips_mt7621_DEVICE_newifi-d2"
"ramips_mt7621_DEVICE_a3004ns"
"ramips_mt7621_DEVICE_ghl-r-001"
"ramips_mt7621_DEVICE_hw24g"
"ramips_mt7621_DEVICE_link7"
"ramips_mt7621_DEVICE_yyets-le2"
"ramips_mt7621_DEVICE_rg-nbr700gw"
)
process_devices $devices "1004kc"
### 7620 with USB
devices=(
"ramips_mt7620_DEVICE_y1s"
"ramips_mt7620_DEVICE_youku-yk1"
"ramips_mt7620_DEVICE_hd51-n"
"ramips_mt7620_DEVICE_domywifi-dw22d-v1"
"ramips_mt7620_DEVICE_domywifi-dw22d-v2"
"ramips_mt7620_DEVICE_miwifi-mini"
"ramips_mt7620_DEVICE_hc5661"
"ramips_mt7620_DEVICE_5k-w20"
"ramips_mt7620_DEVICE_treebear-x1"
)
process_devices $devices