Skip to content

Commit 13fc97e

Browse files
committed
fix: build-kernel.yml
1 parent a449321 commit 13fc97e

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

.github/workflows/build-kernel.yml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Build WSL2 Kernel
2-
32
run-name: Build (${{ github.event.inputs.kernel_version }})
43

54
on:
@@ -28,7 +27,8 @@ jobs:
2827
sudo apt-get install -y \
2928
build-essential flex bison dwarves \
3029
libssl-dev libelf-dev libncurses-dev \
31-
bc rsync cpio python3
30+
bc rsync cpio python3 \
31+
pahole
3232
3333
- name: Download Kernel Source
3434
run: |
@@ -44,27 +44,29 @@ jobs:
4444
cd ${{ env.KERNEL_DIR }}
4545
cp Microsoft/config-wsl .config
4646
47+
./scripts/config --disable DEBUG_INFO_BTF
4748
./scripts/config --enable LD_NO_EXEC_STACK
4849
./scripts/config --enable INIT_STACK_NONE
49-
./scripts/config --enable DEBUG_INFO_BTF
50-
./scripts/config --set-str DEBUG_INFO_BTF_MODULES ""
5150
5251
make olddefconfig
53-
make -j$(nproc) \
54-
LDFLAGS="-z noexecstack -z separate-code" \
55-
BTF_PAHOLE_FLAGS="--btf_gen_floats"
5652
5753
- name: Build Kernel
5854
run: |
5955
cd ${{ env.KERNEL_DIR }}
60-
make -j$(nproc) LDFLAGS="-z noexecstack -z separate-code" 2>&1 | tee build.log
56+
make -j$(nproc) \
57+
LDFLAGS="-z noexecstack -z separate-code" \
58+
LD=ld.bfd
6159
6260
if [ ! -f arch/x86/boot/bzImage ]; then
6361
echo "::error::Kernel build failed!"
64-
cat build.log | grep -i error
6562
exit 1
6663
fi
6764
65+
- name: Verify Kernel Image
66+
run: |
67+
file ${{ env.KERNEL_DIR }}/arch/x86/boot/bzImage
68+
ls -lh ${{ env.KERNEL_DIR }}/arch/x86/boot/bzImage
69+
6870
- name: Create Release
6971
id: create_release
7072
uses: actions/create-release@v1
@@ -77,20 +79,24 @@ jobs:
7779
### Build Information
7880
- Version: ${{ env.KERNEL_VERSION }}
7981
- Build Date: $(date -u +'%Y-%m-%d %H:%M:%S')
80-
- Source: [Microsoft/WSL2-Linux-Kernel@${{ env.KERNEL_VERSION }}](https://github.com/microsoft/WSL2-Linux-Kernel/tree/linux-msft-wsl-${{ env.KERNEL_VERSION }})
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.
8187
82-
### Usage
88+
### Installation
8389
1. Download `bzImage`
8490
2. Place in `C:\Windows\System32\lxss\tools`
8591
3. Add to `.wslconfig`:
86-
```ini
87-
[wsl2]
88-
kernel=C:\\Windows\\System32\\lxss\\tools\\bzImage
89-
```
92+
```ini
93+
[wsl2]
94+
kernel=C:\\Windows\\System32\\lxss\\tools\\bzImage
95+
```
9096
draft: false
9197
prerelease: false
9298

93-
- name: Upload Kernel Assets
99+
- name: Upload Kernel Image
94100
uses: actions/upload-release-asset@v1
95101
env:
96102
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -100,9 +106,10 @@ jobs:
100106
asset_name: bzImage-${{ env.KERNEL_VERSION }}
101107
asset_content_type: application/octet-stream
102108

103-
- name: Upload Build Log
109+
- name: Upload Kernel Config
104110
uses: actions/upload-release-asset@v1
105111
with:
106112
upload_url: ${{ steps.create_release.outputs.upload_url }}
107-
asset_path: ${{ env.KERNEL_DIR }}/build.log
108-
asset_name: build-log-${{ env.KERNEL_VERSION }}.txt
113+
asset_path: ${{ env.KERNEL_DIR }}/.config
114+
asset_name: config-${{ env.KERNEL_VERSION }}.txt
115+
asset_content_type: text/plain

0 commit comments

Comments
 (0)