12
12
matrix :
13
13
mode : [debug, release]
14
14
module : [builtin, loadable]
15
+ outputdir : [src, build]
16
+
17
+ env :
18
+ MAKE_FLAGS : CC=clang-10 LLVM_CONFIG_PATH=llvm-config-10 -j3
19
+ QEMU_FLAGS : -initrd qemu-initramfs.img -cpu Cascadelake-Server -smp 2 -nographic -no-reboot
15
20
16
21
steps :
17
22
# Setup
@@ -24,15 +29,34 @@ jobs:
24
29
25
30
# Build
26
31
- run : cp .github/workflows/kernel-${{ matrix.mode }}.config .config
32
+
27
33
- if : matrix.module == 'loadable'
28
34
run : sed -i -E 's/^(CONFIG_RUST_EXAMPLE=)(y)$/\1m/g' .config
29
- - run : make CC=clang-10 LLVM_CONFIG_PATH=llvm-config-10 -j3
35
+
36
+ - if : matrix.outputdir == 'build'
37
+ run : mkdir build && mv .config build/.config
38
+
39
+ - if : matrix.outputdir == 'src'
40
+ run : make ${MAKE_FLAGS}
41
+ - if : matrix.outputdir == 'build'
42
+ run : make ${MAKE_FLAGS} O=build
30
43
31
44
# Run
32
45
- if : matrix.module == 'builtin'
33
46
run : sed -i '/rust_example/d' .github/workflows/qemu-initramfs.desc
34
- - run : usr/gen_init_cpio .github/workflows/qemu-initramfs.desc > qemu-initramfs.img
35
- - run : qemu-system-x86_64 -kernel arch/x86/boot/bzImage -initrd qemu-initramfs.img -cpu Cascadelake-Server -smp 2 -append "console=ttyS0 ${{ matrix.module == 'builtin' && 'rust_example.my_i32=123321' || '' }}" -nographic -no-reboot | tee qemu-stdout.log
47
+
48
+ - if : matrix.outputdir == 'build'
49
+ run : sed -i 's:drivers/:build/drivers/:' .github/workflows/qemu-initramfs.desc
50
+
51
+ - if : matrix.outputdir == 'src'
52
+ run : usr/gen_init_cpio .github/workflows/qemu-initramfs.desc > qemu-initramfs.img
53
+ - if : matrix.outputdir == 'build'
54
+ run : build/usr/gen_init_cpio .github/workflows/qemu-initramfs.desc > qemu-initramfs.img
55
+
56
+ - if : matrix.outputdir == 'src'
57
+ run : qemu-system-x86_64 ${QEMU_FLAGS} -kernel arch/x86/boot/bzImage -append "console=ttyS0 ${{ matrix.module == 'builtin' && 'rust_example.my_i32=123321' || '' }}" | tee qemu-stdout.log
58
+ - if : matrix.outputdir == 'build'
59
+ run : qemu-system-x86_64 ${QEMU_FLAGS} -kernel build/arch/x86/boot/bzImage -append "console=ttyS0 ${{ matrix.module == 'builtin' && 'rust_example.my_i32=123321' || '' }}" | tee qemu-stdout.log
36
60
37
61
# Check
38
62
- run : grep -F 'Rust Example (init)' qemu-stdout.log
0 commit comments