2
2
3
3
# # LibreMesh community mesh networks meta-firmware
4
4
# #
5
- # # Copyright (C) 2023 Gioacchino Mazzurco <gio@eigenlab.org >
6
- # # Copyright (C) 2023 Asociación Civil Altermundi <info@altermundi.net>
5
+ # # Copyright (C) 2023-2024 Gioacchino Mazzurco <gio@polymathes.cc >
6
+ # # Copyright (C) 2023-2024 Asociación Civil Altermundi <info@altermundi.net>
7
7
# #
8
8
# # SPDX-License-Identifier: AGPL-3.0-only
9
9
10
- mBuildDir=" /home/gio/Builds/openwrt"
11
10
12
- cIface=" em0"
11
+ # # Define default value for variable, take two arguments, $1 variable name,
12
+ # # $2 default variable value, if the variable is not already define define it
13
+ # # with default value.
14
+ function define_default_value()
15
+ {
16
+ VAR_NAME=" ${1} "
17
+ DEFAULT_VALUE=" ${2} "
18
+
19
+ [ -z " ${! VAR_NAME} " ] && export ${VAR_NAME} =" ${DEFAULT_VALUE} " || true
20
+ }
21
+
22
+
23
+ define_default_value OPENWRT_BUILD_DIR " $HOME /Builds/openwrt-apup/"
24
+ define_default_value KCONFIG_UTILS_DIR " $HOME /Development/kconfig-utils/"
25
+ define_default_value HOSTAPD_REPO_DIR " $HOME /Development/hostap/"
26
+ define_default_value OPENWRT_REPO_DIR " $HOME /Development/openwrt/"
27
+ define_default_value NETIFD_REPO_DIR " $HOME /Development/netifd/"
28
+
29
+
30
+
31
+ cIface=" usbe1"
13
32
14
33
bianco43IP=" fe80::c24a:ff:fefc:2f12%$cIface "
15
34
bluIP=" fe80::6670:2ff:fede:c51e%$cIface "
16
35
neroIP=" fe80::c24a:ff:fe7a:acac%$cIface "
17
36
verdeIP=" fe80::ea94:f6ff:fe68:3364%$cIface "
18
37
38
+ dax1Ipll=" fe80::aa63:7dff:fe2e:97c8%$cIface "
39
+ dax2Ipll=" fe80::aa63:7dff:fe2e:97d8%$cIface "
40
+
41
+ hlk1Ipll=" 169.254.145.20"
42
+ hlk2Ipll=" 169.254.145.22"
43
+
44
+ source " ${KCONFIG_UTILS_DIR} /kconfig-utils.sh"
45
+
46
+ function fTestConf()
47
+ {
48
+ kconfig_set CONFIG_DEVEL
49
+ kconfig_set CONFIG_SRC_TREE_OVERRIDE
50
+
51
+ local mHostapdGitSrc=" $OPENWRT_BUILD_DIR /package/network/services/hostapd/git-src"
52
+ rm -f " $mHostapdGitSrc "
53
+ ln -s " ${HOSTAPD_REPO_DIR} /.git" " $mHostapdGitSrc "
54
+
55
+ local mNetifdGitSrc=" $OPENWRT_BUILD_DIR /package/network/config/netifd/git-src"
56
+ rm -f " $mNetifdGitSrc "
57
+ ln -s " $NETIFD_REPO_DIR /.git" " $mNetifdGitSrc "
58
+
59
+ kconfig_set CONFIG_PACKAGE_iperf3
60
+
61
+ kconfig_unset CONFIG_PACKAGE_ppp
62
+ kconfig_unset CONFIG_PACKAGE_ppp-mod-pppoe
63
+ kconfig_unset CONFIG_PACKAGE_kmod-ppp
64
+ kconfig_unset CONFIG_PACKAGE_kmod-pppoe
65
+ kconfig_unset CONFIG_PACKAGE_kmod-pppox
66
+ }
67
+
68
+ function fBuildDapX()
69
+ {
70
+ pushd " $OPENWRT_BUILD_DIR "
71
+
72
+ ./scripts/feeds update -a
73
+ ./scripts/feeds install -a
74
+
75
+ # Prepare firmware for D-Link DAP-X1860
76
+ echo " " > " $KCONFIG_CONFIG_PATH "
77
+ kconfig_init_register
78
+
79
+ kconfig_set CONFIG_TARGET_ramips
80
+ kconfig_set CONFIG_TARGET_ramips_mt7621
81
+ kconfig_set CONFIG_TARGET_ramips_mt7621_DEVICE_dlink_dap-x1860-a1
82
+ make defconfig
83
+
84
+ fTestConf
85
+ make defconfig
86
+
87
+ kconfig_check
88
+ kconfig_wipe_register
89
+
90
+ clean_hostapd
91
+
92
+ make -j $(( $(nproc)- 1 ))
93
+ popd
94
+ }
95
+
96
+ function fBuildHlk()
97
+ {
98
+ pushd " $OPENWRT_BUILD_DIR "
99
+
100
+ ./scripts/feeds update -a
101
+ ./scripts/feeds install -a
102
+
103
+ # Prepare firmware for D-Link DAP-X1860
104
+ echo " " > " $KCONFIG_CONFIG_PATH "
105
+ kconfig_init_register
106
+
107
+ kconfig_set CONFIG_TARGET_ramips
108
+ kconfig_set CONFIG_TARGET_ramips_mt7621
109
+ kconfig_set CONFIG_TARGET_ramips_mt7621_DEVICE_hilink_hlk-7621a-evb
110
+ make defconfig
111
+
112
+ kconfig_set CONFIG_PACKAGE_pciutils
113
+ kconfig_set CONFIG_PACKAGE_kmod-mt7916-firmware
114
+ fTestConf
115
+ make defconfig
116
+
117
+ kconfig_check
118
+ kconfig_wipe_register
119
+
120
+ clean_packages
121
+
122
+ make -j $(( $(nproc)- 1 ))
123
+ popd
124
+ }
19
125
20
126
function dflash()
21
127
{
@@ -30,7 +136,8 @@ function dflash()
30
136
31
137
[ " X$origHash " != " X$copiedHash " ] && echo " Hash mismatch" && return -1
32
138
33
- ssh root@$dDevice " sysupgrade -n /tmp/$imgName "
139
+ # Do not use -n as this will erease IP confifuration for hilink_hlk-7621a-evb
140
+ ssh root@$dDevice " sysupgrade /tmp/$imgName "
34
141
35
142
# Wait the detached flashing to start
36
143
sleep 10
@@ -59,6 +166,14 @@ function dWait()
59
166
60
167
function wait_all()
61
168
{
169
+ dWait ${hlk1Ipll}
170
+ dWait ${hlk2Ipll}
171
+ return
172
+
173
+ dWait ${dax1Ipll}
174
+ dWait ${dax2Ipll}
175
+ return
176
+
62
177
dWait ${verdeIP}
63
178
dWait ${neroIP}
64
179
dWait ${bluIP}
@@ -86,14 +201,17 @@ function dConf()
86
201
set wireless.radio0.channel='9'
87
202
set wireless.default_radio0.ssid='libre-curtigghio'
88
203
set wireless.default_radio0.mode='ap'
89
- set wireless.default_radio0.wds='1'
90
- set wireless.default_radio0.network='curtigghio'
204
+ set wireless.default_radio0.apup='1'
205
+ set wireless.default_radio0.apup_peer_ifname_prefix='wlan0.peer'
206
+ set wireless.default_radio0.network='lan'
91
207
92
208
set wireless.radio1.disabled='0'
93
209
set wireless.default_radio1.ssid='libre-curtigghio'
94
210
set wireless.default_radio1.mode='ap'
95
- set wireless.default_radio1.wds='1'
96
- set wireless.default_radio1.network='curtigghio'
211
+ set wireless.default_radio1.apup='1'
212
+ set wireless.default_radio1.apup_peer_ifname_prefix='wlan1.peer'
213
+ set wireless.default_radio1.wds_bridge=''
214
+ set wireless.default_radio1.network='lan'
97
215
98
216
set firewall.@defaults[0].input='ACCEPT'
99
217
set firewall.@defaults[0].output='ACCEPT'
105
223
106
224
function conf_all()
107
225
{
226
+ dConf ${hlk1Ipll} " OpenWrt-Hlk1" " 169.254.145.20"
227
+ dConf ${hlk2Ipll} " OpenWrt-Hlk2" " 169.254.145.22"
228
+ return
229
+
230
+ dConf ${dax1Ipll} " OpenWrt-Dax1" " 192.168.1.16"
231
+ dConf ${dax2Ipll} " OpenWrt-Dax2" " 192.168.1.18"
232
+ return
233
+
108
234
dConf ${verdeIP} " OpenWrt-Verde" " 192.168.1.4"
109
235
dConf ${neroIP} " OpenWrt-nero" " 192.168.1.10"
110
236
dConf ${bluIP} " OpenWrt-blu" " 192.168.1.8"
@@ -113,48 +239,105 @@ function conf_all()
113
239
114
240
function flash_all()
115
241
{
116
- dflash ${verdeIP} " ${mBuildDir} /bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr3600-v1-squashfs-sysupgrade.bin"
117
- dflash ${neroIP} " ${mBuildDir} /bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr3600-v1-squashfs-sysupgrade.bin"
118
- dflash ${bluIP} " ${mBuildDir} /bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr3600-v1-squashfs-sysupgrade.bin"
119
- dflash ${bianco43IP} " ${mBuildDir} /bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr4300-v1-squashfs-sysupgrade.bin"
242
+ dflash ${hlk1Ipll} " ${OPENWRT_BUILD_DIR} /bin/targets/ramips/mt7621/openwrt-ramips-mt7621-hilink_hlk-7621a-evb-squashfs-sysupgrade.bin"
243
+ dflash ${hlk2Ipll} " ${OPENWRT_BUILD_DIR} /bin/targets/ramips/mt7621/openwrt-ramips-mt7621-hilink_hlk-7621a-evb-squashfs-sysupgrade.bin"
244
+
245
+ # dflash ${dax1Ipll} "${OPENWRT_BUILD_DIR}/bin/targets/ramips/mt7621/openwrt-ramips-mt7621-dlink_dap-x1860-a1-squashfs-sysupgrade.bin"
246
+ # dflash ${dax2Ipll} "${OPENWRT_BUILD_DIR}/bin/targets/ramips/mt7621/openwrt-ramips-mt7621-dlink_dap-x1860-a1-squashfs-sysupgrade.bin"
247
+
248
+ # dflash ${verdeIP} "${OPENWRT_BUILD_DIR}/bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr3600-v1-squashfs-sysupgrade.bin"
249
+ # dflash ${neroIP} "${OPENWRT_BUILD_DIR}/bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr3600-v1-squashfs-sysupgrade.bin"
250
+ # dflash ${bluIP} "${OPENWRT_BUILD_DIR}/bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr3600-v1-squashfs-sysupgrade.bin"
251
+ # dflash ${bianco43IP} "${OPENWRT_BUILD_DIR}/bin/targets/ath79/generic/openwrt-ath79-generic-tplink_tl-wdr4300-v1-squashfs-sysupgrade.bin"
120
252
121
253
wait_all
122
254
123
255
conf_all
124
256
257
+ ssh root@${hlk1Ipll} reboot
258
+ ssh root@${hlk2Ipll} reboot
259
+
260
+ return
261
+
262
+
263
+ ssh root@${dax1Ipll} reboot
264
+ ssh root@${dax2Ipll} reboot
265
+
266
+ return
267
+
125
268
ssh root@${verdeIP} reboot
126
269
ssh root@${neroIP} reboot
127
270
ssh root@${bluIP} reboot
128
271
ssh root@${bianco43IP} reboot
129
272
}
130
273
131
- function build_hostapd ()
274
+ function dev_packages_paths ()
132
275
{
133
- pushd " $mBuildDir "
276
+ echo package/network/config/netifd \
277
+ package/network/config/wifi-scripts \
278
+ package/network/services/hostapd
279
+ }
134
280
135
- make package/network/services/hostapd/clean
136
- make package/network/services/hostapd/compile ||
137
- make package/network/services/hostapd/compile -j1 V=s
281
+ function clean_packages()
282
+ {
283
+ pushd " $OPENWRT_BUILD_DIR "
284
+
285
+ for mPackagePath in $( dev_packages_paths) ; do
286
+ make $mPackagePath /clean
287
+ done
138
288
139
289
popd
140
290
}
141
291
142
- function upgrade_hostapd ()
292
+ function build_packages ()
143
293
{
144
- dAddress=" $1 "
145
- mHostapdPkgPath=" $( ls $mBuildDir /bin/packages/mips_24kc/base/wpad-basic-* .ipk) "
294
+ clean_packages
295
+
296
+ pushd " $OPENWRT_BUILD_DIR "
146
297
147
- scp -O " $mHostapdPkgPath " root@[${dAddress} ]:/tmp/
298
+ for mPackagePath in $( dev_packages_paths) ; do
299
+ make $mPackagePath /compile ||
300
+ {
301
+ make $mPackagePath /compile -j1 V=sc
302
+ return -1
303
+ }
304
+ done
148
305
149
- ssh root@ ${dAddress} " opkg install --force-reinstall \" /tmp/ $( basename $mHostapdPkgPath ) \" && reboot "
306
+ popd
150
307
}
151
308
152
- function upgrade_hostapd_all ()
309
+ function upgrade_packages ()
153
310
{
154
- upgrade_hostapd $verdeIP
155
- upgrade_hostapd ${neroIP}
156
- upgrade_hostapd $bluIP
157
- upgrade_hostapd ${bianco43IP}
311
+ local dAddress=" $1 "
312
+ local dPkgArch=" ${2:- mipsel_24kc} "
313
+
314
+ local mInstalls=" "
315
+
316
+ for mPackageName in \
317
+ netifd \
318
+ hostapd-common wpad-basic-mbedtls wifi-scripts ; do
319
+
320
+ local mPkgPath=" $( ls " $OPENWRT_BUILD_DIR /bin/packages/$dPkgArch /base/$mPackageName " * .ipk) "
321
+ scp -O " $mPkgPath " root@[${dAddress} ]:/tmp/
322
+
323
+ mInstalls=" $mInstalls \" /tmp/$( basename $mPkgPath ) \" "
324
+ done
325
+
326
+ ssh root@${dAddress} " opkg install --force-reinstall $mInstalls && reboot"
327
+ }
328
+
329
+ function upgrade_packages_all()
330
+ {
331
+ upgrade_packages ${hlk1Ipll}
332
+ upgrade_packages ${hlk2Ipll}
333
+
334
+ # upgrade_hostapd ${dax1Ipll}
335
+ # upgrade_hostapd ${dax2Ipll}
336
+
337
+ # upgrade_hostapd $verdeIP
338
+ # upgrade_hostapd ${neroIP}
339
+ # upgrade_hostapd $bluIP
340
+ # upgrade_hostapd ${bianco43IP}
158
341
159
342
sleep 5s
160
343
@@ -165,23 +348,58 @@ function errcho() { >&2 echo $@; }
165
348
166
349
function dTestMulticast()
167
350
{
168
- dAddress=" $1 "
351
+ local dAddress=" $1 "
169
352
170
353
[ " 0$( ssh root@${dAddress} ping6 -c 4 ff02::1%phy0-ap0.sta1 | \
171
354
grep duplicates | awk ' {print $7}' ) " -gt " 1" ] ||
172
- { errcho dTestMulticast $1 Failed ; return -1 ; }
173
- errcho dTestMulticast $1 Success
355
+ { errcho dTestMulticast $dAddress Failed ; return -1 ; }
356
+ errcho dTestMulticast $dAddress Success
174
357
}
175
358
359
+ function dTestIperf3()
360
+ {
361
+ local clientAddress=" $1 "
362
+ local servAddress=" $2 "
363
+ local servIfaceAddress=" $3 "
364
+
365
+ ssh root@${servAddress} iperf3 -s
366
+ ssh root@${clientAddress} iperf3 -c $servIfaceAddress
367
+ }
368
+
369
+ function dTestUbusDev()
370
+ {
371
+ local dAddress=" $1 "
372
+
373
+ ssh root@${dAddress} reboot ; sleep 10
374
+
375
+ dWait ${dAddress}
376
+
377
+ ssh root@${dAddress} << REMOTE_HOST_EOS
378
+ ubus call network add_dynamic_device '{"name":"nomestru", "type":"8021ad", "ifname":"wlan0.peer1", "vid":"47"}'
379
+ ubus call network add_dynamic '{"name":"ifstru", "proto":"static", "auto":1, "device":"nomestru", "ipaddr":"169.254.145.20", "netmask":"255.255.255.255"}'
380
+ ubus call network.interface.ifstru up
381
+ ubus call network.device status '{"name":"nomestru"}'
382
+
383
+ ip address show nomestru
384
+ REMOTE_HOST_EOS
385
+ }
386
+
387
+ # fBuildDapX
388
+ # fBuildHlk
389
+
176
390
# flash_all
177
- # conf_all
178
391
179
- build_hostapd
180
- conf_all
181
- upgrade_hostapd_all
392
+ # build_packages
393
+ # upgrade_packages_all
394
+
395
+ dTestUbusDev ${hlk1Ipll}
396
+
397
+ # conf_all
182
398
183
- dTestMulticast $bluIP
184
- dTestMulticast $verdeIP
185
- dTestMulticast $bianco43IP
186
- dTestMulticast $neroIP
399
+ # dTestMulticast ${dax1Ipll}
400
+ # dTestMulticast ${dax2Ipll}
187
401
402
+ # dTestMulticast $bluIP
403
+ # dTestMulticast $verdeIP
404
+ # dTestMulticast $bianco43IP
405
+ # dTestMulticast $neroIP
0 commit comments