Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Nvidia] Enable iproute2 & fix mft build #16

Merged
merged 4 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
9 changes: 9 additions & 0 deletions platform/mellanox/mft/templates/control.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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
saiarcot895 marked this conversation as resolved.
Show resolved Hide resolved
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