-
Notifications
You must be signed in to change notification settings - Fork 7
387 lines (366 loc) · 15.1 KB
/
build_image_mt7981.yml
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
378
379
380
381
382
383
384
385
386
387
name: BuildImage-MT7981
on:
workflow_dispatch:
push:
schedule:
- cron: "0 21 * * *"
jobs:
build_openclash:
strategy:
fail-fast: false
matrix:
version: [master, 23.05.3]
arch: [mediatek-filogic]
name: Build OpenClash for OpenWRT-${{ matrix.arch }}-${{ matrix.version }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@v8
with:
root-reserve-mb: 1024
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: modify docker path
run: |
sudo systemctl stop docker.socket
sudo systemctl stop docker
sudo mkdir -p ${{ github.workspace }}/docker
sudo mv /var/lib/docker ${{ github.workspace }}/docker
sudo ln -sf ${{ github.workspace }}/docker /var/lib/docker
sudo systemctl start docker
- name: Run Make
run: |
chmod +x ${{ github.workspace }}/build_clash.sh
mkdir -p ${{ github.workspace }}/openclash
docker run -i --name openwrt-sdk-${{ matrix.arch }}-${{ matrix.version }} --user root -v ${{ github.workspace }}/build_clash.sh:/build_clash.sh -v ${{ github.workspace }}/openclash/:/openclash/ openwrt/sdk:${{ matrix.arch }}-${{ matrix.version }} /build_clash.sh
- uses: actions/upload-artifact@v3
with:
name: openclash-${{ matrix.arch }}-${{ matrix.version }}
path: openclash
build_passwall:
strategy:
fail-fast: false
matrix:
version: [master, 23.05.3]
arch: [mediatek-filogic]
name: Build Passwall for OpenWRT-${{ matrix.arch }}-${{ matrix.version }}
runs-on: ubuntu-latest
container:
image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.version }}
options: --user root
defaults:
run:
shell: bash
steps:
- name: Install golang
run: |
# VERSION=`curl -L https://golang.org/VERSION?m=text|awk 'NR==1{print $0}'`
VERSION="go1.20.3"
wget https://go.dev/dl/$VERSION.linux-amd64.tar.gz
rm -rf /usr/local/go
tar -C /usr/local -xzf $VERSION.linux-amd64.tar.gz
rm -rf $VERSION.linux-amd64.tar.gz
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/go/bin
go version
- name: Run Make
run: |
export VOLUME_HOME=$(pwd)
export BUILD_DIR="/builder"
export BUILDER="buildbot"
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/go/bin
cd $BUILD_DIR
apt-get update
apt install sudo -y
sudo -u $BUILDER echo "src-git passwall https://github.com/xiaorouji/openwrt-passwall.git;main" >> "feeds.conf.default"
sudo -u $BUILDER echo "src-git passwall_packages https://github.com/xiaorouji/openwrt-passwall-packages.git;main" >> "feeds.conf.default"
chown -R $BUILDER:$BUILDER $BUILD_DIR
while ! sudo -u $BUILDER ./scripts/feeds update -a; do echo "Try again"; done
sudo -u $BUILDER ./scripts/feeds install luci-app-passwall
sudo -u $BUILDER make defconfig
### enable all passwall packages
# sudo -u $BUILDER sed -i "s/# \(CONFIG_PACKAGE_luci-app-passwall_.*\) is not set/\1=y/g" .config
### disable singbox
# sudo -u $BUILDER sed -i '/CONFIG_PACKAGE_luci-app-passwall_INCLUDE_SingBox=y/ s/=y/=n/' .config
### disable v2ray-plugin
# sudo -u $BUILDER sed -i '/CONFIG_PACKAGE_luci-app-passwall_INCLUDE_V2ray_Plugin=y/ s/=y/=n/' .config
### set golang external bootstrap root
# sed -i 's|CONFIG_GOLANG_EXTERNAL_BOOTSTRAP_ROOT=""|CONFIG_GOLANG_EXTERNAL_BOOTSTRAP_ROOT="/usr/local/go"|' .config
sudo -u $BUILDER make package/luci-app-passwall/compile V=99 -j1 || cat logs/feeds/passwall/luci-app-passwall/dump.txt
mkdir -p $VOLUME_HOME/passwall
cp -r bin/packages/*/passwall/* $VOLUME_HOME/passwall
cp -r bin/packages/*/passwall_packages/* $VOLUME_HOME/passwall
### do not copy all packages, just copy passwall and passwall_packages
# cp -r bin/packages/*/packages/* $VOLUME_HOME/passwall
# cp -r bin/packages $VOLUME_HOME/passwall
- name: Debug Print
run: |
export VOLUME_HOME=$(pwd)
export BUILD_DIR="/builder"
export BUILDER="buildbot"
export PATH=$PATH:/usr/local/go/bin
cd $BUILD_DIR
apt-get update
apt install tree -y
tree bin/packages
- uses: actions/upload-artifact@v3
with:
name: passwall-${{ matrix.arch }}-${{ matrix.version }}
path: passwall
build_theme_argon:
strategy:
fail-fast: false
matrix:
version: [master, 23.05.3]
arch: [mediatek-filogic]
name: Build Argon for OpenWRT-${{ matrix.arch }}-${{ matrix.version }}
runs-on: ubuntu-latest
container:
image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.version }}
options: --user root
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Run Make
run: |
export VOLUME_HOME=$(pwd)
export BUILD_DIR="/builder"
export BUILDER="buildbot"
cd $BUILD_DIR
apt-get update
apt install sudo -y
sudo -u $BUILDER git clone https://github.com/jerrykuku/luci-theme-argon.git package/luci-theme-argon
while ! sudo -u $BUILDER ./scripts/feeds update -a; do echo "Try again"; done
sudo -u $BUILDER make defconfig
sudo -u $BUILDER make package/luci-theme-argon/compile V=s -j1
mkdir -p $VOLUME_HOME/luci-theme-argon
cp bin/packages/*/base/luci-theme-argon*.ipk $VOLUME_HOME/luci-theme-argon/
- uses: actions/upload-artifact@v3
with:
name: luci-theme-argon-${{ matrix.arch }}-${{ matrix.version }}
path: luci-theme-argon
# luci app netdata has some bugs, so just not use it for now!
build_luci_app_netdata:
strategy:
fail-fast: false
matrix:
version: [master, 23.05.3]
arch: [mediatek-filogic]
name: Build Luci App Netdata for OpenWRT-${{ matrix.arch }}-${{ matrix.version }}
runs-on: ubuntu-latest
container:
image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.version }}
options: --user root
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Run Make
run: |
export VOLUME_HOME=$(pwd)
export BUILD_DIR="/builder"
export BUILDER="buildbot"
cd $BUILD_DIR
apt-get update
apt install sudo -y
sudo -u $BUILDER git clone https://github.com/sirpdboy/luci-app-netdata package/luci-app-netdata
while ! sudo -u $BUILDER ./scripts/feeds update -a; do echo "Try again"; done
sudo -u $BUILDER ./scripts/feeds install -a
sudo -u $BUILDER make defconfig
sudo -u $BUILDER make package/luci-app-netdata/compile V=s -j1
mkdir -p $VOLUME_HOME/luci-app-netdata
cp bin/packages/*/base/luci-app-netdata*.ipk $VOLUME_HOME/luci-app-netdata/
- uses: actions/upload-artifact@v3
with:
name: luci-app-netdata-${{ matrix.arch }}-${{ matrix.version }}
path: luci-app-netdata
build_5G:
strategy:
fail-fast: false
matrix:
version: [master, 23.05.3]
arch: [mediatek-filogic]
name: Build 5G Package for OpenWRT-${{ matrix.arch }}-${{ matrix.version }}
runs-on: ubuntu-latest
container:
image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.version }}
options: --user root
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Run Make
run: |
export VOLUME_HOME=$(pwd)
export BUILD_DIR="/builder"
export BUILDER="buildbot"
cd $BUILD_DIR
apt-get update
apt install sudo -y
sudo -u $BUILDER cp -r $VOLUME_HOME/nradio/luci-app-zmodem package/luci-app-zmodem
sudo -u $BUILDER cp -r $VOLUME_HOME/nradio/luci-app-sms-tool package/luci-app-sms-tool
sudo -u $BUILDER cp -r $VOLUME_HOME/nradio/sendat package/sendat
sudo -u $BUILDER cp -r $VOLUME_HOME/nradio/sms-tool package/sms-tool
while ! sudo -u $BUILDER ./scripts/feeds update -a; do echo "Try again"; done
while ! sudo -u $BUILDER ./scripts/feeds install -a; do echo "Try again"; done
sudo -u $BUILDER make defconfig
sudo -u $BUILDER make package/luci-app-zmodem/compile V=s -j1
sudo -u $BUILDER make package/luci-app-sms-tool/compile V=s -j1
sudo -u $BUILDER make package/sendat/compile V=s -j1
sudo -u $BUILDER make package/sms-tool/compile V=s -j1
mkdir -p $VOLUME_HOME/package_5g
cp bin/packages/*/base/luci-i18n-sms-tool-zh-cn*.ipk $VOLUME_HOME/package_5g/
cp bin/packages/*/base/luci-app-sms-tool*.ipk $VOLUME_HOME/package_5g/
cp bin/packages/*/base/sms-tool*.ipk $VOLUME_HOME/package_5g/
cp bin/packages/*/base/sendat*.ipk $VOLUME_HOME/package_5g/
cp bin/packages/*/base/luci-app-zmodem*.ipk $VOLUME_HOME/package_5g/
- uses: actions/upload-artifact@v3
with:
name: package_5g-${{ matrix.arch }}-${{ matrix.version }}
path: package_5g
build_image:
strategy:
fail-fast: false
matrix:
version: [master, 23.05.3]
arch: [mediatek-filogic]
if: ${{ always() }}
needs: [build_passwall, build_theme_argon, build_luci_app_netdata, build_openclash, build_5G]
name: Build Image for OpenWRT-${{ matrix.arch }}-${{ matrix.version }}
runs-on: ubuntu-latest
# container:
# image: openwrt/imagebuilder:${{ matrix.arch }}-${{ matrix.version }}
# options: --user root
defaults:
run:
shell: bash
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@v8
with:
root-reserve-mb: 1024
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: passwall-${{ matrix.arch }}-${{ matrix.version }}
- uses: actions/download-artifact@v3
with:
name: luci-theme-argon-${{ matrix.arch }}-${{ matrix.version }}
- uses: actions/download-artifact@v3
with:
name: openclash-${{ matrix.arch }}-${{ matrix.version }}
- uses: actions/download-artifact@v3
with:
name: package_5g-${{ matrix.arch }}-${{ matrix.version }}
# - uses: actions/download-artifact@v3
# with:
# name: luci-app-netdata
- name: modify docker path
run: |
sudo systemctl stop docker.socket
sudo systemctl stop docker
sudo mkdir -p ${{ github.workspace }}/docker
sudo mv /var/lib/docker ${{ github.workspace }}/docker
sudo ln -sf ${{ github.workspace }}/docker /var/lib/docker
sudo systemctl start docker
- name: Prepare Packages
run: |
export VOLUME_HOME=${{ github.workspace }}
export BUILD_DIR="/builder"
export BUILDER="buildbot"
mkdir -p $VOLUME_HOME/mypackages
mv $VOLUME_HOME/*.ipk $VOLUME_HOME/mypackages/
# - name: Prepare DTS
# run: |
# cat << EOF >> /builder/target/linux/mediatek/image/filogic.mk
#
# define Device/nradio_c8-668
# DEVICE_VENDOR := NRadio
# DEVICE_MODEL := C8-668
# DEVICE_DTS := mt7981-nradio-wt9108
# DEVICE_DTS_DIR := ../dts
# UBINIZE_OPTS := -E 5
# BLOCKSIZE := 128k
# PAGESIZE := 2048
# IMAGE_SIZE := 65536k
# KERNEL_IN_UBI := 1
# IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
# DEVICE_PACKAGES := kmod-usb3 kmod-mt7981-firmware mt7981-wo-firmware
# endef
# TARGET_DEVICES += nradio_c8-668
#
# EOF
#
# cat /builder/target/linux/mediatek/image/filogic.mk
#
# cp ${{ github.workspace }}/nradio/dts/* /builder/target/linux/mediatek/dts/
- name: Set profile
run: |
echo "profile=nradio_c8-668" >> $GITHUB_ENV
- name: Make Image
run: |
export VOLUME_HOME=${{ github.workspace }}
export BUILD_DIR="/builder"
export BUILDER="buildbot"
chmod +x $VOLUME_HOME/build_image.sh
docker run -i --name openwrt-imagebuilder-${{ matrix.arch }}-${{ matrix.version }} \
--user root \
-v $VOLUME_HOME/mypackages/:$BUILD_DIR/packages/mypackages/ \
-v $VOLUME_HOME/openwrt_output/:/openwrt_output/ \
-v $VOLUME_HOME/build_image.sh:/build_image.sh \
-e PROFILE=${{ env.profile }} \
-e PACKAGES="${{ env.packages }}" \
-e ROOTFS_SIZE=${{ env.rootfs_size }} \
-e KERNEL_SIZE=${{ env.kernel_size }} \
-e ARCH=${{ matrix.arch }} \
-e VERSION=${{ matrix.version }} \
openwrt/imagebuilder:${{ matrix.arch }}-${{ matrix.version }} /build_image.sh
env:
rootfs_size: 4096
kernel_size: 256
packages: luci luci-app-qos luci-app-upnp luci-proto-ipv6 kmod-igc kmod-mt7921e
luci-i18n-base-zh-cn netdata luci-app-ttyd pciutils
coreutils-timeout lm-sensors lm-sensors-detect fdisk shadow-useradd -dnsmasq
vim python3 python3-yaml sudo ipset samba4-server
openvpn-openssl luci-app-openvpn lsof kmod-usb-storage block-mount lsblk luci-app-samba4
tcpdump zstd tmux bash netcat ip6tables-mod-nat iptables-mod-tproxy dnsmasq-full
xl2tpd tailscale kmod-loop nfs-kernel-server iptables-mod-socket
iptables-mod-iprange mwan3 luci-app-mwan3 kmod-nft-socket kmod-nft-tproxy kmod-nft-nat
wireguard-tools kmod-wireguard luci-app-wireguard luci-proto-wireguard
base-files busybox ca-bundle dropbear e2fsprogs f2fsck firewall4 fstools kmod-crypto-hw-safexcel kmod-gpio-button-hotplug kmod-leds-gpio kmod-mt7915e kmod-mt7981-firmware kmod-nft-offload kmod-phy-aquantia kmod-usb3 libc libgcc libustream-mbedtls logd luci mkf2fs mt7981-wo-firmware mtd netifd nftables odhcp6c odhcpd-ipv6only opkg ppp ppp-mod-pppoe procd procd-seccomp procd-ujail uboot-envtools uci uclient-fetch urandom-seed urngd wpad-basic-mbedtls
# docker dockerd docker-compose
# luci-theme-argon ntpclient luci-app-ntpc hostapd
# chinadns-ng dns2socks dns2tcp luci-app-passwall luci-i18n-passwall-zh-cn microsocks
# shadowsocksr-libev-ssr-check shadowsocksr-libev-ssr-local shadowsocksr-libev-ssr-nat
# shadowsocksr-libev-ssr-redir shadowsocksr-libev-ssr-server simple-obfs-server simple-obfs
# tcping trojan-plus v2ray-core v2ray-example v2ray-extra v2ray-plugin
# open-vm-tools
- uses: actions/upload-artifact@v3
with:
name: openwrt-${{ matrix.arch }}-${{ matrix.version }}
path: openwrt_output