Last active
June 16, 2024 17:11
-
-
Save mimura1133/895b2f5f79ca1de1fbd7b0acf10358d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# | |
# The original version is https://gist.github.com/krzys-h/e2def49966aa42bbd3316dfb794f4d6a | |
# | |
if [ "$EUID" -ne 0 ]; then | |
echo "Swithing to root..." | |
exec sudo $0 "$@" | |
fi | |
git clone --depth=1 https://github.com/Nevuly/WSL2-Linux-Kernel-Rolling | |
cd WSL2-Linux-Kernel-Rolling | |
VERSION=$(git rev-parse --short HEAD) | |
cp -r drivers/hv/dxgkrnl /usr/src/dxgkrnl-$VERSION | |
mkdir -p /usr/src/dxgkrnl-$VERSION/inc/{uapi/misc,linux} | |
cp include/uapi/misc/d3dkmthk.h /usr/src/dxgkrnl-$VERSION/inc/uapi/misc/d3dkmthk.h | |
cp include/linux/hyperv.h /usr/src/dxgkrnl-$VERSION/inc/linux/hyperv_dxgkrnl.h | |
sed -i 's/\$(CONFIG_DXGKRNL)/m/' /usr/src/dxgkrnl-$VERSION/Makefile | |
sed -i 's#linux/hyperv.h#linux/hyperv_dxgkrnl.h#' /usr/src/dxgkrnl-$VERSION/dxgmodule.c | |
echo "EXTRA_CFLAGS=-I\$(PWD)/inc" >> /usr/src/dxgkrnl-$VERSION/Makefile | |
cat > /usr/src/dxgkrnl-$VERSION/dkms.conf <<EOF | |
PACKAGE_NAME="dxgkrnl" | |
PACKAGE_VERSION="$VERSION" | |
BUILT_MODULE_NAME="dxgkrnl" | |
DEST_MODULE_LOCATION="/kernel/drivers/hv/dxgkrnl/" | |
AUTOINSTALL="yes" | |
EOF | |
dkms add dxgkrnl/$VERSION | |
dkms build dxgkrnl/$VERSION | |
dkms install dxgkrnl/$VERSION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment