7
7
jobs :
8
8
ci :
9
9
runs-on : ubuntu-24.04
10
- container : ghcr.io/rust-for-linux/ci
11
10
12
11
timeout-minutes : 70
13
12
14
13
strategy :
15
14
fail-fast : false
16
15
matrix :
17
16
tree :
18
- - rust-next
19
- # rust-fixes
20
- # rust-dev
21
-
17
+ - torvalds
18
+ # rust-next
22
19
# next
23
20
24
- # stable/linux-6.7.y
25
- # stable-rc/linux-6.7.y
26
-
27
- # stable/linux-6.6.y
28
- # stable-rc/linux-6.6.y
29
-
30
- # stable/linux-6.1.y
31
- # stable-rc/linux-6.1.y
32
-
33
21
arch :
34
22
- x86_64
35
23
# arm64
36
24
37
- toolchain :
38
- # llvm
39
- - rustc_codegen_gcc
40
-
41
25
config :
42
26
- defconfig
43
27
- defconfig+debug
47
31
# subdir
48
32
# outside
49
33
50
- include :
51
- # # `arch: arm64` (with `rust-dev`).
52
- # - tree: rust-dev
53
- # arch: arm64
54
- # toolchain: rustc_codegen_gcc
55
- # config: defconfig
56
- # output: src
57
- #
58
- # # `arch: arm64` (with `rust-dev` + `defconfig+debug`).
59
- # - tree: rust-dev
60
- # arch: arm64
61
- # toolchain: rustc_codegen_gcc
62
- # config: defconfig+debug
63
- # output: src
64
-
65
- # `output: subdir`.
66
- - tree : rust-next
67
- arch : x86_64
68
- toolchain : rustc_codegen_gcc
69
- config : defconfig
70
- output : subdir
71
-
72
- # `output: outside`.
73
- - tree : rust-next
74
- arch : x86_64
75
- toolchain : rustc_codegen_gcc
76
- config : defconfig
77
- output : outside
78
-
79
- exclude :
80
- # Rust 1.71.1 (in Linux 6.6) had a bug: it generated `.eh_frame` with debug assertions enabled.
81
- - tree : stable/linux-6.6.y
82
- config : defconfig+debug
83
-
84
- # Rust 1.71.1 (in Linux 6.6) had a bug: it generated `.eh_frame` with debug assertions enabled.
85
- - tree : stable-rc/linux-6.6.y
86
- config : defconfig+debug
87
-
88
34
env :
89
35
RUST_VERSION : nightly-2025-01-12
90
36
steps :
105
51
echo 'QEMU_ARCH=aarch64' >> $GITHUB_ENV
106
52
echo 'QEMU_ARGS=-machine virt' >> $GITHUB_ENV
107
53
108
- - if : matrix.toolchain == 'llvm'
109
- run : echo 'MAKE_TOOLCHAIN=LLVM=1' >> $GITHUB_ENV
110
-
111
54
- if : matrix.output == 'src'
112
55
run : |
113
56
echo 'OUTPUT_DIR=linux/' >> $GITHUB_ENV
@@ -117,18 +60,23 @@ jobs:
117
60
echo 'OUTPUT_DIR=linux/subdir/' >> $GITHUB_ENV
118
61
- if : matrix.output == 'outside'
119
62
run : |
120
- echo 'MAKE_OUTPUT=O=/outside' >> $GITHUB_ENV
121
- echo 'OUTPUT_DIR=/outside/' >> $GITHUB_ENV
63
+ echo 'MAKE_OUTPUT=O=../outside' >> $GITHUB_ENV
64
+ echo 'OUTPUT_DIR=outside/' >> $GITHUB_ENV
65
+
66
+ - run : |
67
+ sudo apt-get -y update
68
+ sudo apt-get -y --no-install-recommends install bc file git make flex bison libelf-dev libssl-dev curl python3 llvm clang lld binutils qemu-system-x86 qemu-system-arm
69
+
70
+ - if : matrix.arch == 'arm64'
71
+ run : sudo apt-get -y --no-install-recommends install gcc-aarch64-linux-gnu libc6-dev-arm64-cross
122
72
123
73
# Setup: checkout Linux source tree.
74
+ - if : matrix.tree == 'torvalds'
75
+ run : git clone --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux
124
76
- if : startsWith(matrix.tree, 'rust-')
125
77
run : git clone --depth 1 --branch ${{ matrix.tree }} https://github.com/Rust-for-Linux/linux.git linux
126
- - if : startsWith( matrix.tree, 'next')
78
+ - if : matrix.tree == 'next'
127
79
run : git clone --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git linux
128
- - if : startsWith(matrix.tree, 'stable/')
129
- run : git clone --depth 1 --branch $(echo ${{ matrix.tree }} | cut -d/ -f2-) https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux
130
- - if : startsWith(matrix.tree, 'stable-rc/')
131
- run : git clone --depth 1 --branch $(echo ${{ matrix.tree }} | cut -d/ -f2-) https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux
132
80
133
81
- run : git -C linux show --no-patch
134
82
@@ -137,6 +85,14 @@ jobs:
137
85
with :
138
86
path : ci
139
87
88
+ - run : git -C linux apply ../ci/x86-boot-Use-std-gnu11-to-fix-build-with-GCC-15.patch
89
+
90
+ # Setup: `busybox`.
91
+ - run : |
92
+ git clone --depth 1 -b 1_30_1 https://git.busybox.net/busybox/
93
+ mv ci/busybox.config busybox/.config
94
+ make -C busybox ${{ env.MAKE_CROSS_COMPILE }} ${{ env.JOBS }} busybox
95
+
140
96
# Setup: Rust.
141
97
- run : |
142
98
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
@@ -150,11 +106,10 @@ jobs:
150
106
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
151
107
152
108
# Setup: `rustc_codegen_gcc`.
153
- - if : matrix.toolchain == 'rustc_codegen_gcc'
154
- run : |
155
- apt-get -y --no-install-recommends purge cpp gcc
109
+ - run : |
110
+ sudo apt-get -y --no-install-recommends purge cpp gcc
156
111
curl --proto '=https' --tlsv1.2 -sSfLO https://github.com/rust-lang/gcc/releases/latest/download/gcc-15.deb
157
- dpkg -i gcc-15.deb
112
+ sudo dpkg -i gcc-15.deb
158
113
159
114
git clone --depth 1 https://github.com/rust-lang/rustc_codegen_gcc
160
115
@@ -168,14 +123,7 @@ jobs:
168
123
./y.sh build --sysroot --release
169
124
170
125
# Setup: `bindgen`.
171
- #
172
- # The `bindgen` package name is only used for 6.1 LTS.
173
- - run : |
174
- cargo install --locked --version 0.70.1 bindgen-cli ||
175
- cargo install --locked --version 0.70.1 bindgen
176
-
177
- # Setup: `busybox`.
178
- - run : cp /root/busybox-${{ matrix.arch }} /root/busybox
126
+ - run : cargo install --locked --version 0.70.1 bindgen-cli
179
127
180
128
# Prepare build output folder.
181
129
- if : matrix.output != 'src'
@@ -206,30 +154,10 @@ jobs:
206
154
- run : diff -u config-before ${{ env.OUTPUT_DIR }}.config
207
155
208
156
# Make sure certain key configs were enabled.
209
- - run : |
210
- grep -F 'CONFIG_RUST=y' ${{ env.OUTPUT_DIR }}.config
211
- grep -F 'CONFIG_WERROR=y' ${{ env.OUTPUT_DIR }}.config
212
-
213
- # Prepare image.
214
- - run : ${{ env.OUTPUT_DIR }}usr/gen_init_cpio ci/qemu-initramfs.desc > qemu-initramfs.img
215
-
216
- # Run in QEMU.
217
- - run : |
218
- qemu-system-${{ env.QEMU_ARCH }} \
219
- ${{ env.QEMU_ARGS }} \
220
- -kernel ${{ env.OUTPUT_DIR }}${{ env.IMAGE_PATH }} \
221
- -initrd qemu-initramfs.img \
222
- -smp 2 \
223
- -nographic \
224
- -vga none \
225
- -no-reboot \
226
- | sed 's:\r$::' \
227
- | tee qemu-stdout
157
+ - run : grep -F 'CONFIG_RUST=y' ${{ env.OUTPUT_DIR }}.config
228
158
229
159
# Report other data.
230
160
- run : |
231
- ls -l
232
-
233
161
ls -l \
234
162
${{ env.OUTPUT_DIR }}samples/rust/*.o \
235
163
${{ env.OUTPUT_DIR }}samples/rust/*.ko \
@@ -245,19 +173,27 @@ jobs:
245
173
246
174
# Check `.comment` section.
247
175
- run : |
248
- # TODO: update version here.
249
- if [ $(linux/scripts/min-tool-version.sh rustc | cut -d'.' -f2) -ge 73 ]; then
250
- llvm-readelf --string-dump .comment ${{ env.OUTPUT_DIR }}rust/core.o
251
- llvm-objcopy --dump-section .comment=comment ${{ env.OUTPUT_DIR }}rust/core.o
252
- # TODO: update version here.
253
- grep --text "^.rustc version $(linux/scripts/min-tool-version.sh rustc)" comment
254
- if ${{ matrix.toolchain == 'rustc_codegen_gcc' && 'true' || 'false' }}; then
255
- grep --text 'libgccjit' comment
256
- grep --text 'GCC: ' comment
257
- fi
258
- else
259
- echo 'Skipping since `rustc` < 1.73.0.'
260
- fi
176
+ readelf --string-dump .comment ${{ env.OUTPUT_DIR }}rust/core.o
177
+ objcopy --dump-section .comment=comment ${{ env.OUTPUT_DIR }}rust/core.o
178
+ grep --text "^.rustc version .* with libgccjit" comment
179
+ grep --text 'libgccjit' comment
180
+ grep --text 'GCC: ' comment
181
+
182
+ # Prepare image.
183
+ - run : ${{ env.OUTPUT_DIR }}usr/gen_init_cpio ci/qemu-initramfs.desc > qemu-initramfs.img
184
+
185
+ # Run in QEMU.
186
+ - run : |
187
+ qemu-system-${{ env.QEMU_ARCH }} \
188
+ ${{ env.QEMU_ARGS }} \
189
+ -kernel ${{ env.OUTPUT_DIR }}${{ env.IMAGE_PATH }} \
190
+ -initrd qemu-initramfs.img \
191
+ -smp 2 \
192
+ -nographic \
193
+ -vga none \
194
+ -no-reboot \
195
+ | sed 's:\r$::' \
196
+ | tee qemu-stdout
261
197
262
198
# Check QEMU log output.
263
199
- run : |
@@ -266,9 +202,7 @@ jobs:
266
202
grep '] rust_minimal: My numbers are \[72, 108, 200]$' qemu-stdout
267
203
grep '] rust_minimal: Rust minimal sample (exit)$' qemu-stdout
268
204
269
- # Linux 6.1 does not have `rust_print`.
270
- - if : ${{ ! contains(matrix.tree, '6.1') }}
271
- run : |
205
+ - run : |
272
206
grep '] rust_print: Rust printing macros sample (init)$' qemu-stdout
273
207
274
208
grep '] rust_print: Emergency message (level 0) without args$' qemu-stdout
@@ -289,9 +223,7 @@ jobs:
289
223
grep '] rust_print: Info message (level 6) with args$' qemu-stdout
290
224
grep '] rust_print: A line that is continued with args$' qemu-stdout
291
225
292
- # Linux 6.1 does not have KUnit `rustdoc` tests.
293
- - if : ${{ matrix.config == 'defconfig+debug' && ! contains(matrix.tree, '6.1') }}
294
- run : grep '] ok 1 rust_doctests_kernel$' qemu-stdout
226
+ - run : grep '] ok 1 rust_doctests_kernel$' qemu-stdout
295
227
296
228
- run : |
297
229
grep -i '\bpanic\b' qemu-stdout && exit 1
@@ -334,20 +266,13 @@ jobs:
334
266
make -C linux ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_KRUSTFLAGS }} ${{ env.JOBS }} samples/rust/rust_minimal.o
335
267
file ${{ env.OUTPUT_DIR }}samples/rust/rust_minimal.o | grep -F 'ELF'
336
268
337
- # Rust 1.71.1 (in Linux 6.6) had a bug: it does not generate dependency files.
338
- - if : ${{ ! contains(matrix.tree, '6.6') }}
339
- run : |
269
+ - run : |
340
270
make -C linux ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_KRUSTFLAGS }} ${{ env.JOBS }} samples/rust/rust_minimal.rsi
341
271
grep -F '#![feature(prelude_import)]' ${{ env.OUTPUT_DIR }}samples/rust/rust_minimal.rsi
342
272
343
273
- run : |
344
274
make -C linux ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_KRUSTFLAGS }} ${{ env.JOBS }} samples/rust/rust_minimal.s
345
275
grep -F '.text' ${{ env.OUTPUT_DIR }}samples/rust/rust_minimal.s
346
276
347
- - if : matrix.toolchain == 'llvm'
348
- run : |
349
- make -C linux ${{ env.MAKE_ARCH }} ${{ env.MAKE_CROSS_COMPILE }} ${{ env.MAKE_TOOLCHAIN }} ${{ env.MAKE_OUTPUT }} ${{ env.MAKE_KRUSTFLAGS }} ${{ env.JOBS }} samples/rust/rust_minimal.ll
350
- grep -F '; ModuleID' ${{ env.OUTPUT_DIR }}samples/rust/rust_minimal.ll
351
-
352
277
# Test Rust host programs.
353
278
- run : ${{ env.OUTPUT_DIR }}samples/rust/hostprogs/single | grep -F 'The number is 42.'
0 commit comments