Skip to content

Commit

Permalink
[Nvidia] Enable iproute2 & fix mft build (#16)
Browse files Browse the repository at this point in the history
* Enable iproute2 as the SDK is also built

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>

* [Nvidia] Dont use mkbmdeb method of dkms to build the package

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>

* Include mft into the bookworm build

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>

* Added linux image to the Depends section of mft

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>

---------

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
  • Loading branch information
vivekrnv authored and saiarcot895 committed Oct 13, 2023
1 parent 2606956 commit 34f3c9f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 13 deletions.
26 changes: 16 additions & 10 deletions platform/mellanox/mft/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2016-2021 NVIDIA CORPORATION & AFFILIATES.
# Copyright (c) 2016-2023 NVIDIA CORPORATION & AFFILIATES.
# Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -39,14 +39,25 @@ MOD_DEB = kernel-mft-dkms-modules-$(KVERSION)_$(MFT_VERSION)_$(CONFIGURED_ARCH).
MAIN_TARGET = mft_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb
DERIVED_TARGETS = $(MOD_DEB) mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb

DKMS_BMDEB = /var/lib/dkms/kernel-mft-dkms/$(MFT_VERSION)/bmdeb
DKMS_CTRL = /var/lib/dkms/kernel-mft-dkms/
DKMS_TMP := $(shell mktemp -u -d -t dkms.XXXXXXXXXX)

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
rm -rf $(MFT_NAME)
wget -O $(MFT_TGZ) $(MFT_TGZ_URL)
tar xzf $(MFT_TGZ)

# Prepare the directory to build kernel-mft-dkms-modules debian package
mkdir -p $(DKMS_TMP)/DEBIAN
mkdir -p $(DKMS_TMP)/lib/modules/$(KVERSION)/updates/dkms/
export kversion="$(KVERSION)"
export mft_version="$(MFT_VERSION)"
j2 templates/control.j2 > $(DKMS_TMP)/DEBIAN/control
j2 templates/postinst.j2 > $(DKMS_TMP)/DEBIAN/postinst
j2 templates/postrm.j2 > $(DKMS_TMP)/DEBIAN/postrm
chmod +x $(DKMS_TMP)/DEBIAN/postinst
chmod +x $(DKMS_TMP)/DEBIAN/postrm

pushd $(MFT_NAME)/SDEBS

# put a lock here because dpkg does not allow installing packages in parallel
Expand All @@ -59,15 +70,10 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
popd

sudo dkms build kernel-mft-dkms/$(MFT_VERSION) -k $(KVERSION) -a $(CONFIGURED_ARCH)
sudo dkms mkbmdeb kernel-mft-dkms/$(MFT_VERSION) -k $(KVERSION) -a $(CONFIGURED_ARCH)

# w/a: remove dependencies
mkdir -p $(DKMS_TMP)/DEBIAN

dpkg -e $(DKMS_BMDEB)/$(MOD_DEB) $(DKMS_TMP)/DEBIAN
dpkg -x $(DKMS_BMDEB)/$(MOD_DEB) $(DKMS_TMP)

sed -i '/^Depends:/c\Depends:' $(DKMS_TMP)/DEBIAN/control
# copy the built modules
cp -r $(DKMS_CTRL)/kernel-$(KVERSION)-$(CONFIGURED_ARCH)/module/*.ko \
$(DKMS_TMP)/lib/modules/$(KVERSION)/updates/dkms/

pushd $(MFT_NAME)/DEBS
dpkg -b $(DKMS_TMP) .
Expand Down
10 changes: 10 additions & 0 deletions platform/mellanox/mft/templates/control.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Package: kernel-mft-dkms-modules-{{kversion}}
Source: kernel-mft-dkms-dkms-bin
Version: {{mft_version}}
Architecture: amd64
Maintainer: Vivek Reddy <vkarri@nvidia.com>
Provides: kernel-mft-dkms-modules
Depends: linux-image-{{ kversion }}-unsigned
Section: misc
Priority: optional
Description: kernel-mft-dkms binary drivers for linux-image-{{kversion}} Kernel
3 changes: 3 additions & 0 deletions platform/mellanox/mft/templates/postinst.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
set -e
depmod -a {{kversion}}
3 changes: 3 additions & 0 deletions platform/mellanox/mft/templates/postrm.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
set -e
depmod -a {{kversion}}
6 changes: 3 additions & 3 deletions platform/mellanox/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# TODO: update for Bookworm: mft, iproute2
# TODO: update for Bookworm: sx_kernel & issu-version
include $(PLATFORM_PATH)/sdk.mk
include $(PLATFORM_PATH)/fw.mk
#include $(PLATFORM_PATH)/mft.mk
include $(PLATFORM_PATH)/mft.mk
include $(PLATFORM_PATH)/mft-fwtrace-cfg.mk
include $(PLATFORM_PATH)/mlnx-sai.mk
include $(PLATFORM_PATH)/hw-management.mk
Expand All @@ -31,7 +31,7 @@ include $(PLATFORM_PATH)/mlnx-ffb.mk
#include $(PLATFORM_PATH)/issu-version.mk
include $(PLATFORM_PATH)/mlnx-onie-fw-update.mk
include $(PLATFORM_PATH)/mlnx-ssd-fw-update.mk
#include $(PLATFORM_PATH)/iproute2.mk
include $(PLATFORM_PATH)/iproute2.mk
include $(PLATFORM_PATH)/install-pending-fw.mk
include $(PLATFORM_PATH)/integration-scripts.mk

Expand Down

0 comments on commit 34f3c9f

Please sign in to comment.