Skip to content

Commit efb5183

Browse files
committed
feat: add more runner
1 parent 05363ba commit efb5183

File tree

2 files changed

+172
-0
lines changed

2 files changed

+172
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build on ubuntu-20.04
2+
run-name: Build (${{ github.event.inputs.kernel_version }})
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
kernel_version:
8+
description: "WSL2 kernel version (e.g. 5.15.57.1)"
9+
required: true
10+
default: "5.15.57.1"
11+
12+
jobs:
13+
build-and-release:
14+
runs-on: ubuntu-20.04
15+
permissions:
16+
contents: write
17+
env:
18+
KERNEL_VERSION: ${{ github.event.inputs.kernel_version }}
19+
KERNEL_DIR: linux-${{ github.event.inputs.kernel_version }}
20+
RELEASE_TAG: v${{ github.event.inputs.kernel_version }}
21+
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/checkout@v4
25+
26+
- name: Install Dependencies
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y \
30+
build-essential flex bison dwarves \
31+
libssl-dev libelf-dev libncurses-dev \
32+
bc rsync cpio python3 pahole
33+
34+
- name: Download Kernel Source
35+
run: |
36+
mkdir -p kernel-build
37+
cd kernel-build
38+
wget https://github.com/microsoft/WSL2-Linux-Kernel/archive/refs/tags/linux-msft-wsl-${{ env.KERNEL_VERSION }}.tar.gz
39+
tar -xzf linux-msft-wsl-${{ env.KERNEL_VERSION }}.tar.gz
40+
mv WSL2-Linux-Kernel-linux-msft-wsl-${{ env.KERNEL_VERSION }} linux-${{ env.KERNEL_VERSION }}
41+
echo "KERNEL_DIR=$(pwd)/linux-${{ env.KERNEL_VERSION }}" >> $GITHUB_ENV
42+
43+
- name: Configure Kernel
44+
run: |
45+
cd ${{ env.KERNEL_DIR }}
46+
cp Microsoft/config-wsl .config
47+
./scripts/config --disable DEBUG_INFO_BTF
48+
./scripts/config --enable LD_NO_EXEC_STACK
49+
make olddefconfig
50+
51+
- name: Build Kernel
52+
run: |
53+
cd ${{ env.KERNEL_DIR }}
54+
make -j$(nproc) LDFLAGS="-z noexecstack -z separate-code" LD=ld.bfd
55+
echo "BUILD_DATE=$(date -u +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
56+
57+
- name: Generate Release Notes
58+
run: |
59+
cat << EOF > release_notes.md
60+
### Build Information
61+
- Version: ${{ env.KERNEL_VERSION }}
62+
- Build Date: ${{ env.BUILD_DATE }}
63+
- Source: [Microsoft/WSL2-Linux-Kernel@${{ env.KERNEL_VERSION }}](https://github.com/microsoft/WSL2-Linux-Kernel/tree/linux-msft-wsl-${{ env.KERNEL_VERSION }})
64+
65+
### Installation
66+
1. Download \`bzImage\`
67+
2. Place in \`C:\Windows\System32\lxss\tools\`
68+
3. Add to \`.wslconfig\`:
69+
\`\`\`ini
70+
[wsl2]
71+
kernel=C:\\Windows\\System32\\lxss\\tools\\bzImage
72+
\`\`\`
73+
EOF
74+
75+
- name: Create Release and Upload Assets
76+
uses: softprops/action-gh-release@v2
77+
with:
78+
tag_name: ${{ env.RELEASE_TAG }}
79+
name: "WSL2 Kernel ${{ env.KERNEL_VERSION }}"
80+
body_path: release_notes.md
81+
files: |
82+
${{ env.KERNEL_DIR }}/arch/x86/boot/bzImage
83+
${{ env.KERNEL_DIR }}/.config
84+
draft: false
85+
prerelease: false
86+
fail_on_unmatched_files: true
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build on ubuntu-22.04
2+
run-name: Build (${{ github.event.inputs.kernel_version }})
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
kernel_version:
8+
description: "WSL2 kernel version (e.g. 5.15.57.1)"
9+
required: true
10+
default: "5.15.57.1"
11+
12+
jobs:
13+
build-and-release:
14+
runs-on: ubuntu-22.04
15+
permissions:
16+
contents: write
17+
env:
18+
KERNEL_VERSION: ${{ github.event.inputs.kernel_version }}
19+
KERNEL_DIR: linux-${{ github.event.inputs.kernel_version }}
20+
RELEASE_TAG: v${{ github.event.inputs.kernel_version }}
21+
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/checkout@v4
25+
26+
- name: Install Dependencies
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y \
30+
build-essential flex bison dwarves \
31+
libssl-dev libelf-dev libncurses-dev \
32+
bc rsync cpio python3 pahole
33+
34+
- name: Download Kernel Source
35+
run: |
36+
mkdir -p kernel-build
37+
cd kernel-build
38+
wget https://github.com/microsoft/WSL2-Linux-Kernel/archive/refs/tags/linux-msft-wsl-${{ env.KERNEL_VERSION }}.tar.gz
39+
tar -xzf linux-msft-wsl-${{ env.KERNEL_VERSION }}.tar.gz
40+
mv WSL2-Linux-Kernel-linux-msft-wsl-${{ env.KERNEL_VERSION }} linux-${{ env.KERNEL_VERSION }}
41+
echo "KERNEL_DIR=$(pwd)/linux-${{ env.KERNEL_VERSION }}" >> $GITHUB_ENV
42+
43+
- name: Configure Kernel
44+
run: |
45+
cd ${{ env.KERNEL_DIR }}
46+
cp Microsoft/config-wsl .config
47+
./scripts/config --disable DEBUG_INFO_BTF
48+
./scripts/config --enable LD_NO_EXEC_STACK
49+
make olddefconfig
50+
51+
- name: Build Kernel
52+
run: |
53+
cd ${{ env.KERNEL_DIR }}
54+
make -j$(nproc) LDFLAGS="-z noexecstack -z separate-code" LD=ld.bfd
55+
echo "BUILD_DATE=$(date -u +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
56+
57+
- name: Generate Release Notes
58+
run: |
59+
cat << EOF > release_notes.md
60+
### Build Information
61+
- Version: ${{ env.KERNEL_VERSION }}
62+
- Build Date: ${{ env.BUILD_DATE }}
63+
- Source: [Microsoft/WSL2-Linux-Kernel@${{ env.KERNEL_VERSION }}](https://github.com/microsoft/WSL2-Linux-Kernel/tree/linux-msft-wsl-${{ env.KERNEL_VERSION }})
64+
65+
### Installation
66+
1. Download \`bzImage\`
67+
2. Place in \`C:\Windows\System32\lxss\tools\`
68+
3. Add to \`.wslconfig\`:
69+
\`\`\`ini
70+
[wsl2]
71+
kernel=C:\\Windows\\System32\\lxss\\tools\\bzImage
72+
\`\`\`
73+
EOF
74+
75+
- name: Create Release and Upload Assets
76+
uses: softprops/action-gh-release@v2
77+
with:
78+
tag_name: ${{ env.RELEASE_TAG }}
79+
name: "WSL2 Kernel ${{ env.KERNEL_VERSION }}"
80+
body_path: release_notes.md
81+
files: |
82+
${{ env.KERNEL_DIR }}/arch/x86/boot/bzImage
83+
${{ env.KERNEL_DIR }}/.config
84+
draft: false
85+
prerelease: false
86+
fail_on_unmatched_files: true

0 commit comments

Comments
 (0)