forked from shiyu1314/openwrt-rax3000m
-
Notifications
You must be signed in to change notification settings - Fork 5
278 lines (250 loc) · 10.6 KB
/
Copy pathopen_xr30.yaml
File metadata and controls
278 lines (250 loc) · 10.6 KB
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
name: op-xr30
on:
workflow_dispatch:
inputs:
OP_IP:
description: 'Static IP address'
required: false
default: '192.168.2.1'
type: string
OP_author:
description: 'Build author'
required: false
default: 'kubulama'
type: string
CUSTOM_PLUGINS:
description: 'Extra package names separated by spaces'
required: false
default: 'luci-app-zerotier luci-app-socat luci-app-samba4 luci-theme-m3e luci-app-ttyd luci-app-diskman'
type: string
permissions:
contents: write
env:
DIY_P1_SH: sh/op.sh
jobs:
build_firmware:
name: build XR30 eMMC with kenzok8 daede
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
device: ["xr30-emmc-daede"]
source: ["openwrt"]
include:
- device: "xr30-emmc-daede"
config: "CONFIG_TARGET_DEVICE_mediatek_filogic_DEVICE_cmcc_xr30-emmc=y"
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Free disk space
run: |
sudo rm -rf /etc/apt/sources.list.d
sudo swapoff -a
sudo rm -f /swapfile /mnt/swapfile
sudo docker image prune -a -f
sudo systemctl stop docker
sudo snap set system refresh.retain=2
sudo apt-get -y purge firefox clang* ghc* google* llvm* mono* mongo* mysql* php*
sudo apt-get -y autoremove --purge
sudo apt-get clean
sudo rm -rf /etc/mysql /etc/php /usr/lib/jvm /usr/libexec/docker /usr/local /usr/src/* /var/lib/docker /var/lib/gems /var/lib/mysql /var/lib/snapd /etc/skel /opt/{microsoft,az,hostedtoolcache,cni,mssql-tools,pipx} /usr/share/{az*,dotnet,swift,miniconda,gradle*,java,kotlinc,ri,sbt} /root/{.sbt,.local,.npm}
sudo sed -i '/NVM_DIR/d;/skel/d' /root/{.bashrc,.profile}
rm -rf ~/{.cargo,.dotnet,.rustup}
df -Th
- name: Install build dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get install -y tar build-essential flex bison cmake g++ gawk gcc-multilib g++-multilib gettext git libfuse-dev libncurses5-dev libssl-dev python3 python3-pip python3-ply python3-distutils python3-pyelftools rsync unzip zlib1g-dev file wget subversion patch upx-ucl autoconf automake curl asciidoc binutils bzip2 lib32gcc-s1 libc6-dev-i386 uglifyjs msmtp texinfo libreadline-dev libglib2.0-dev xmlto libelf-dev libtool autopoint antlr3 gperf ccache swig coreutils haveged scons libpython3-dev rename qemu-utils clang llvm
sudo apt-get clean
git config --global user.name 'GitHub Actions'
git config --global user.email 'noreply@github.com'
sudo timedatectl set-timezone 'Asia/Shanghai'
sudo mkdir -p /workdir
sudo chown $USER:$GROUPS /workdir
df -Th
- name: Set variables
run: |
TAG="$(date +'%Y%m%d')"
echo "tag=$TAG" >> $GITHUB_ENV
echo "OP_IP=${{ github.event.inputs.OP_IP }}" >> $GITHUB_ENV
echo "OP_author=${{ github.event.inputs.OP_author }}" >> $GITHUB_ENV
echo "CUSTOM_PLUGINS=${{ github.event.inputs.CUSTOM_PLUGINS }}" >> $GITHUB_ENV
echo "DEVICE_NAME=${{ matrix.device }}" >> $GITHUB_ENV
echo "SOURCE_NAME=${{ matrix.source }}" >> $GITHUB_ENV
echo "REPO_URL=https://github.com/shiyu1314/openwrt-source" >> $GITHUB_ENV
echo "REPO_BRANCH=openwrt-25.12" >> $GITHUB_ENV
- name: Clone source
working-directory: /workdir
run: |
df -hT $PWD
git clone $REPO_URL $SOURCE_NAME
ln -sf /workdir/$SOURCE_NAME $GITHUB_WORKSPACE/$SOURCE_NAME
- name: Checkout source tag
run: |
cd $SOURCE_NAME
case $REPO_BRANCH in
openwrt-25.12)
_release_tag=$(git tag --sort=taggerdate --list 'v25.*' | tail -1)
git checkout $_release_tag
;;
*)
echo "Can't get local/upstream branch or tag"
exit 1
;;
esac
echo "release_tag=$_release_tag" >> $GITHUB_ENV
- name: Restore build cache
id: build-cache
uses: actions/cache/restore@v5
with:
path: |
${{ matrix.source }}/dl
${{ matrix.source }}/staging_dir
${{ matrix.source }}/build_dir/host
${{ matrix.source }}/build_dir/hostpkg
${{ matrix.source }}/build_dir/toolchain-*
${{ matrix.source }}/bin/packages
${{ matrix.source }}/bin/targets
key: ${{ matrix.source }}-${{ matrix.device }}-build-cache-${{ github.run_id }}
restore-keys: |
${{ matrix.source }}-${{ matrix.device }}-build-cache-
${{ matrix.source }}-xr30-emmc-build-cache-
${{ matrix.source }}-mt7981-multi-build-cache-
- name: Validate toolchain cache
run: |
cd $SOURCE_NAME
if [ -d staging_dir ] && ! find staging_dir -path '*/toolchain-*/lib/libgcc_s.so.*' | grep -q .; then
echo "::warning::Restored toolchain cache is incomplete; rebuilding toolchain only."
rm -rf staging_dir/toolchain-* build_dir/toolchain-* build_dir/target-*/toolchain
rm -f staging_dir/target-*/pkginfo/toolchain.* staging_dir/target-*/stamp/.toolchain_installed
fi
rm -rf dl/go-mod-cache
- name: Prepare feeds and patches
run: |
set -x
cd $SOURCE_NAME
[ -d ./staging_dir ] && find ./staging_dir/ -name '*' -exec touch {} \; >/dev/null 2>&1 || true
./scripts/feeds update -a
cd ..
[ -e patch ] && cp -rf patch/diy/*.patch $SOURCE_NAME
[ -e patch ] && cp -rf patch/luci/*.patch $SOURCE_NAME/feeds/luci
- name: Run common custom script
run: |
chmod +x $DIY_P1_SH
cd $SOURCE_NAME
$GITHUB_WORKSPACE/$DIY_P1_SH
cd ..
[ -e patch ] && cp -rf patch/nginx/luci.locations $SOURCE_NAME/feeds/packages/net/nginx/files-luci-support
[ -e patch ] && cp -rf patch/nginx/uci.conf.template $SOURCE_NAME/feeds/packages/net/nginx-util/files
- name: Use kenzok8 daede source packages
run: |
rm -rf $SOURCE_NAME/package/porxy/dae $SOURCE_NAME/package/porxy/daed $SOURCE_NAME/package/porxy/luci-app-daede
git clone --depth=1 https://github.com/kenzok8/openwrt-daede daede-src
mv daede-src/dae daede-src/daed daede-src/luci-app-daede $SOURCE_NAME/package/porxy/
rm -rf daede-src
- name: Load XR30 eMMC config
run: |
[ -e files ] && mv files $SOURCE_NAME/files
rm -f $SOURCE_NAME/files/etc/uci-defaults/98-install-daed-runfiles
cat <<EOF >>$SOURCE_NAME/.config
CONFIG_TARGET_mediatek=y
CONFIG_TARGET_mediatek_filogic=y
${{ matrix.config }}
EOF
[ -e config ] && cat config/config-common >> $SOURCE_NAME/.config
cat <<EOF >>$SOURCE_NAME/.config
CONFIG_PACKAGE_luci-app-daede=y
CONFIG_PACKAGE_luci-app-daede_daed=y
# CONFIG_PACKAGE_luci-app-daede_dae is not set
CONFIG_PACKAGE_daed=y
CONFIG_DAED_USE_KERNEL_BTF=y
# CONFIG_DAED_USE_VMLINUX_BTF is not set
EOF
sed -i "s/192.168.1.1/${{ github.event.inputs.OP_IP }}/" $SOURCE_NAME/package/base-files/files/bin/config_generate
IFS=' ' read -r -a plugins <<< "${{ github.event.inputs.CUSTOM_PLUGINS }}"
for plugin in "${plugins[@]}"; do
case "$plugin" in
luci-app-daed|luci-i18n-daed-zh-cn|luci-app-daede|daed|dae)
continue
;;
esac
echo "CONFIG_PACKAGE_${plugin}=y" >> $SOURCE_NAME/.config
done
- name: Download package sources
id: package
run: |
cd $SOURCE_NAME
make defconfig
make download -j8
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: BPF/LLVM early checkpoint
run: |
cd $SOURCE_NAME
trap 'echo "::group::BPF checkpoint diagnostics"; find staging_dir -maxdepth 4 \( -path "*/toolchain-*" -o -name "libgcc_s.so*" -o -name "*.toolchain*" \) -print 2>/dev/null || true; find build_dir -maxdepth 3 \( -path "*/toolchain*" -o -path "*/bpf-headers*" \) -print 2>/dev/null || true; echo "::endgroup::"' ERR
clang --version || true
grep -E 'CONFIG_(BPF_TOOLCHAIN|USE_LLVM|HAS_BPF|SDK_LLVM|KERNEL_DEBUG_INFO|KERNEL_BPF|KERNEL_CGROUP_BPF|KERNEL_XDP|DAE.*BTF|DAE.*BPF_DEPENDS)' .config || true
make tools/install -j$(nproc) || yes n | make tools/install -j1 V=s
make toolchain/install -j$(nproc) || yes n | make toolchain/install -j1 V=s
make target/compile -j$(nproc) || yes n | make target/compile -j1 V=s
make package/kernel/bpf-headers/compile V=s || yes n | make package/kernel/bpf-headers/compile V=s
- name: Compile firmware
id: compile
run: |
cd $SOURCE_NAME
echo -e "$(nproc) thread compile"
make -j$(nproc) || yes n | make -j1 || yes n | make -j1 V=s
- name: Clean volatile Go module cache
if: always()
run: |
cd $SOURCE_NAME
rm -rf dl/go-mod-cache
- name: Save build cache
if: always()
uses: actions/cache/save@v5
with:
path: |
${{ matrix.source }}/dl
${{ matrix.source }}/staging_dir
${{ matrix.source }}/build_dir/host
${{ matrix.source }}/build_dir/hostpkg
${{ matrix.source }}/build_dir/toolchain-*
${{ matrix.source }}/bin/packages
${{ matrix.source }}/bin/targets
key: ${{ matrix.source }}-${{ matrix.device }}-build-cache-${{ github.run_id }}
- name: Show disk usage
if: (!cancelled())
run: df -hT
- name: Organize firmware
id: organize
run: |
cd $SOURCE_NAME/bin/targets/*/*
rm -rf packages
rm -rf *.buildinfo
rm -rf profiles.json
rm -rf *.manifest
rm -rf *.itb
rm -rf *bl2.bin
rm -rf *kernel.bin
rm -rf *.sha
rm -rf sha256sums
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
- name: Upload firmware to Releases
uses: softprops/action-gh-release@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.release_tag }}-${{ env.tag }}-op-xr30
files: ${{ env.FIRMWARE }}/*
body: |
==================== Firmware Info =======================
Workflow: op-xr30
Device: XR30 eMMC
Branch: ${{ env.release_tag }}
Static IP: ${{ github.event.inputs.OP_IP }}
Extra packages: ${{ github.event.inputs.CUSTOM_PLUGINS }}
daed source: kenzok8/openwrt-daede
Author: ${{ github.event.inputs.OP_author }}
Default password: none