forked from FreifunkAdvanced/ff-advanced
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenconfig
executable file
·378 lines (322 loc) · 8.79 KB
/
genconfig
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
#!/bin/sh
#
# genconfig - creates an OpenWrt config file for oldconfig
# Copyright (C) 2012 Philipp Psurek <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
version(){
echo "genconfig Version 0.0.20120618"
cat << EOF
Copyright © 2012 Philipp Psurek <[email protected]>
2012 Freifunk Rheinland <http://www.freifunk-rheinland.net/>
Lizenz GPLv3+: GNU GPL Version 3 oder höher <http://gnu.org/licenses/gpl.html>
Dies ist freie Software: Sie können sie ändern und weitergeben.
Es gibt keinerlei Garantien, soweit wie es das Gesetz erlaubt.
EOF
}
usage(){
cat << EOF
Aufruf: genconfig <flavour>
genconfig [-h|-v]
Flavour:
# D-Link
dir300 DIR-300
# Linksys
wrt54g WTR54G <V4, WTR54GL
# TP-LINK
tplite TL-WR741ND, TL-WR841ND, TL-WR941ND, …
tpusb TL-WR1043ND, TL-WR2543ND, …
tp all
Optionen:
-h, --help Hilfe
-v, --version Version
EOF
}
# cat .config | grep -v -e "^#"
# while true; do echo; done | make oldconfig >/dev/null
# ar71xx
target_ar71xx(){
cat << EOF
CONFIG_TARGET_ar71xx=y
CONFIG_TARGET_ar71xx_generic=y
CONFIG_TARGET_ar71xx_generic_Default=y
CONFIG_HAS_SUBTARGETS=y
CONFIG_TARGET_BOARD="ar71xx"
CONFIG_TARGET_ARCH_PACKAGES="ar71xx"
EOF
}
# TODO
# DIR-300
target_atheros(){
cat << EOF
CONFIG_TARGET_atheros=y
CONFIG_TARGET_atheros_Default=y
CONFIG_TARGET_BOARD="atheros"
CONFIG_TARGET_ARCH_PACKAGES="atheros"
CONFIG_PACKAGE_kmod-ath5k=y
# CONFIG_PACKAGE_kmod-cfg80211 is not set
CONFIG_MADWIFI_SINGLE_MODULE=y
CONFIG_MADWIFI_RCA_MINSTREL=y
# CONFIG_MADWIFI_RCA_SAMPLERATE is not set
# CONFIG_PACKAGE_kmod-mac80211-hwsim is not set
# CONFIG_PACKAGE_kmod-madwifi is not set
# CONFIG_MADWIFI_COMPRESSION is not set
CONFIG_PACKAGE_kmod-madwifi=y
# CONFIG_PACKAGE_kmod-mac80211 is not set
# CONFIG_PACKAGE_kmod-mac80211-hwsim is not set
CONFIG_BUSYBOX_CONFIG_FEATURE_HAVE_RPC=y
EOF
}
# TODO
# Linksys
target_brcm47xx(){
cat << EOF
CONFIG_TARGET_brcm47xx=y
CONFIG_TARGET_brcm47xx_Broadcom-b43=y
CONFIG_TARGET_BOARD="brcm47xx"
CONFIG_TARGET_ARCH_PACKAGES="brcm47xx"
CONFIG_DEFAULT_kmod-b43=y
CONFIG_DEFAULT_kmod-b43legacy=y
CONFIG_DEFAULT_kmod-diag=y
CONFIG_DEFAULT_kmod-switch=y
CONFIG_DEFAULT_nvram=y
CONFIG_PCMCIA_SUPPORT=y
CONFIG_PACKAGE_nvram=y
CONFIG_PACKAGE_kmod-diag=y
CONFIG_PACKAGE_kmod-switch=y
CONFIG_PACKAGE_kmod-b43=y
CONFIG_B43_FW_5_100_138=y
CONFIG_B43_FW_SQUASH=y
CONFIG_B43_FW_SQUASH_COREREVS="5,6,7,8,9,10,11,13,14,15,16"
CONFIG_B43_FW_SQUASH_PHYTYPES="G,LP,N"
CONFIG_PACKAGE_B43_PHY_N=y
# CONFIG_PACKAGE_kmod-b43legacy is not set
CONFIG_B43LEGACY_FW_SQUASH=y
CONFIG_B43LEGACY_FW_SQUASH_COREREVS="1,2,3,4"
EOF
}
# Konfiguration für alle FF-Knoten
default(){
# kein JJFS2, kein ext4, .tar.gz zum Überprüfen
cat << EOF
# CONFIG_TARGET_ROOTFS_INITRAMFS is not set
# CONFIG_TARGET_ROOTFS_CPIOGZ is not set
CONFIG_TARGET_ROOTFS_TARGZ=y
# CONFIG_TARGET_ROOTFS_EXT4FS is not set
# CONFIG_TARGET_ROOTFS_JFFS2 is not set
CONFIG_TARGET_ROOTFS_SQUASHFS=y
EOF
# IPv6 on board
echo "CONFIG_IPV6=y"
# B.A.T.M.A.N.-adv - der Kern des Freifunks
echo "
CONFIG_PACKAGE_kmod-batman-adv=y
CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG=y
CONFIG_KMOD_BATMAN_ADV_BATCTL=y"
# PPP wird nicht benötigt
echo "
CONFIG_PACKAGE_ppp=m
CONFIG_PACKAGE_ppp-mod-pppoe=m"
# Zeilen von zwei Dateien über ein gemeinsames Feld verbinden
echo "
CONFIG_PACKAGE_coreutils=y
CONFIG_PACKAGE_coreutils-join=y"
# Sperren von p2p-Tabellen
echo "CONFIG_PACKAGE_flock=y"
# aus Kompatibilitätsgründen, kann weg, wenn $RANDOM nicht mehr benötigt
echo "CONFIG_BUSYBOX_CONFIG_ASH_RANDOM_SUPPORT=y"
# Verwendung unklar
echo "CONFIG_PACKAGE_kmod-bonding=m"
}
packages_firewall(){
# Firewall
echo "CONFIG_PACKAGE_firewall="
echo "CONFIG_PACKAGE_iptables="
echo "CONFIG_PACKAGE_ip6tables="
# TODO Bedarf überprüfen
echo "CONFIG_PACKAGE_librt="
# TODO Bedarf überprüfen
echo "CONFIG_PACKAGE_kmod-ledtrig-netfilter="
# TODO Bedarf überprüfen - kein Bedarf
#echo "CONFIG_PACKAGE_kmod-lib-crc-ccitt="
# TODO Bedarf überprüfen
echo "CONFIG_PACKAGE_iptables-mod-nat-extra="
# Freifunk P2P-Blocker
echo "CONFIG_PACKAGE_freifunk-p2pblock="
}
# DHCP und radv
packages_dhcp(){
cat << EOF
CONFIG_PACKAGE_dnsmasq=
CONFIG_PACKAGE_wide-dhcpv6-server=
CONFIG_PACKAGE_radvd=
EOF
}
# n2n-Tunnel
packages_n2n(){
cat << EOF
CONFIG_PACKAGE_n2n=
EOF
}
# wird OpenVPN aktiviert, dann mit weiteren Optionen (=y)
packages_openvpn(){
cat << EOF
CONFIG_PACKAGE_openvpn=
CONFIG_OPENVPN_DISABLE_EUREPHIA=y
CONFIG_OPENVPN_DISABLE_MANAGEMENT=y
CONFIG_OPENVPN_ENABLE_PASSWORD_SAVE=y
EOF
}
# nur für mod941er, 1043er, 2543er, 3420er und andere mit USB
packages_usb(){
cat << EOF
CONFIG_PACKAGE_kmod-ledtrig-usbdev=
CONFIG_PACKAGE_kmod-usb2=
EOF
#CONFIG_PACKAGE_kmod-usb-ohci=
}
# für den 1043er RTL-Switch, im Augenblick deaktiviert
packages_switch(){
cat << EOF
CONFIG_PACKAGE_kmod-libphy=
CONFIG_PACKAGE_kmod-swconfig=
CONFIG_PACKAGE_kmod-switch-rtl8366-smi=
CONFIG_PACKAGE_kmod-switch-rtl8366rb=
EOF
}
# Webserver für Splash
packages_webserver(){
cat << EOF
CONFIG_PACKAGE_uhttpd=
EOF
}
# benötigte Hilfsprogramme
packages_used_util(){
cat << EOF
CONFIG_PACKAGE_iputils-ping6=
EOF
}
# zusätzliche Hilfsprogramme als Modul
packages_util(){
cat << EOF
CONFIG_PACKAGE_iputils-ping=
CONFIG_PACKAGE_iputils-tracepath=
CONFIG_PACKAGE_iputils-tracepath6=
CONFIG_PACKAGE_iputils-traceroute6=
CONFIG_PACKAGE_nano=
CONFIG_PACKAGE_iperf=
CONFIG_PACKAGE_iperf-mt=
EOF
}
# unbekannte Kernel-Module. TODO: Bedarf überprüfen oder kommentieren
packages_unknown(){
cat << EOF
CONFIG_PACKAGE_kmod-button-hotplug=
CONFIG_PACKAGE_kmod-input-gpio-keys-polled=
CONFIG_PACKAGE_kmod-input-polldev=
EOF
}
# Wichtige Pakete, von der Firmware gefordert
# hbbp - UDP-Broadcast für
# nacl - salt for hbbp - package is br0ken by upstream
# kmod-nfnetlink - Kernel modules support for a netlink-based userspace interface
packages_ffrl(){
cat << EOF
CONFIG_PACKAGE_hbbp=
CONFIG_PACKAGE_nacl=
CONFIG_PACKAGE_kmod-nfnetlink=
EOF
}
# FF-Rheinland Pakete und Helfer (als Module zum Austesten)
packages_ffrl_util(){
cat << EOF
CONFIG_PACKAGE_ffrl-miniconfig=
EOF
}
gen_config(){
# ------
if [ "$case" = "ar71xx" ] || [ "$case" = "tp" ]; then
# ------
target_ar71xx
default
packages_firewall | sed -e "s/=$/=y/g"
packages_dhcp | sed -e "s/=$/=y/g"
packages_n2n | sed -e "s/=$/=y/g"
packages_openvpn | sed -e "s/=$/=y/g"
#packages_usb | sed -e "s/=$/=y/g" # USB wird bei Bedarf vom Buildroot selbst eingebaut
#packages_switch | sed -e "s/=$/=m/g" # Switch wird vom Buildroot selbst geregelt
packages_webserver | sed -e "s/=$/=y/g"
packages_used_util | sed -e "s/=$/=y/g"
packages_util | sed -e "s/=$/=m/g"
packages_unknown | sed -e "s/=$/=y/g" # unbekannte Kernel-Module. TODO: Bedarf überprüfen
packages_ffrl | sed -e "s/=$/=y/g"
packages_ffrl_util | sed -e "s/=$/=m/g"
# -------
elif [ "$case" = "atheros" ] || [ "$case" = "dir300" ]; then
# -------
target_atheros
default
packages_firewall | sed -e "s/=$/=m/g"
packages_dhcp | sed -e "s/=$/=m/g"
packages_n2n | sed -e "s/=$/=y/g"
packages_openvpn | sed -e "s/=$/=m/g"
#packages_usb | sed -e "s/=$/=m/g"
#packages_switch | sed -e "s/=$/=m/g"
packages_webserver | sed -e "s/=$/=m/g"
packages_used_util | sed -e "s/=$/=y/g"
packages_util | sed -e "s/=$/=m/g"
#packages_unknown | sed -e "s/=$/=m/g"
packages_ffrl | sed -e "s/=$/=y/g"
packages_ffrl_util | sed -e "s/=$/=y/g"
# --------
elif [ "$case" = "brcm47xx" ] || [ "$case" = "wrt54g" ]; then
# --------
target_brcm47xx
default
packages_firewall | sed -e "s/=$/=m/g"
packages_dhcp | sed -e "s/=$/=m/g"
packages_n2n | sed -e "s/=$/=y/g"
packages_openvpn | sed -e "s/=$/=m/g"
#packages_usb | sed -e "s/=$/=m/g"
#packages_switch | sed -e "s/=$/=m/g"
packages_webserver | sed -e "s/=$/=m/g"
packages_used_util | sed -e "s/=$/=y/g"
packages_util | sed -e "s/=$/=m/g"
#packages_unknown | sed -e "s/=$/=m/g"
packages_ffrl | sed -e "s/=$/=y/g"
packages_ffrl_util | sed -e "s/=$/=y/g"
else
echo "Ungültige Eingabe"
exit 1
fi
}
# Eingabeverarbeitung
if [ "$1" != "" ]; then
case=$1
case "$case" in
--help|-h)
usage
exit 0
;;
--version|-v)
version
exit 0
;;
*)
gen_config
;;
esac
else
usage
fi