Skip to content

Commit

Permalink
drbd,dkms: use $kernel_source_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
WanzenBug committed Dec 10, 2024
1 parent 7b44dde commit 7f964da
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions misc/dkms.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PACKAGE_VERSION="#MODULE_VERSION#"
PACKAGE_NAME="drbd"
MAKE="make -C src/drbd KDIR=/lib/modules/$kernelver/build"
CLEAN="make -C src/drbd clean KDIR=/lib/modules/$kernelver/build"
MAKE="make -C src/drbd KDIR=$kernel_source_dir"
CLEAN="make -C src/drbd clean KDIR=$kernel_source_dir"
AUTOINSTALL="yes"

BUILT_MODULE_NAME[0]="drbd"
Expand All @@ -16,7 +16,7 @@ DEST_MODULE_LOCATION[2]="/kernel/drivers/block/drbd"

IDX=3

if grep -q ^CONFIG_INFINIBAND= /lib/modules/$kernelver/build/.config; then
if grep -q ^CONFIG_INFINIBAND= "$kernel_source_dir/.config"; then
BUILT_MODULE_NAME[$IDX]="drbd_transport_rdma"
BUILT_MODULE_LOCATION[$IDX]="./src/drbd/build-current/"
DEST_MODULE_LOCATION[$IDX]="/kernel/drivers/block/drbd"
Expand All @@ -31,7 +31,7 @@ MAKE+=" BUILD_OFED=1"
# See drbd/Kbuild: this is that check for the kernel version, but worse: check for kernel >= 4.17
IFS=".-" read -ra KVER <<< "$kernelver"
if [ "${KVER[0]}" -ge 4 ] && ( [ "${KVER[0]}" -gt 4 ] || [ "${KVER[1]}" -ge 17 ] ) ; then
if grep -q ^CONFIG_TLS= /lib/modules/$kernelver/build/.config && ! grep -q ^CONFIG_NET_HANDSHAKE= /lib/modules/$kernelver/build/.config ; then
if grep -q ^CONFIG_TLS= "$kernel_source_dir/.config" && ! grep -q ^CONFIG_NET_HANDSHAKE= "$kernel_source_dir/.config" ; then
BUILT_MODULE_NAME[$IDX]="handshake"
BUILT_MODULE_LOCATION[$IDX]="./src/drbd/build-current/drbd-kernel-compat/handshake"
DEST_MODULE_LOCATION[$IDX]="/kernel/net/handshake"
Expand All @@ -43,14 +43,14 @@ fi
# So we try to find a compiler that matches the version used to build the original kernel.
get_cc_version() {
if [ -n "$1" ]; then
scl run "$1" -- "/lib/modules/$kernelver/build/scripts/cc-version.sh" cc | cut -d' ' -f2
scl run "$1" -- "$kernel_source_dir/scripts/cc-version.sh" cc | cut -d' ' -f2
else
"/lib/modules/$kernelver/build/scripts/cc-version.sh" cc | cut -d' ' -f2
"$kernel_source_dir/scripts/cc-version.sh" cc | cut -d' ' -f2
fi
}

if [ -e "/lib/modules/$kernelver/build/scripts/cc-version.sh" ]; then
KERNEL_GCC_VERSION="$(grep ^CONFIG_GCC_VERSION= "/lib/modules/$kernelver/build/.config" | cut -d= -f2)"
if [ -e "$kernel_source_dir/scripts/cc-version.sh" ]; then
KERNEL_GCC_VERSION="$(grep ^CONFIG_GCC_VERSION= "$kernel_source_dir/.config" | cut -d= -f2)"

if [ "$KERNEL_GCC_VERSION" -gt "$(get_cc_version)" ] && command -v scl >/dev/null; then
for COLLECTION in $(scl list-collections); do
Expand Down

0 comments on commit 7f964da

Please sign in to comment.