-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdkms.conf.in
152 lines (141 loc) · 4.74 KB
/
dkms.conf.in
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
## Global options
PACKAGE_NAME="@PACKAGE_NAME@"
# Package version should change with each new version
PACKAGE_VERSION="@PACKAGE_VERSION@"
## SHS DKMS variables
SHS_DKMS_PACKAGEROOT="$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION"
SHS_DKMS_BUILDROOT="$SHS_DKMS_PACKAGEROOT/build"
#
# cxi driver optional support for amd, nvidia, and intel GPUs.
#
# By default, support the "latest version" of each gpu installed in DKMS will
# be included but "latest version" is defined using `ls` alphanumeric sorting.
#
# _IF_ a different version of the GPU is needed or desired, then set the
# appropriate variable in the dkms-aux.conf file.
#
if [ -f ${SHS_DKMS_BUILDROOT}/dkms.aux.conf ] && [ -r ${SHS_DKMS_BUILDROOT}/dkms.aux.conf ]
then
. ${SHS_DKMS_BUILDROOT}/dkms.aux.conf
fi
if [ ${DISABLE_GPU_AMD:-0} -eq 0 ]
then
if [ -z "${PATH_GPU_AMD}" ]
then
# Find newest candidate directory that contains an 'include'
# subdirectory - sometimes uninstall can leave behind an empty directory
# in /usr/src
for dir in $(/bin/ls -d ${source_tree}/amdgpu-* 2>/dev/null | sort --version-sort); do
if [ -d $dir/include ]; then
PATH_GPU_AMD=$dir
fi
done
elif [ ! -d "${PATH_GPU_AMD}" ]
then
printf 'dkms.conf: ERROR: PATH_GPU_AMD="%s" is not a path to a directory\n' "${PATH_GPU_AMD}"
fi
else
unset PATH_GPU_AMD
fi
if [ ${DISABLE_GPU_NVIDIA:-0} -eq 0 ]
then
if [ -z "${PATH_GPU_NVIDIA}" ]
then
# Find newest candidate directory that contains an 'include'
# subdirectory - sometimes uninstall can leave behind an empty directory
# in /usr/src
for dir in $(/bin/ls -d ${source_tree}/kernel-modules/nvidia-*/{.,kernel-open} 2>/dev/null | sort --version-sort); do
if [ -d $dir/nvidia ]; then
PATH_GPU_NVIDIA=$dir/nvidia
fi
done
# If this isn't a COS system, look for kernel modules in the normal place
if [ -z "${PATH_GPU_NVIDIA}" ]
then
for dir in $(/bin/ls -d ${source_tree}/nvidia-*/{.,kernel-open} 2>/dev/null | sort --version-sort); do
if [ -d $dir/nvidia ]; then
PATH_GPU_NVIDIA=$dir/nvidia
fi
done
fi
elif [ ! -d "${PATH_GPU_NVIDIA}" ]
then
printf 'dkms.conf: ERROR: PATH_GPU_NVIDIA="%s" is not a path to a directory\n' "${PATH_GPU_NVIDIA}"
fi
else
unset PATH_GPU_NVIDIA
fi
if [ ${DISABLE_GPU_INTEL:-0} -eq 0 ]
then
if [ -z "${PATH_GPU_INTEL}" ]
then
# Find newest candidate directory that contains an 'include'
# subdirectory - sometimes uninstall can leave behind an empty directory
# in /usr/src
for dir in $(/bin/ls -d ${source_tree}/intel-dmabuf-* 2>/dev/null | sort --version-sort); do
if [ -d $dir/include ]; then
PATH_GPU_INTEL=$dir
fi
done
elif [ ! -d "${PATH_GPU_INTEL}" ]
then
printf 'dkms.conf: ERROR: PATH_GPU_INTEL="%s" is not a path to a directory\n' "${PATH_GPU_INTEL}"
fi
else
unset PATH_GPU_INTEL
fi
# Fetch the Module.symvers for our dependencies, stored in the DKMS tree
SLINGSHOT_BASE_LINK_SYMVERS=${dkms_tree}/cray-slingshot-base-link/kernel-${kernelver}-${arch}/module/Module.symvers
SL_SYMVERS=${dkms_tree}/sl-driver/kernel-${kernelver}-${arch}/module/Module.symvers.sl
BUILD_DEPENDS=("cray-slingshot-base-link" "sl-driver")
if [ -n "$PATH_GPU_AMD" ]; then
BUILD_DEPENDS+=("amdgpu")
fi
if [ -n "$PATH_GPU_NVIDIA" ]; then
BUILD_DEPENDS+=("nvidia")
fi
if [ -n "$PATH_GPU_INTEL" ]; then
BUILD_DEPENDS+=("intel-dmabuf")
fi
SHS_MAKE_ARGS=" \
-C $kernel_source_dir \
M=${SHS_DKMS_BUILDROOT}/cxi \
NO_BUILD_TESTS=1 \
FIRMWARE_CASSINI_DIR=/usr/include \
CASSINI_HEADERS_DIR=/usr/include \
SLINGSHOT_BASE_LINK_DIR=/usr/include \
SL_DIR=/usr/include \
AMDGPU_DIR=$PATH_GPU_AMD \
INTEL_DMABUF_DIR=$PATH_GPU_INTEL \
NVIDIA_DIR=$PATH_GPU_NVIDIA \
KBUILD_EXTRA_SYMBOLS='${SLINGSHOT_BASE_LINK_SYMVERS} ${SL_SYMVERS}' \
"
MAKE="'make' ${SHS_MAKE_ARGS} modules"
CLEAN="'make' ${SHS_MAKE_ARGS} clean"
AUTOINSTALL='yes'
#
# cxi-ss1.ko
#
BUILT_MODULE_LOCATION[0]=cxi
DEST_MODULE_LOCATION[0]=/extra
BUILT_MODULE_NAME[0]=cxi-ss1
DEST_MODULE_NAME[0]=cxi-ss1
STRIP[0]=no
#
# cxi-eth.ko
#
BUILT_MODULE_LOCATION[1]=cxi
DEST_MODULE_LOCATION[1]=/extra
BUILT_MODULE_NAME[1]=cxi-eth
DEST_MODULE_NAME[1]=cxi-eth
STRIP[1]=no
#
# cxi-user.ko
#
BUILT_MODULE_LOCATION[2]=cxi
DEST_MODULE_LOCATION[2]=/extra
BUILT_MODULE_NAME[2]=cxi-user
DEST_MODULE_NAME[2]=cxi-user
STRIP[2]=no
# Post-build hook to copy our Module.symvers into the DKMS tree so that other modules can build against it
POST_BUILD="dkms.post_build.sh ${SHS_DKMS_BUILDROOT}/cxi ${SHS_DKMS_PACKAGEROOT}"