Skip to content

Commit edcdc6f

Browse files
committed
Enable kernel modules and NVIDIA GPU support
- Enable CONFIG_MODULES, CONFIG_MODULE_UNLOAD, CONFIG_MODVERSIONS - Enable CONFIG_DRM and CONFIG_DRM_FBDEV_EMULATION for NVIDIA driver - Add CI workflow steps to build NVIDIA open-gpu-kernel-modules (570.86.16) - Package and upload nvidia-modules-x86_64.tar.gz as release artifact This enables GPU passthrough VMs to load NVIDIA kernel modules at boot, allowing guests to use passed-through GPUs with nvidia-smi and CUDA.
1 parent 0303f29 commit edcdc6f

File tree

4 files changed

+41
-6
lines changed

4 files changed

+41
-6
lines changed

.github/workflows/release.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ jobs:
2828
run: make ch_defconfig
2929
- name: Build kernel (x86-64)
3030
run: CFLAGS="-Wa,-mx86-used-note=no" make bzImage -j `nproc`
31+
- name: Build modules (x86-64)
32+
run: make modules -j `nproc`
33+
- name: Clone NVIDIA open-gpu-kernel-modules
34+
run: git clone --depth 1 --branch 570.86.16 https://github.com/NVIDIA/open-gpu-kernel-modules.git
35+
- name: Build NVIDIA modules (x86-64)
36+
run: |
37+
cd open-gpu-kernel-modules
38+
make modules KERNEL_UNAME=$(cd .. && make -s kernelrelease) SYSSRC=$(pwd)/.. -j $(nproc)
39+
- name: Package NVIDIA modules (x86-64)
40+
run: |
41+
KVER=$(make -s kernelrelease)
42+
mkdir -p nvidia-modules/lib/modules/$KVER/kernel/drivers/gpu
43+
cp open-gpu-kernel-modules/kernel-open/*.ko nvidia-modules/lib/modules/$KVER/kernel/drivers/gpu/
44+
tar czf nvidia-modules-x86_64.tar.gz -C nvidia-modules .
3145
- name: Create release
3246
id: create_release
3347
uses: actions/create-release@v1
@@ -55,6 +69,15 @@ jobs:
5569
asset_path: vmlinux
5670
asset_name: vmlinux-x86_64
5771
asset_content_type: application/octet-stream
72+
- name: Upload NVIDIA modules for x86_64
73+
uses: actions/upload-release-asset@v1
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
with:
77+
upload_url: ${{ steps.create_release.outputs.upload_url }}
78+
asset_path: nvidia-modules-x86_64.tar.gz
79+
asset_name: nvidia-modules-x86_64.tar.gz
80+
asset_content_type: application/gzip
5881
- name: Upload Image.gz for aarch64
5982
uses: actions/upload-release-asset@v1
6083
env:

arch/arm64/configs/ch_defconfig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,10 @@ CONFIG_FUNCTION_ALIGNMENT=4
794794
# end of General architecture-dependent options
795795

796796
CONFIG_RT_MUTEXES=y
797-
# CONFIG_MODULES is not set
797+
CONFIG_MODULES=y
798+
CONFIG_MODULE_UNLOAD=y
799+
CONFIG_MODVERSIONS=y
800+
CONFIG_MODULE_SRCVERSION_ALL=y
798801
CONFIG_BLOCK=y
799802
CONFIG_BLOCK_LEGACY_AUTOLOAD=y
800803
CONFIG_BLK_CGROUP_RWSTAT=y
@@ -2002,7 +2005,8 @@ CONFIG_BCMA_POSSIBLE=y
20022005
#
20032006
CONFIG_VIDEO=y
20042007
# CONFIG_AUXDISPLAY is not set
2005-
# CONFIG_DRM is not set
2008+
CONFIG_DRM=y
2009+
CONFIG_DRM_FBDEV_EMULATION=y
20062010

20072011
#
20082012
# Frame buffer Devices

arch/riscv/configs/ch_defconfig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,10 @@ CONFIG_FUNCTION_ALIGNMENT=0
655655
# end of General architecture-dependent options
656656

657657
CONFIG_RT_MUTEXES=y
658-
# CONFIG_MODULES is not set
658+
CONFIG_MODULES=y
659+
CONFIG_MODULE_UNLOAD=y
660+
CONFIG_MODVERSIONS=y
661+
CONFIG_MODULE_SRCVERSION_ALL=y
659662
CONFIG_BLOCK=y
660663
CONFIG_BLOCK_LEGACY_AUTOLOAD=y
661664
CONFIG_BLK_CGROUP_RWSTAT=y
@@ -1769,7 +1772,8 @@ CONFIG_BCMA_POSSIBLE=y
17691772
#
17701773
CONFIG_VIDEO=y
17711774
# CONFIG_AUXDISPLAY is not set
1772-
# CONFIG_DRM is not set
1775+
CONFIG_DRM=y
1776+
CONFIG_DRM_FBDEV_EMULATION=y
17731777

17741778
#
17751779
# Frame buffer Devices

arch/x86/configs/ch_defconfig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,10 @@ CONFIG_CC_HAS_SANE_FUNCTION_ALIGNMENT=y
857857
# end of General architecture-dependent options
858858

859859
CONFIG_RT_MUTEXES=y
860-
# CONFIG_MODULES is not set
860+
CONFIG_MODULES=y
861+
CONFIG_MODULE_UNLOAD=y
862+
CONFIG_MODVERSIONS=y
863+
CONFIG_MODULE_SRCVERSION_ALL=y
861864
CONFIG_BLOCK=y
862865
CONFIG_BLOCK_LEGACY_AUTOLOAD=y
863866
CONFIG_BLK_CGROUP_RWSTAT=y
@@ -2024,7 +2027,8 @@ CONFIG_VIDEO=y
20242027
# CONFIG_AUXDISPLAY is not set
20252028
# CONFIG_AGP is not set
20262029
# CONFIG_VGA_SWITCHEROO is not set
2027-
# CONFIG_DRM is not set
2030+
CONFIG_DRM=y
2031+
CONFIG_DRM_FBDEV_EMULATION=y
20282032

20292033
#
20302034
# Frame buffer Devices

0 commit comments

Comments
 (0)