-
Notifications
You must be signed in to change notification settings - Fork 26
348 lines (305 loc) · 17 KB
/
ci.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
name: xuantie-kernel-ci
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 2 * * *"
env:
xt64_toolchain: https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1715148262346
xt64_toolchain_file_name: Xuantie-900-gcc-linux-6.6.0-glibc-x86_64-V2.10.0-20240419.tar.gz
rv32_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.04.12
rv32_toolchain_file_name: riscv32-glibc-ubuntu-22.04-gcc-nightly-2024.04.12-nightly.tar.gz
rv64_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.04.12
rv64_toolchain_file_name: riscv64-glibc-ubuntu-22.04-gcc-nightly-2024.04.12-nightly.tar.gz
rv64ilp32_toolchain: https://github.com/ruyisdk/riscv-gnu-toolchain-rv64ilp32/releases/download/2024.03.08
rv64ilp32_toolchain_file_name: riscv64ilp32-elf-ubuntu-22.04-gcc-nightly-2024.03.08-nightly.tar.gz
jobs:
kernel-build:
strategy:
fail-fast: false
matrix:
include:
- name: linux-32ilp32
toolchain_tripe: riscv32-unknown-linux-gnu-
- name: linux-64lp64
toolchain_tripe: riscv64-unknown-linux-gnu-
- name: linux-64ilp32
toolchain_tripe: riscv64-unknown-elf-
- name: linux-64lp64-dirty
toolchain_tripe: riscv64-unknown-linux-gnu-
- name: linux-32ilp32-dirty
toolchain_tripe: riscv32-unknown-linux-gnu-
# - name: linux-64ilp32_12hz
# toolchain_tripe: riscv64-unknown-elf-
# - name: linux-64lp64-dirty_12hz
# toolchain_tripe: riscv64-unknown-linux-gnu-
# - name: linux-32ilp32-dirty_12hz
# toolchain_tripe: riscv32-unknown-linux-gnu-
runs-on: ubuntu-22.04
env:
CROSS_COMPILE: ${{ matrix.toolchain_tripe }}
steps:
- name: Install software
run: |
sudo apt update && \
sudo apt install -y build-essential
- name: Checkout source
uses: actions/checkout@v4
- name: Configure toolchains
run: |
if [ x"${{ matrix.name }}" = x"linux-32ilp32" ]; then
wget ${rv32_toolchain}/${rv32_toolchain_file_name}
tar -xvf ${rv32_toolchain_file_name} -C /opt
rm -v ${rv32_toolchain_file_name}
fi
if [ x"${{ matrix.name }}" = x"linux-64lp64" ]; then
wget ${rv64_toolchain}/${rv64_toolchain_file_name}
tar -xvf ${rv64_toolchain_file_name} -C /opt
rm -v ${rv64_toolchain_file_name}
fi
if [ x"${{ matrix.name }}" = x"linux-64ilp32" ]; then
wget ${rv64ilp32_toolchain}/${rv64ilp32_toolchain_file_name}
tar -xvf ${rv64ilp32_toolchain_file_name} -C /opt
rm -v ${rv64ilp32_toolchain_file_name}
fi
if [ x"${{ matrix.name }}" = x"linux-64lp64-dirty" ]; then
wget ${rv64_toolchain}/${rv64_toolchain_file_name}
tar -xvf ${rv64_toolchain_file_name} -C /opt
rm -v ${rv64_toolchain_file_name}
fi
if [ x"${{ matrix.name }}" = x"linux-32ilp32-dirty" ]; then
wget ${rv32_toolchain}/${rv32_toolchain_file_name}
tar -xvf ${rv32_toolchain_file_name} -C /opt
rm -v ${rv32_toolchain_file_name}
fi
if [ x"${{ matrix.name }}" = x"linux-64ilp32_12hz" ]; then
wget ${rv64ilp32_toolchain}/${rv64ilp32_toolchain_file_name}
tar -xvf ${rv64ilp32_toolchain_file_name} -C /opt
rm -v ${rv64ilp32_toolchain_file_name}
fi
if [ x"${{ matrix.name }}" = x"linux-64lp64-dirty_12hz" ]; then
wget ${rv64_toolchain}/${rv64_toolchain_file_name}
tar -xvf ${rv64_toolchain_file_name} -C /opt
rm -v ${rv64_toolchain_file_name}
fi
if [ x"${{ matrix.name }}" = x"linux-32ilp32-dirty_12hz" ]; then
wget ${rv32_toolchain}/${rv32_toolchain_file_name}
tar -xvf ${rv32_toolchain_file_name} -C /opt
rm -v ${rv32_toolchain_file_name}
fi
- name: Compile
run: |
if [ x"${{ matrix.name }}" = x"linux-32ilp32" ]; then
export PATH="/opt/riscv/bin:$PATH"
wget https://github.com/torvalds/linux/archive/ffc253263a1375a65fa6c9f62a893e9767fbebfa.tar.gz
tar zxf ffc253263a1375a65fa6c9f62a893e9767fbebfa.tar.gz
mv linux-ffc253263a1375a65fa6c9f62a893e9767fbebfa linux-6.6
cp arch/riscv/configs/defconfig linux-6.6/arch/riscv/configs/defconfig
cd linux-6.6
make ARCH=riscv EXTRA_CFLAGS+=-Werror EXTRA_CFLAGS+=-g rv32_defconfig all INSTALL_MOD_PATH=./modules_install modules_install INSTALL_HDR_PATH=./headers_install headers_install -j$(nproc)
mv arch/riscv/boot/Image ./
cp Documentation/admin-guide/kdump/gdbmacros.txt ./
tar czvf ${{ matrix.name }}.tar.gz Image vmlinux modules_install headers_install gdbmacros.txt
mv ${{ matrix.name }}.tar.gz ../
cd ..
fi
if [ x"${{ matrix.name }}" = x"linux-64lp64" ]; then
export PATH="/opt/riscv/bin:$PATH"
wget https://github.com/torvalds/linux/archive/ffc253263a1375a65fa6c9f62a893e9767fbebfa.tar.gz
tar zxf ffc253263a1375a65fa6c9f62a893e9767fbebfa.tar.gz
mv linux-ffc253263a1375a65fa6c9f62a893e9767fbebfa linux-6.6
cp arch/riscv/configs/defconfig linux-6.6/arch/riscv/configs/defconfig
cd linux-6.6
make ARCH=riscv EXTRA_CFLAGS+=-Werror EXTRA_CFLAGS+=-g defconfig all INSTALL_MOD_PATH=./modules_install modules_install INSTALL_HDR_PATH=./headers_install headers_install -j$(nproc)
mv arch/riscv/boot/Image ./
cp Documentation/admin-guide/kdump/gdbmacros.txt ./
tar czvf ${{ matrix.name }}.tar.gz Image vmlinux modules_install headers_install gdbmacros.txt
mv ${{ matrix.name }}.tar.gz ../
cd ..
fi
if [ x"${{ matrix.name }}" = x"linux-64ilp32" ]; then
export PATH="/opt/riscv/bin:$PATH"
echo CONFIG_MMU_SV32=y >> arch/riscv/configs/64ilp32.config
make ARCH=riscv EXTRA_CFLAGS+=-Werror EXTRA_CFLAGS+=-g rv64ilp32_defconfig all INSTALL_MOD_PATH=./modules_install modules_install INSTALL_HDR_PATH=./headers_install headers_install -j$(nproc)
mv arch/riscv/boot/Image ./Image_sv32xt
mv vmlinux vmlinux_sv32xt
mv headers_install headers_install_sv32xt
mv modules_install modules_install_sv32xt
git checkout arch/riscv/configs/64ilp32.config
make ARCH=riscv EXTRA_CFLAGS+=-Werror EXTRA_CFLAGS+=-g rv64ilp32_defconfig all INSTALL_MOD_PATH=./modules_install modules_install INSTALL_HDR_PATH=./headers_install headers_install -j$(nproc)
mv arch/riscv/boot/Image ./
cp Documentation/admin-guide/kdump/gdbmacros.txt ./
git log --oneline -500 > git.log
tar czvf ${{ matrix.name }}.tar.gz Image vmlinux modules_install headers_install Image_sv32xt vmlinux_sv32xt modules_install_sv32xt headers_install_sv32xt git.log gdbmacros.txt
fi
if [ x"${{ matrix.name }}" = x"linux-64lp64-dirty" ]; then
export PATH="/opt/riscv/bin:$PATH"
make ARCH=riscv EXTRA_CFLAGS+=-Werror EXTRA_CFLAGS+=-g defconfig all INSTALL_MOD_PATH=./modules_install modules_install INSTALL_HDR_PATH=./headers_install headers_install -j$(nproc)
mv arch/riscv/boot/Image ./
cp Documentation/admin-guide/kdump/gdbmacros.txt ./
git log --oneline -500 > git.log
tar czvf ${{ matrix.name }}.tar.gz Image vmlinux git.log modules_install headers_install gdbmacros.txt
fi
if [ x"${{ matrix.name }}" = x"linux-32ilp32-dirty" ]; then
export PATH="/opt/riscv/bin:$PATH"
make ARCH=riscv EXTRA_CFLAGS+=-Werror EXTRA_CFLAGS+=-g rv32_defconfig all INSTALL_MOD_PATH=./modules_install modules_install INSTALL_HDR_PATH=./headers_install headers_install -j$(nproc)
mv arch/riscv/boot/Image ./
cp Documentation/admin-guide/kdump/gdbmacros.txt ./
git log --oneline -500 > git.log
tar czvf ${{ matrix.name }}.tar.gz Image vmlinux git.log modules_install headers_install gdbmacros.txt
fi
if [ x"${{ matrix.name }}" = x"linux-64ilp32_12hz" ]; then
export PATH="/opt/riscv/bin:$PATH"
echo CONFIG_HZ_12=y >> arch/riscv/configs/defconfig
echo CONFIG_MMU_SV32=y >> arch/riscv/configs/64ilp32.config
make ARCH=riscv EXTRA_CFLAGS+=-Werror EXTRA_CFLAGS+=-g rv64ilp32_defconfig all INSTALL_MOD_PATH=./modules_install modules_install INSTALL_HDR_PATH=./headers_install headers_install -j$(nproc)
mv arch/riscv/boot/Image ./Image_sv32xt
mv vmlinux vmlinux_sv32xt
mv headers_install headers_install_sv32xt
mv modules_install modules_install_sv32xt
git checkout arch/riscv/configs/64ilp32.config
make ARCH=riscv EXTRA_CFLAGS+=-Werror EXTRA_CFLAGS+=-g rv64ilp32_defconfig all INSTALL_MOD_PATH=./modules_install modules_install INSTALL_HDR_PATH=./headers_install headers_install -j$(nproc)
mv arch/riscv/boot/Image ./
cp Documentation/admin-guide/kdump/gdbmacros.txt ./
git log --oneline -500 > git.log
tar czvf ${{ matrix.name }}.tar.gz Image vmlinux modules_install headers_install Image_sv32xt vmlinux_sv32xt modules_install_sv32xt headers_install_sv32xt git.log gdbmacros.txt
fi
if [ x"${{ matrix.name }}" = x"linux-64lp64-dirty_12hz" ]; then
export PATH="/opt/riscv/bin:$PATH"
echo CONFIG_HZ_12=y >> arch/riscv/configs/defconfig
make ARCH=riscv EXTRA_CFLAGS+=-Werror EXTRA_CFLAGS+=-g defconfig all INSTALL_MOD_PATH=./modules_install modules_install INSTALL_HDR_PATH=./headers_install headers_install -j$(nproc)
mv arch/riscv/boot/Image ./
cp Documentation/admin-guide/kdump/gdbmacros.txt ./
git log --oneline -500 > git.log
tar czvf ${{ matrix.name }}.tar.gz Image vmlinux git.log modules_install headers_install gdbmacros.txt
fi
if [ x"${{ matrix.name }}" = x"linux-32ilp32-dirty_12hz" ]; then
export PATH="/opt/riscv/bin:$PATH"
echo CONFIG_HZ_12=y >> arch/riscv/configs/defconfig
make ARCH=riscv EXTRA_CFLAGS+=-Werror EXTRA_CFLAGS+=-g rv32_defconfig all INSTALL_MOD_PATH=./modules_install modules_install INSTALL_HDR_PATH=./headers_install headers_install -j$(nproc)
mv arch/riscv/boot/Image ./
cp Documentation/admin-guide/kdump/gdbmacros.txt ./
git log --oneline -500 > git.log
tar czvf ${{ matrix.name }}.tar.gz Image vmlinux git.log modules_install headers_install gdbmacros.txt
fi
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}.tar.gz
path: ${{ matrix.name }}.tar.gz
retention-days: 90
xt-qemu-64lp64:
needs: kernel-build
runs-on: ubuntu-latest
container: ghcr.io/ruyisdk/linux-xuantie-kernel/xuantie-qemu:latest
strategy:
fail-fast: false
matrix:
cpu: [ c906fdv , c907fdvm-rv64 , c908v , c920 , c920v2]
kernel: [ linux-64lp64 , linux-64lp64-dirty ]
include:
- core_count: 4
- cpu: c906fdv
core_count: 1
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.kernel }}.tar.gz
- name: Download rootfs opensbi and unpack artifacts
run: |
wget -qc https://github.com/c-sky/buildroot/releases/download/v1.0.11/rootfs_rv64.ext2.tar.gz
tar -xvf rootfs_rv64.ext2.tar.gz
wget -qc https://github.com/riscv-software-src/opensbi/releases/download/v1.4/opensbi-1.4-rv-bin.tar.xz
xz -d opensbi-1.4-rv-bin.tar.xz
tar -xvf opensbi-1.4-rv-bin.tar
mv opensbi-1.4-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin .
tar -xvf ${{ matrix.kernel }}.tar.gz
- name: Run Qemu
run: |
qemu-system-riscv64 -cpu ${{ matrix.cpu }} -nographic -smp ${{ matrix.core_count }} -M virt -bios ./fw_dynamic.bin -kernel ./Image -append 'rootwait root=/dev/vda ro' -drive file=./rootfs_rv64.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -monitor none -monitor none -serial telnet:localhost:5678,server &
- name: Check Qemu Booting Kernel
run: .github/ci_scripts/check_qemu.exp 'cat /proc/version' 180
- name: Check perf test
run: .github/ci_scripts/check_qemu.exp 'perf test -s 5,15,16,17,18,21,60,62' 180 FAILED
- name: Check perf stat
run: .github/ci_scripts/check_qemu.exp 'perf stat tar -czf test.tar.gz /bin' 60 '' seconds sys
xt-qemu-32ilp32:
needs: kernel-build
runs-on: ubuntu-latest
container: ghcr.io/ruyisdk/linux-xuantie-kernel/xuantie-qemu:latest
strategy:
fail-fast: false
matrix:
cpu: [ c907fdvm-rv32 ]
kernel: [ linux-32ilp32 , linux-32ilp32-dirty ]
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.kernel }}.tar.gz
- name: Download rootfs opensbi and unpack artifacts
run: |
wget -qc https://github.com/c-sky/buildroot/releases/download/v1.0.11/rootfs_rv32.ext2.tar.gz
tar -xvf rootfs_rv32.ext2.tar.gz
wget -qc https://github.com/riscv-software-src/opensbi/releases/download/v1.4/opensbi-1.4-rv-bin.tar.xz
xz -d opensbi-1.4-rv-bin.tar.xz
tar -xvf opensbi-1.4-rv-bin.tar
mv opensbi-1.4-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin .
tar -xvf ${{ matrix.kernel }}.tar.gz
- name: Run Qemu
run: qemu-system-riscv32 -cpu ${{ matrix.cpu }} -nographic -smp 4 -M virt -bios ./fw_dynamic.bin -kernel ./Image -append 'rootwait root=/dev/vda ro' -drive file=./rootfs_rv32.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -monitor none -serial telnet:localhost:5678,server &
- name: Check Qemu Booting Kernel
run: .github/ci_scripts/check_qemu.exp 'cat /proc/version' 180
- name: Check perf test
run: .github/ci_scripts/check_qemu.exp 'perf test -s 5,15,16,17,18,21,50,60,62' 180 FAILED
- name: Check perf stat
run: .github/ci_scripts/check_qemu.exp 'perf stat tar -czf test.tar.gz /bin' 60 '' seconds sys
ruyi-qemu-64ilp32:
needs: kernel-build
runs-on: ubuntu-latest
container: ghcr.io/ruyisdk/linux-xuantie-kernel/ruyi-toolchain:latest
strategy:
fail-fast: false
matrix:
variant: [ Image ]
include:
- cpu: rv64
- kernel: linux-64ilp32
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.kernel }}.tar.gz
- name: Download rootfs and unpack artifacts
run: |
wget -qc https://github.com/c-sky/buildroot/releases/download/v1.0.11/rootfs_rv32.ext2.tar.gz
tar -xvf rootfs_rv32.ext2.tar.gz
tar -xvf ${{ matrix.kernel }}.tar.gz
- name: Run Qemu
run: qemu-system-riscv64 -cpu ${{ matrix.cpu }} -nographic -smp 4 -M virt -kernel ./${{ matrix.variant }} -append 'rootwait root=/dev/vda ro' -drive file=./rootfs_rv32.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -monitor none -serial telnet:localhost:5678,server &
- name: Check Qemu Booting Kernel
run: .github/ci_scripts/check_qemu.exp 'cat /proc/version' 180
- name: Check perf test
run: .github/ci_scripts/check_qemu.exp 'perf test -s 5,15,16,17,18,21,50,60,62' 180 FAILED
- name: Check perf stat
run: .github/ci_scripts/check_qemu.exp 'perf stat tar -czf test.tar.gz /bin' 60 '' seconds sys
checkpatch:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: 'Calculate PR commits + 1'
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
- name: Run checkpatch review
uses: webispy/checkpatch-action@v9