1- name : Build WSL2 Kernel
1+ name : Build and Release WSL2 Kernel
22run-name : Build (${{ github.event.inputs.kernel_version }})
33
44on :
55 workflow_dispatch :
66 inputs :
77 kernel_version :
8- description : " WSL2 kernel version (e.g. 5.15.90.4 )"
8+ description : " WSL2 kernel version (e.g. 5.15.57.1 )"
99 required : true
10- default : " 5.15.90.4 "
10+ default : " 5.15.57.1 "
1111
1212jobs :
1313 build-and-release :
1414 runs-on : ubuntu-latest
15+ permissions :
16+ contents : write
17+ actions : read
18+ packages : write
1519 env :
1620 KERNEL_VERSION : ${{ github.event.inputs.kernel_version }}
1721 KERNEL_DIR : linux-${{ github.event.inputs.kernel_version }}
2731 sudo apt-get install -y \
2832 build-essential flex bison dwarves \
2933 libssl-dev libelf-dev libncurses-dev \
30- bc rsync cpio python3 \
31- pahole
34+ bc rsync cpio python3 pahole
3235
3336 - name : Download Kernel Source
3437 run : |
@@ -43,33 +46,23 @@ jobs:
4346 run : |
4447 cd ${{ env.KERNEL_DIR }}
4548 cp Microsoft/config-wsl .config
46-
4749 ./scripts/config --disable DEBUG_INFO_BTF
4850 ./scripts/config --enable LD_NO_EXEC_STACK
49- ./scripts/config --enable INIT_STACK_NONE
50-
5151 make olddefconfig
5252
5353 - name : Build Kernel
5454 run : |
5555 cd ${{ env.KERNEL_DIR }}
56- make -j$(nproc) \
57- LDFLAGS="-z noexecstack -z separate-code" \
58- LD=ld.bfd
59-
60- if [ ! -f arch/x86/boot/bzImage ]; then
61- echo "::error::Kernel build failed!"
62- exit 1
63- fi
56+ make -j$(nproc) LDFLAGS="-z noexecstack -z separate-code" LD=ld.bfd
6457
65- - name : Verify Kernel Image
58+ - name : Verify Build Artifacts
6659 run : |
67- file ${{ env.KERNEL_DIR }}/arch/x86/boot/bzImage
6860 ls -lh ${{ env.KERNEL_DIR }}/arch/x86/boot/bzImage
61+ ls -lh ${{ env.KERNEL_DIR }}/.config
6962
70- - name : Create Release
63+ - name : Create GitHub Release
7164 id : create_release
72- uses : actions/create-release@v1
65+ uses : actions/create-release@v2
7366 env :
7467 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7568 with :
7972 ### Build Information
8073 - Version: ${{ env.KERNEL_VERSION }}
8174 - Build Date: $(date -u +'%Y-%m-%d %H:%M:%S')
82- - Build Flags: LDFLAGS="-z noexecstack -z separate-code"
83-
84- ### Important Notes
85- This build DISABLED BTF to avoid linker errors.
86- Warnings about executable stack are suppressed but functionally safe.
8775
8876 ### Installation
8977 1. Download `bzImage`
@@ -96,20 +84,20 @@ jobs:
9684 draft : false
9785 prerelease : false
9886
99- - name : Upload Kernel Image
100- uses : actions /upload-release-asset@v1
87+ - name : Upload Release Assets
88+ uses :
alexellis /upload-[email protected] 10189 env :
10290 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
10391 with :
104- upload_url : ${{ steps.create_release.outputs.upload_url }}
105- asset_path : ${{ env.KERNEL_DIR }}/arch/x86/boot/bzImage
106- asset_name : bzImage- ${{ env.KERNEL_VERSION }}
107- asset_content_type : application/octet-stream
108-
109- - name : Upload Kernel Config
110- uses : actions/upload-release-asset@v1
111- with :
112- upload_url : ${{ steps.create_release.outputs.upload_url }}
113- asset_path : ${{ env.KERNEL_DIR }}/.config
114- asset_name : config- ${{ env.KERNEL_VERSION }}.txt
115- asset_content_type : text/plain
92+ asset_paths : |
93+ [
94+ " ${{ env.KERNEL_DIR }}/arch/x86/boot/bzImage",
95+ "${{ env.KERNEL_DIR }}/.config",
96+ "${{ env.KERNEL_DIR }}/build.log"
97+ ]
98+ asset_names : |
99+ [
100+ "bzImage- ${{ env.KERNEL_VERSION }}",
101+ "config- ${{ env.KERNEL_VERSION }}.txt",
102+ "build-log- ${{ env.KERNEL_VERSION }}.txt"
103+ ]
0 commit comments