1212 matrix :
1313 mode : [debug, release]
1414 module : [builtin, loadable]
15+ outputdir : [src, build]
1516
1617 steps :
1718 # Setup
@@ -24,15 +25,34 @@ jobs:
2425
2526 # Build
2627 - run : cp .github/workflows/kernel-${{ matrix.mode }}.config .config
28+
2729 - if : matrix.module == 'loadable'
2830 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
31+
32+ - if : matrix.outputdir == 'build'
33+ run : mkdir build && mv .config build/.config
34+
35+ - if : matrix.outputdir == 'src'
36+ run : make CC=clang-10 LLVM_CONFIG_PATH=llvm-config-10 -j3
37+ - if : matrix.outputdir == 'build'
38+ run : make O=build CC=clang-10 LLVM_CONFIG_PATH=llvm-config-10 -j3
3039
3140 # Run
3241 - if : matrix.module == 'builtin'
3342 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
43+
44+ - if : matrix.outputdir == 'build'
45+ run : sed -i 's:drivers/:build/drivers/:' .github/workflows/qemu-initramfs.desc
46+
47+ - if : matrix.outputdir == 'src'
48+ run : usr/gen_init_cpio .github/workflows/qemu-initramfs.desc > qemu-initramfs.img
49+ - if : matrix.outputdir == 'build'
50+ run : build/usr/gen_init_cpio .github/workflows/qemu-initramfs.desc > qemu-initramfs.img
51+
52+ - if : matrix.outputdir == 'src'
53+ run : qemu-system-x86_64 -kernel arch/x86/boot/bzImage -initrd qemu-initramfs.img -cpu Cascadelake-Server -smp 2 -nographic -no-reboot -append "console=ttyS0 ${{ matrix.module == 'builtin' && 'rust_example.my_i32=123321' || '' }}" | tee qemu-stdout.log
54+ - if : matrix.outputdir == 'build'
55+ run : qemu-system-x86_64 -kernel build/arch/x86/boot/bzImage -initrd qemu-initramfs.img -cpu Cascadelake-Server -smp 2 -nographic -no-reboot -append "console=ttyS0 ${{ matrix.module == 'builtin' && 'rust_example.my_i32=123321' || '' }}" | tee qemu-stdout.log
3656
3757 # Check
3858 - run : grep -F 'Rust Example (init)' qemu-stdout.log
0 commit comments