summaryrefslogtreecommitdiff
path: root/scripts/package-build/linux-kernel
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/package-build/linux-kernel')
-rwxr-xr-xscripts/package-build/linux-kernel/build-mellanox-ofed.sh105
-rwxr-xr-xscripts/package-build/linux-kernel/build.py2
-rw-r--r--scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0001-mlx5-build-on-kernels-with-ndo_default_qcfg-but-no-n.patch85
-rw-r--r--scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0002-mlx5-build-on-kernels-where-xsk_buff_get_metadata-ta.patch62
-rw-r--r--scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0003-debian-drop-mlnx-ofed-kernel-dkms-install-file.patch37
-rw-r--r--scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0004-debian-do-not-ship-build-sources-in-the-modules-pack.patch102
6 files changed, 350 insertions, 43 deletions
diff --git a/scripts/package-build/linux-kernel/build-mellanox-ofed.sh b/scripts/package-build/linux-kernel/build-mellanox-ofed.sh
index a8ba13e7..56c42493 100755
--- a/scripts/package-build/linux-kernel/build-mellanox-ofed.sh
+++ b/scripts/package-build/linux-kernel/build-mellanox-ofed.sh
@@ -6,11 +6,6 @@ CWD=$(pwd)
KERNEL_VAR_FILE=${CWD}/kernel-vars
. ${CWD}/common.sh
-if [ $(id -u) -ne 0 ]; then
- echo "Mellanox OFED script needs to be run as root"
- exit 1
-fi
-
require_amd64 "Mellanox OFED"
if [ ! -f ${KERNEL_VAR_FILE} ]; then
@@ -20,25 +15,23 @@ fi
. ${KERNEL_VAR_FILE}
-mlxver="24.07-0.6.1.0"
-url="https://www.mellanox.com/downloads/ofed/MLNX_OFED-${mlxver}/MLNX_OFED_SRC-debian-${mlxver}.tgz"
+docaver="3.5.0"
+mlxver="26.07-0.7.7.0"
+url="https://linux.mellanox.com/public/repo/doca/${docaver}/SOURCES/mlnx_ofed/MLNX_OFED_SRC-debian-${mlxver}.tgz"
cd ${CWD}
DRIVER_FILE=$(basename ${url} | sed -e s/tar_0/tar/)
-DRIVER_SHA1="c64defa8fb38dcbce153adc09834ab5cdcecd791"
+DRIVER_SHA256="bbf2a5b56727e5099b3bdc0d1b0e7b8a09b758c78048f715ed90c5730bd64f96"
DRIVER_DIR="${DRIVER_FILE%.tgz}"
DRIVER_NAME="ofed"
DRIVER_PRFX="MLNX_OFED"
DRIVER_VERSION=$(echo ${DRIVER_DIR} | awk -F${DRIVER_PRFX} '{print $2}' | sed 's/^-//;s|_SRC-debian-||')
-DRIVER_VERSION_EXTRA=""
# Build up Debian related variables required for packaging
DEBIAN_ARCH=$(dpkg --print-architecture)
DEBIAN_DIR="${CWD}/vyos-mellanox-${DRIVER_NAME}_${DRIVER_VERSION}_${DEBIAN_ARCH}"
-DEBIAN_CONTROL="${DEBIAN_DIR}/DEBIAN/control"
-DEBIAN_POSTINST="${CWD}/vyos-mellanox-ofed.postinst"
# Fetch OFED driver source from Nvidia
if [ -e ${DRIVER_FILE} ]; then
@@ -50,9 +43,9 @@ if [ "$?" -ne "0" ]; then
fi
# Verify integrity
-echo "${DRIVER_SHA1} ${DRIVER_FILE}" | sha1sum -c -
+echo "${DRIVER_SHA256} ${DRIVER_FILE}" | sha256sum -c -
if [ $? != 0 ]; then
- echo SHA1 checksum mismatch
+ echo SHA256 checksum mismatch
exit 1
fi
@@ -70,43 +63,69 @@ if [ -z $KERNEL_DIR ]; then
exit 1
fi
-rm -f SOURCES/ibarr_*.tar.gz
-rm -f SOURCES/ibdump_*.tar.gz
-rm -f SOURCES/ibsim_*.tar.gz
-rm -f SOURCES/iser_*.tar.gz
-rm -f SOURCES/isert_*.tar.gz
-rm -f SOURCES/kernel-mft_*.tar.gz
-rm -f SOURCES/knem_*.tar.gz
-rm -f SOURCES/libvma_*.tar.gz
-rm -f SOURCES/libxlio_*.tar.gz
-rm -f SOURCES/mlnx-ethtool_*.tar.gz
-rm -f SOURCES/mlnx-iproute2_*.tar.gz
-rm -f SOURCES/mlnx-nfsrdma_*.tar.gz
-rm -f SOURCES/mlnx-nvme_*.tar.gz
-rm -f SOURCES/mlx-steering-dump_*.tar.gz
-rm -f SOURCES/mpitests_*.tar.gz
-rm -f SOURCES/mstflint_*.tar.gz
-rm -f SOURCES/ofed-scripts_*.tar.gz
-rm -f SOURCES/openmpi_*.tar.gz
-rm -f SOURCES/openvswitch_*.tar.gz
-rm -f SOURCES/perftest_*.tar.gz
-rm -f SOURCES/rdma-core_*.tar.gz
-rm -f SOURCES/rshim_*.tar.gz
-rm -f SOURCES/sockperf_*.tar.gz
-rm -f SOURCES/srp_*.tar.gz
-rm -f SOURCES/ucx_*.tar.gz
+rm -f SOURCES/ibarr_*.tar.*
+rm -f SOURCES/ibdump_*.tar.*
+rm -f SOURCES/ibsim_*.tar.*
+rm -f SOURCES/iser_*.tar.*
+rm -f SOURCES/isert_*.tar.*
+rm -f SOURCES/kernel-mft_*.tar.*
+rm -f SOURCES/libvma_*.tar.*
+rm -f SOURCES/libxlio_*.tar.*
+rm -f SOURCES/mlnx-ethtool_*.tar.*
+rm -f SOURCES/mlnx-iproute2_*.tar.*
+rm -f SOURCES/mlnx-nfsrdma_*.tar.*
+rm -f SOURCES/mlnx-nvme_*.tar.*
+rm -f SOURCES/mlx-steering-dump_*.tar.*
+rm -f SOURCES/ofed-scripts_*.tar.*
+rm -f SOURCES/openmpi_*.tar.*
+rm -f SOURCES/perftest_*.tar.*
+rm -f SOURCES/rdma-core_*.tar.*
+rm -f SOURCES/rshim_*.tar.*
+rm -f SOURCES/sockperf_*.tar.*
+rm -f SOURCES/srp_*.tar.*
+rm -f SOURCES/ucx_*.tar.*
+rm -f SOURCES/virtiofs_*.tar.*
+rm -f SOURCES/xpmem_*.tar.*
+
+# install.pl builds from the orig tarballs in SOURCES, patch them in place
+PATCH_DIR=${CWD}/patches/mlnx-ofed-kernel
+if [ -d ${PATCH_DIR} ]; then
+ ORIG_TAR=$(ls SOURCES/mlnx-ofed-kernel_*.orig.tar.xz)
+ ORIG_DIR=$(mktemp -d)
+ tar -C ${ORIG_DIR} -xf ${ORIG_TAR}
+ for patch in $(ls ${PATCH_DIR})
+ do
+ echo "I: Apply patch: ${PATCH_DIR}/${patch}"
+ patch -d ${ORIG_DIR}/mlnx-ofed-kernel-* -p1 < ${PATCH_DIR}/${patch}
+ done
+ tar -C ${ORIG_DIR} -cJf ${ORIG_TAR} .
+ rm -rf ${ORIG_DIR}
+fi
+# --build-only keeps install.pl from touching the host's packages so no root
+# is needed. It is only accepted with --kernel-only, whose module set is
+# trimmed back to what was built before. Build dependencies are left to
+# dpkg-buildpackage, the install.pl check would try to apt-get them.
./install.pl \
- --basic --dpdk \
+ --kernel-only --build-only \
+ --without-depcheck \
--without-dkms \
--without-mlnx-nvme-modules \
- --with-vma --vma-vpi --vma-eth \
- --guest --hypervisor \
+ --without-sdp --without-srpt --without-rds \
+ --without-e_ipoib --without-nfsrdma \
--builddir ${DEBIAN_DIR}/mlx \
--distro ${DEB_DISTRO} \
--kernel-sources ${KERNEL_DIR} \
--kernel ${KERNEL_VERSION}${KERNEL_SUFFIX}
+# mlnx-ofed-kernel-utils depends on mlnx-tools, which --kernel-only skips
+MLNX_TOOLS_DIR=${DEBIAN_DIR}/mlx/mlnx-tools
+mkdir -p ${MLNX_TOOLS_DIR}
+tar -C ${MLNX_TOOLS_DIR} -xf $(ls SOURCES/mlnx-tools_*.orig.tar.xz)
+(cd ${MLNX_TOOLS_DIR}/mlnx-tools-* && dpkg-buildpackage -us -uc -b)
+mkdir -p DEBS/${DEB_DISTRO}/x86_64
+cp ${MLNX_TOOLS_DIR}/mlnx-tools_*.deb DEBS/${DEB_DISTRO}/x86_64/
+
if [ $DROP_DEV_DBG_DEBS -eq 1 ]; then
echo "I: Removing development and debug packages"
rm -f $(find $CWD/$DRIVER_DIR/DEBS/$DEB_DISTRO -type f | grep -E '\-dev|\-dbg')
@@ -123,9 +142,11 @@ TMP_DIR="tmp-ofed-sign"
dpkg-deb --raw-extract ${DEB_NAME} ${TMP_DIR}
# Sign generated Kernel modules
${CWD}/sign-modules.sh ${TMP_DIR}
+# Signing compresses the modules, md5sums still lists the plain .ko files
+(cd ${TMP_DIR} && find . -path ./DEBIAN -prune -o -type f -printf '%P\n' | sort | xargs md5sum > DEBIAN/md5sums)
# Cleanup and repack DEB
rm -f ${DEB_NAME}
-dpkg-deb --build ${TMP_DIR} ${DEB_NAME}
+dpkg-deb --build --root-owner-group ${TMP_DIR} ${DEB_NAME}
rm -rf ${TMP_DIR}
if [ -f ${DRIVER_FILE} ]; then
diff --git a/scripts/package-build/linux-kernel/build.py b/scripts/package-build/linux-kernel/build.py
index 295f44b9..71af402d 100755
--- a/scripts/package-build/linux-kernel/build.py
+++ b/scripts/package-build/linux-kernel/build.py
@@ -239,7 +239,7 @@ def build_intel(driver_name: str, commit_id: str, scm_url: str):
def build_mellanox_ofed():
"""Build Mellanox OFED"""
- run(['sudo', './build-mellanox-ofed.sh'], check=True)
+ run(['./build-mellanox-ofed.sh'], check=True)
def build_realtek_r8126():
diff --git a/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0001-mlx5-build-on-kernels-with-ndo_default_qcfg-but-no-n.patch b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0001-mlx5-build-on-kernels-with-ndo_default_qcfg-but-no-n.patch
new file mode 100644
index 00000000..aaff6df5
--- /dev/null
+++ b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0001-mlx5-build-on-kernels-with-ndo_default_qcfg-but-no-n.patch
@@ -0,0 +1,85 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Christian Breunig <christian@breunig.cc>
+Date: Sun, 8 Nov 2026 09:15:04 +0000
+Subject: [PATCH] mlx5: build on kernels with ndo_default_qcfg but no
+ ndo_validate_qcfg
+
+OFED assumes ndo_default_qcfg and ndo_validate_qcfg arrived together
+(Linux 7.0) and guards both with HAVE_NDO_DEFAULT_QCFG. Linux 6.18.y
+stable backported the queue config struct and ndo_default_qcfg without
+ndo_validate_qcfg, so the mlx5 driver fails to compile.
+
+Add a separate HAVE_NDO_VALIDATE_QCFG feature test and a backport patch
+which only wires up the validate callback if the kernel provides it.
+---
+ .../0379-BACKPORT-ndo_validate_qcfg.patch | 28 +++++++++++++++++++
+ compat/config/rdma.m4 | 18 ++++++++++++
+ 2 files changed, 46 insertions(+)
+ create mode 100644 backports/0379-BACKPORT-ndo_validate_qcfg.patch
+
+diff --git a/backports/0379-BACKPORT-ndo_validate_qcfg.patch b/backports/0379-BACKPORT-ndo_validate_qcfg.patch
+new file mode 100644
+index 0000000..f0baf3c
+--- /dev/null
++++ b/backports/0379-BACKPORT-ndo_validate_qcfg.patch
+@@ -0,0 +1,28 @@
++--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
++@@ -6879,6 +6879,7 @@ static void mlx5e_queue_default_qcfg(str
++ qcfg->rx_page_size = PAGE_SIZE;
++ }
++
+++#ifdef HAVE_NDO_VALIDATE_QCFG
++ static int mlx5e_queue_validate_qcfg(struct net_device *dev,
++ struct netdev_queue_config *qcfg,
++ struct netlink_ext_ack *extack)
++@@ -6903,6 +6904,7 @@ static int mlx5e_queue_validate_qcfg(str
++
++ return 0;
++ }
+++#endif /* HAVE_NDO_VALIDATE_QCFG */
++
++ static bool mlx5e_queue_validate_page_size(struct net_device *dev,
++ struct netdev_queue_config *qcfg,
++@@ -7067,7 +7069,9 @@ static const struct netdev_queue_mgmt_op
++ #ifdef HAVE_NDO_DEFAULT_QCFG
++ /* Newer kernels (7.0+): qcfg sub-feature on netdev_queue_mgmt_ops */
++ .ndo_default_qcfg = mlx5e_queue_default_qcfg,
+++#ifdef HAVE_NDO_VALIDATE_QCFG
++ .ndo_validate_qcfg = mlx5e_queue_validate_qcfg,
+++#endif
++ .supported_params = QCFG_RX_PAGE_SIZE,
++ #endif
++ };
+diff --git a/compat/config/rdma.m4 b/compat/config/rdma.m4
+index 02aeb4d..f9a185a 100644
+--- a/compat/config/rdma.m4
++++ b/compat/config/rdma.m4
+@@ -4703,6 +4703,24 @@ MLNX_RDMA_TEST_CASE(HAVE_DEVL_RATE_NODES_DESTROY_UNSETS_PARENT, [devl_rate_nodes
+ return 0;
+ ])
+
++ MLNX_RDMA_TEST_CASE(HAVE_NDO_VALIDATE_QCFG, [struct netdev_queue_mgmt_ops has ndo_validate_qcfg], [
++ #include <net/netdev_queues.h>
++
++ static int test_validate(struct net_device *dev, struct netdev_queue_config *qcfg,
++ struct netlink_ext_ack *extack);
++ static int test_validate(struct net_device *dev, struct netdev_queue_config *qcfg,
++ struct netlink_ext_ack *extack)
++ {
++ return 0;
++ }
++ ],[
++ struct netdev_queue_mgmt_ops ops = {
++ .ndo_validate_qcfg = test_validate,
++ };
++
++ return 0;
++ ])
++
+ MLNX_RDMA_TEST_CASE(HAVE_IRQ_UPDATE_AFFINITY_HINT, [irq_set_affinity_and_hint is defined], [
+ #include <linux/interrupt.h>
+ ],[
+--
+2.39.5
+
diff --git a/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0002-mlx5-build-on-kernels-where-xsk_buff_get_metadata-ta.patch b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0002-mlx5-build-on-kernels-where-xsk_buff_get_metadata-ta.patch
new file mode 100644
index 00000000..0ce617fa
--- /dev/null
+++ b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0002-mlx5-build-on-kernels-where-xsk_buff_get_metadata-ta.patch
@@ -0,0 +1,62 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Christian Breunig <christian@breunig.cc>
+Date: Sun, 8 Nov 2026 09:26:17 +0000
+Subject: [PATCH] mlx5: build on kernels where xsk_buff_get_metadata takes
+ options
+
+Linux 6.18.y stable backported upstream commit a6e4b9a6deb9 ("xsk: honor
+XDP_TX_METADATA in zero-copy path"), which adds the descriptor options
+to xsk_buff_get_metadata(). OFED still calls it with two arguments and
+the mlx5 XSK TX path fails to compile.
+
+Add a HAVE_XSK_BUFF_GET_METADATA_OPTIONS feature test and a backport
+patch passing the descriptor options, matching the in-tree driver.
+---
+ ...0-BACKPORT-xsk_buff_get_metadata-options.patch | 15 +++++++++++++++
+ compat/config/rdma.m4 | 8 ++++++++
+ 2 files changed, 23 insertions(+)
+ create mode 100644 backports/0380-BACKPORT-xsk_buff_get_metadata-options.patch
+
+diff --git a/backports/0380-BACKPORT-xsk_buff_get_metadata-options.patch b/backports/0380-BACKPORT-xsk_buff_get_metadata-options.patch
+new file mode 100644
+index 0000000..3c83cde
+--- /dev/null
++++ b/backports/0380-BACKPORT-xsk_buff_get_metadata-options.patch
+@@ -0,0 +1,15 @@
++--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c
+++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c
++@@ -119,8 +119,12 @@ bool mlx5e_xsk_tx(struct mlx5e_xdpsq *sq
++ #endif
++ xdptxd.len = desc.len;
++ #ifdef HAVE_XSK_TX_METADATA_OPS
+++#ifdef HAVE_XSK_BUFF_GET_METADATA_OPTIONS
+++ meta = xsk_buff_get_metadata(pool, desc.addr, desc.options);
+++#else
++ meta = xsk_buff_get_metadata(pool, desc.addr);
++ #endif
+++#endif
++
++ #ifdef HAVE_XSK_BUFF_ALLOC
++ xsk_buff_raw_dma_sync_for_device(pool, xdptxd.dma_addr, xdptxd.len);
+diff --git a/compat/config/rdma.m4 b/compat/config/rdma.m4
+index f9a185a..070595c 100644
+--- a/compat/config/rdma.m4
++++ b/compat/config/rdma.m4
+@@ -4721,6 +4721,14 @@ MLNX_RDMA_TEST_CASE(HAVE_DEVL_RATE_NODES_DESTROY_UNSETS_PARENT, [devl_rate_nodes
+ return 0;
+ ])
+
++ MLNX_RDMA_TEST_CASE(HAVE_XSK_BUFF_GET_METADATA_OPTIONS, [xsk_buff_get_metadata has options parameter], [
++ #include <net/xdp_sock_drv.h>
++ ],[
++ xsk_buff_get_metadata(NULL, 0, 0);
++
++ return 0;
++ ])
++
+ MLNX_RDMA_TEST_CASE(HAVE_IRQ_UPDATE_AFFINITY_HINT, [irq_set_affinity_and_hint is defined], [
+ #include <linux/interrupt.h>
+ ],[
+--
+2.39.5
+
diff --git a/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0003-debian-drop-mlnx-ofed-kernel-dkms-install-file.patch b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0003-debian-drop-mlnx-ofed-kernel-dkms-install-file.patch
new file mode 100644
index 00000000..aaf339ae
--- /dev/null
+++ b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0003-debian-drop-mlnx-ofed-kernel-dkms-install-file.patch
@@ -0,0 +1,37 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Christian Breunig <christian@breunig.cc>
+Date: Sun, 8 Nov 2026 09:32:47 +0000
+Subject: [PATCH] debian: drop mlnx-ofed-kernel-dkms install file
+
+The dkms package is excluded by the "modules" build profile, but
+dh_install still evaluates the install files of all packages to support
+dh_missing. This file is a dh-exec script and dh-exec is only a build
+dependency outside of the "modules" profile, so building with -Pmodules
+fails unless dh-exec happens to be installed.
+
+The dkms package is never built, drop its install file.
+---
+ debian/mlnx-ofed-kernel-dkms.install | 11 -----------
+ 1 file changed, 11 deletions(-)
+ delete mode 100755 debian/mlnx-ofed-kernel-dkms.install
+
+diff --git a/debian/mlnx-ofed-kernel-dkms.install b/debian/mlnx-ofed-kernel-dkms.install
+deleted file mode 100755
+index d116b98..0000000
+--- a/debian/mlnx-ofed-kernel-dkms.install
++++ /dev/null
+@@ -1,11 +0,0 @@
+-#!/usr/bin/dh-exec
+-source/compat* usr/src/${pname}-${dkms_version}
+-source/include usr/src/${pname}-${dkms_version}
+-source/drivers usr/src/${pname}-${dkms_version}
+-source/fs usr/src/${pname}-${dkms_version}
+-source/net usr/src/${pname}-${dkms_version}
+-source/backports usr/src/${pname}-${dkms_version}
+-source/backports_applied usr/src/${pname}-${dkms_version}
+-source/ofed_scripts usr/src/${pname}-${dkms_version}
+-source/COPYING usr/src/${pname}-${dkms_version}
+-source/debian/changelog usr/src/${pname}-${dkms_version}/debian
+--
+2.39.5
+
diff --git a/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0004-debian-do-not-ship-build-sources-in-the-modules-pack.patch b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0004-debian-do-not-ship-build-sources-in-the-modules-pack.patch
new file mode 100644
index 00000000..ccdbc4a1
--- /dev/null
+++ b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0004-debian-do-not-ship-build-sources-in-the-modules-pack.patch
@@ -0,0 +1,102 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Christian Breunig <christian@breunig.cc>
+Date: Sun, 8 Nov 2026 13:21:54 +0000
+Subject: [PATCH] debian: do not ship build sources in the modules package
+
+Without DKMS the modules package still installs headers, compat sources
+and Module.symvers to /usr/src/ofa_kernel, and registers them as an
+alternative, so further modules can be compiled on the target system.
+
+VyOS ships precompiled modules only and never builds kernel code on the
+target. Drop the source tree and the maintainer scripts which only
+managed its alternative.
+---
+ debian/mlnx-ofed-kernel-modules.postinst | 17 -----------------
+ debian/mlnx-ofed-kernel-modules.prerm | 10 ----------
+ debian/rules | 22 ----------------------
+ 3 files changed, 49 deletions(-)
+ delete mode 100755 debian/mlnx-ofed-kernel-modules.postinst
+ delete mode 100755 debian/mlnx-ofed-kernel-modules.prerm
+
+diff --git a/debian/mlnx-ofed-kernel-modules.postinst b/debian/mlnx-ofed-kernel-modules.postinst
+deleted file mode 100755
+index a67c0c4..0000000
+--- a/debian/mlnx-ofed-kernel-modules.postinst
++++ /dev/null
+@@ -1,17 +0,0 @@
+-#!/bin/bash
+-
+-symlink="/usr/src/ofa_kernel/default"
+-if [ "$1" = "configure" ]; then
+- if [ -L "$symlink" ] && \
+- ! update-alternatives --list ofa_kernel_headers >/dev/null 2>&1;
+- then
+- rm -f "$symlink"
+- fi
+- mkdir -p /usr/src/ofa_kernel
+- update-alternatives --install "$symlink" ofa_kernel_headers \
+- /usr/src/ofa_kernel/@ARCH@/@KVER@ 30
+-fi
+-
+-#DEBHELPER#
+-
+-exit 0
+diff --git a/debian/mlnx-ofed-kernel-modules.prerm b/debian/mlnx-ofed-kernel-modules.prerm
+deleted file mode 100755
+index 6f1b1df..0000000
+--- a/debian/mlnx-ofed-kernel-modules.prerm
++++ /dev/null
+@@ -1,10 +0,0 @@
+-#!/bin/sh
+-
+-set -e
+-
+-if [ "$1" = remove ]; then
+- update-alternatives --remove ofa_kernel_headers \
+- /usr/src/ofa_kernel/@ARCH@/@KVER@
+-fi
+-
+-#DEBHELPER#
+diff --git a/debian/rules b/debian/rules
+index 775cadd..2570424 100755
+--- a/debian/rules
++++ b/debian/rules
+@@ -112,22 +112,6 @@ endif
+ endif
+
+
+- #
+- # Sources for building stuff over MLNX_OFED
+- #
+- # With DKMS, copy the below files and folders during post_build since the
+- # new DKMS versions started to remove the whole build directory.
+- # however, some old versions of DKMS are buggy and ignores POST_BUILD
+-ifeq ($(WITH_DKMS),1)
+-else
+- dh_installdirs -p$(pdkms) $(mod_dev_dir)
+- cp -a include/ debian/$(pdkms)$(mod_dev_dir)
+- cp -a config* debian/$(pdkms)$(mod_dev_dir)
+- cp -a compat* debian/$(pdkms)$(mod_dev_dir)
+- cp -a ofed_scripts debian/$(pdkms)$(mod_dev_dir)
+- cp -a Module*.symvers debian/$(pdkms)$(mod_dev_dir)
+-endif
+-
+ # Force DKMS to install our modules.
+ # This is mostly needed for modules that do not have a version number info, as DKMS
+ # will compare their srcversion field, which does not really say which module is newer.
+@@ -178,12 +162,6 @@ ifeq ($(DKMS3),1)
+ # versions:
+ echo "activate-await update-initramfs" >debian/$(pdkms)/DEBIAN/triggers
+ endif
+-else
+- sed -i \
+- -e 's/@KVER@/$(kernelver)/' \
+- -e 's/@ARCH@/$(deb_arch)/' \
+- debian/$(pdkms)/DEBIAN/postinst \
+- debian/$(pdkms)/DEBIAN/prerm
+ endif
+
+ ifneq ($(MLNX_KO_NO_STRIP),1)
+--
+2.39.5
+