Skip to content

Commit

Permalink
Adjust dkms configuration to support building datagpu against nvidia …
Browse files Browse the repository at this point in the history
…drivers
  • Loading branch information
JJL772 committed Oct 17, 2024
1 parent 68bc141 commit 59c0654
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
9 changes: 8 additions & 1 deletion data_gpu/driver/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@
# contained in the LICENSE.txt file.
# ----------------------------------------------------------------------------

-include Makefile.local

# Args to this Makefile
NVIDIA_DRIVERS ?= ""
ifeq ($(NVIDIA_DRIVERS),)
$(error NVIDIA_DRIVERS is not set, please generate Makefile.local using build-nvidia.sh, or supply NVIDIA_DRIVERS on the command line)
endif

$(info Using NVIDIA_DRIVERS=$(NVIDIA_DRIVERS))

CC ?= ""

# Define the module name.
Expand Down
41 changes: 41 additions & 0 deletions data_gpu/driver/build-nvidia.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

set -e

while test $# -gt 0; do
case $1 in
-v)
VERSION="$2"
shift 2;
;;
-s)
SRCTREE="$2"
shift 2;
;;
*)
echo "USAGE: $0 -s src_tree -v kver"
exit 1
;;
esac
done

if [ $EUID -ne 0 ]; then
echo "This script must be run as root!"
exit 1
fi

if [ -z "$VERSION" ] || [ -z "$SRCTREE" ]; then
echo "USAGE: $0 -s src_tree -v kver"
exit 1
fi

# Determine the NVIDIA module version installed for this kernel
NVIDIA_VER=$(dkms status nvidia -k $VERSION | tr '/' '-' | awk -F, '{ print $1 }')

# Generate a local Makefile that contains the configuration
echo "NVIDIA_DRIVERS=$SRCTREE/$NVIDIA_VER" > Makefile.local

echo "--> Building NVIDIA drivers version $NVIDIA_VER"

make -C "$SRCTREE/$NVIDIA_VER" -j$(nproc)

7 changes: 5 additions & 2 deletions data_gpu/driver/dkms.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
MAKE="make"
PRE_BUILD="./build-nvidia.sh -s $source_tree -v $kernelver"
CLEAN="make clean"
MAKE="make"
BUILT_MODULE_NAME=datagpu
BUILT_MODULE_LOCATION=.
DEST_MODULE_LOCATION="/updates"
DEST_MODULE_LOCATION="/kernel/modules/misc"
PACKAGE_NAME=datagpu-dkms
REMAKE_INITRD=no
AUTOINSTALL="yes"
BUILD_DEPENDS="nvidia"
NO_WEAK_MODULES="yes"
#PACKAGE_VERSION=

0 comments on commit 59c0654

Please sign in to comment.