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,31 @@ 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 == 'src'
37
+ run : make ${MAKE_FLAGS}
38
+ - if : matrix.outputdir == 'build'
39
+ run : |
40
+ mkdir build
41
+ mv .config build/.config
42
+ 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 == 'src'
49
+ run : |
50
+ usr/gen_init_cpio .github/workflows/qemu-initramfs.desc > qemu-initramfs.img
51
+ 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
52
+ - if : matrix.outputdir == 'build'
53
+ run : |
54
+ sed -i 's:drivers/:build/drivers/:' .github/workflows/qemu-initramfs.desc
55
+ build/usr/gen_init_cpio .github/workflows/qemu-initramfs.desc > qemu-initramfs.img
56
+ 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
57
37
58
# Check
38
59
- run : grep -F 'Rust Example (init)' qemu-stdout.log
0 commit comments