forked from Nevuly/WSL2-Linux-Kernel-Rolling
-
Notifications
You must be signed in to change notification settings - Fork 1
247 lines (227 loc) · 11.4 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
name: Stable Kernel CI
on:
push:
tags:
- 'linux-wsl-stable-6.11.[0-9]+'
run-name: Stable Release Build ${{ github.ref_name }}
jobs:
build:
runs-on: ubuntu-latest
container: nevuly/nevuly-dev-base:arch
outputs:
X86_IMAGE_SHA: ${{ steps.gen-sha3-512.outputs.X86_IMAGE_SHA }}
X86_MODULE_SHA: ${{ steps.gen-sha3-512.outputs.X86_MODULE_SHA }}
X86_OPTIONAL_SHA: ${{ steps.gen-sha3-512.outputs.X86_OPTIONAL_SHA }}
ARM64_IMAGE_SHA: ${{ steps.gen-sha3-512.outputs.ARM64_IMAGE_SHA }}
ARM64_MODULE_SHA: ${{ steps.gen-sha3-512.outputs.ARM64_MODULE_SHA }}
ARM64_OPTIONAL_SHA: ${{ steps.gen-sha3-512.outputs.ARM64_OPTIONAL_SHA }}
strategy:
matrix:
include:
- arch: x86
image-name: bzImage-x86_64
- arch: arm64
image-name: Image-arm64
env:
TAG_VERSION: '${{ github.ref_name }}'
steps:
- name: Trust this directory
run: git config --global --add safe.directory /__w/WSL2-Linux-Kernel-Rolling/WSL2-Linux-Kernel-Rolling
- name: Download WSL2 stable kernel
run: |
git clone https://github.com/taliesins/WSL2-Linux-Kernel-Rolling.git --depth 1 -b $TAG_VERSION linux
- name: Build WSL2 stable kernel
run: |
cd linux
if [ ${{ matrix.arch }} == "x86" ]
then
make KCONFIG_CONFIG=arch/x86/configs/config-wsl-x86 -j$(echo `nproc` + 1 | bc)
cp arch/x86/boot/bzImage ../${{ matrix.image-name }}
else
export ARCH=arm64 && export CROSS_COMPILE=aarch64-linux-gnu-
make KCONFIG_CONFIG=arch/arm64/configs/config-wsl-arm64 -j$(echo `nproc` + 1 | bc)
cp arch/arm64/boot/Image ../${{ matrix.image-name }}
fi
echo "Done"
- name: Generate kernel modules package
run: |
echo "Check kernel version"
IFS=- read -r var1 var2 var3 version <<< ${{ github.ref_name }}
echo "Kernel verison: $version"
cd linux
echo "Download kernel modules package installer script"
cp .github/modules-install.sh modules-install.sh
chmod 775 modules-install.sh
echo "Generate kernel modules tarball"
mkdir -p ${{ matrix.image-name }}-modules_install && make modules_install INSTALL_MOD_PATH=${{ matrix.image-name }}-modules_install
cp modules-install.sh ${{ matrix.image-name }}-modules_install/
rm -rf ${{ matrix.image-name }}-modules_install/lib/modules/$version-WSL2-STABLE+/build
echo "$version" >> ${{ matrix.image-name }}-modules_install/kernel_version.txt
tar -czf ${{ matrix.image-name }}-modules_install.tar.gz ${{ matrix.image-name }}-modules_install && mv ${{ matrix.image-name }}-modules_install.tar.gz ../
echo "Done"
- name: Generate kernel optional package (headers, docs)
run: |
echo "Check kernel version"
IFS=- read -r var1 var2 var3 version <<< ${{ github.ref_name }}
echo "Kernel verison: $version"
cd linux
echo "Download kernel optionals package installer script"
cp .github/optionals-install.sh optionals-install.sh
chmod 775 optionals-install.sh
echo "Generate kernel headers tarball"
mkdir -p ${{ matrix.image-name }}-optional_install/build
export optional_path=${{ matrix.image-name }}-optional_install/build
install -Dt "$optional_path" -m644 Makefile Module.symvers System.map vmlinux
install -Dt "$optional_path/kernel" -m644 kernel/Makefile
if [ ${{ matrix.arch }} == "x86" ]
then
install -Dt "$optional_path/arch/x86" -m644 arch/x86/Makefile
else
install -Dt "$optional_path/arch/arm64" -m644 arch/arm64/Makefile
fi
cp -t "$optional_path" -a scripts
if [ ${{ matrix.arch }} == "x86" ]
then
install -Dt "$optional_path/tools/objtool" tools/objtool/objtool
install -Dt "$optional_path/tools/bpf/resolve_btfids" tools/bpf/resolve_btfids/resolve_btfids
fi
cp -t "$optional_path" -a include
if [ ${{ matrix.arch }} == "x86" ]
then
cp -t "$optional_path/arch/x86" -a arch/x86/include
install -Dt "$optional_path/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
else
cp -t "$optional_path/arch/arm64" -a arch/arm64/include
install -Dt "$optional_path/arch/arm64/kernel" -m644 arch/arm64/kernel/asm-offsets.s
mkdir -p "$optional_path/arch/arm"
cp -t "$optional_path/arch/arm" -a arch/arm/include
fi
install -Dt "$optional_path/drivers/md" -m644 drivers/md/*.h
install -Dt "$optional_path/net/mac80211" -m644 net/mac80211/*.h
install -Dt "$optional_path/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
install -Dt "$optional_path/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
install -Dt "$optional_path/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
install -Dt "$optional_path/drivers/media/tuners" -m644 drivers/media/tuners/*.h
install -Dt "$optional_path/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
find . -name 'Kconfig*' -exec install -Dm644 {} "$optional_path/{}" \;
export arch
if [ ${{ matrix.arch }} == "x86" ]
then
for arch in "$optional_path"/arch/*/; do
[[ $arch = */x86/ ]] && continue
echo "Removing $(basename "$arch")"
rm -r "$arch"
done
else
for arch in "$optional_path"/arch/*/; do
[[ $arch = */arm64/ ]] && continue
echo "Removing $(basename "$arch")"
rm -r "$arch"
done
fi
rm -r $optional_path/Documentation
find -L "$optional_path" -type l -printf 'Removing %P\n' -delete
find -L "$optional_path" -type f -name '*.o' -printf 'Removing %P\n' -delete
export file
export STRIP_SHARED
export STRIP_STATIC
export STRIP_BINARIES
while read -rd '' $file; do
case "$(file -Sib "$file")" in
application/x-sharedlib\;*)
strip -v $STRIP_SHARED $file ;;
application/x-archive\;*)
strip -v $STRIP_STATIC $file ;;
application/x-executable\;*)
strip -v $STRIP_BINARIES $file ;;
application/x-pie-executable\;*)
strip -v $STRIP_SHARED $file ;;
esac
done < <(find "$optional_path" -type f -perm -u+x ! -name vmlinux -print0)
if [ ${{ matrix.arch }} == "x86" ]
then
strip -v $STRIP_STATIC "$optional_path/vmlinux"
fi
echo "Generate kernel documentations tarball"
cp -r Documentation $optional_path/Documentation
cp optionals-install.sh ${{ matrix.image-name }}-optional_install/
echo "$version" >> ${{ matrix.image-name }}-optional_install/kernel_version.txt
tar -czf ${{ matrix.image-name }}-optional_install.tar.gz ${{ matrix.image-name }}-optional_install && mv ${{ matrix.image-name }}-optional_install.tar.gz ../
echo "Done"
- name: Generate SHA3-512 Checksum
id: gen-sha3-512
run: |
if [ ${{ matrix.arch }} == "x86" ]
then
read -r x86ImageSHA rest <<< "$(rhash --sha3-512 ${{ matrix.image-name }})"
read -r x86ModuleSHA rest <<< "$(rhash --sha3-512 ${{ matrix.image-name }}-modules_install.tar.gz)"
read -r x86OptionalSHA rest <<< "$(rhash --sha3-512 ${{ matrix.image-name }}-optional_install.tar.gz)"
echo "X86_IMAGE_SHA=$x86ImageSHA" >> $GITHUB_OUTPUT
echo "X86_MODULE_SHA=$x86ModuleSHA" >> $GITHUB_OUTPUT
echo "X86_OPTIONAL_SHA=$x86OptionalSHA" >> $GITHUB_OUTPUT
else
read -r arm64ImageSHA rest <<< "$(rhash --sha3-512 ${{ matrix.image-name }})"
read -r arm64ModuleSHA rest <<< "$(rhash --sha3-512 ${{ matrix.image-name }}-modules_install.tar.gz)"
read -r arm64OptionalSHA rest <<< "$(rhash --sha3-512 ${{ matrix.image-name }}-optional_install.tar.gz)"
echo "ARM64_IMAGE_SHA=$arm64ImageSHA" >> $GITHUB_OUTPUT
echo "ARM64_MODULE_SHA=$arm64ModuleSHA" >> $GITHUB_OUTPUT
echo "ARM64_OPTIONAL_SHA=$arm64OptionalSHA" >> $GITHUB_OUTPUT
fi
echo "Done"
- name: Upload kernel Images
uses: actions/upload-artifact@main
with:
name: ${{ matrix.image-name }}
path: |
${{ matrix.image-name }}
${{ matrix.image-name }}-modules_install.tar.gz
${{ matrix.image-name }}-optional_install.tar.gz
release:
runs-on: ubuntu-latest
needs: build
env:
X86_IMAGE_SHA: ${{ needs.build.outputs.X86_IMAGE_SHA }}
X86_MODULE_SHA: ${{ needs.build.outputs.X86_MODULE_SHA }}
X86_OPTIONAL_SHA: ${{ needs.build.outputs.X86_OPTIONAL_SHA }}
ARM64_IMAGE_SHA: ${{ needs.build.outputs.ARM64_IMAGE_SHA }}
ARM64_MODULE_SHA: ${{ needs.build.outputs.ARM64_MODULE_SHA }}
ARM64_OPTIONAL_SHA: ${{ needs.build.outputs.ARM64_OPTIONAL_SHA }}
steps:
- uses: actions/checkout@main
- uses: actions/download-artifact@main
with:
path: release_images/
- name: Release Kernel
uses: softprops/action-gh-release@master
with:
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
body: |
**NOTICE**
* If you use `Docker Desktop`, You must install kernel modules in `docker-desktop` WSL2 image. More information is [here](https://github.com/Nevuly/WSL2-Rolling-Kernel-Issue/issues/21#issuecomment-2293228925).
**WARNING**
ARM64 kernel has not been tested. If you have any issues, please leave an issue on the [Issues tab](https://github.com/Nevuly/WSL2-Rolling-Kernel-Issue/issues)!
**Hash Information**
| File Name | SHA3-512 Checksum |
|:--------------:|:------:|
| bzImage-x86_64 | ${{ env.X86_IMAGE_SHA }} |
| bzImage-x86_64-modules_install.tar.gz | ${{ env.X86_MODULE_SHA }} |
| bzImage-x86_64-optional_install.tar.gz | ${{ env.X86_OPTIONAL_SHA }} |
| Image-arm64 | ${{ env.ARM64_IMAGE_SHA }} |
| Image-arm64-modules_install.tar.gz | ${{ env.ARM64_MODULE_SHA }} |
| Image-arm64-optional_install.tar.gz | ${{ env.ARM64_OPTIONAL_SHA }} |
**How to apply this kernel?**
Before you try to apply this kernel, You **MUST** shutdown your WSL. (wsl --shutdown)
Check this [document](https://learn.microsoft.com/en-us/windows/wsl/wsl-config).
**How to install kernel module package in WSL2?**
The installation script is already contained within the kernel module package tarball.
You can run **modules-install.sh** file with root.
**How to install kernel optionals package in WSL2? (Optional)**
The installation script is already contained within the kernel optionals package tarball.
It included kernel headers and kernel documentations.
You can run **optionals-install.sh** file with root.
**This kernel built on ArchLinux.**
files: |
release_images/*/*
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
fail_on_unmatched_files: true