From eee75208c0f95f6c1c670921bf30cf88b642566b Mon Sep 17 00:00:00 2001 From: Vivek Date: Wed, 20 Sep 2023 14:48:58 -0700 Subject: [PATCH] [Nvidia] Enable iproute2 & fix mft build (#16) * Enable iproute2 as the SDK is also built Signed-off-by: Vivek Reddy * [Nvidia] Dont use mkbmdeb method of dkms to build the package Signed-off-by: Vivek Reddy * Include mft into the bookworm build Signed-off-by: Vivek Reddy * Added linux image to the Depends section of mft Signed-off-by: Vivek Reddy --------- Signed-off-by: Vivek Reddy --- platform/mellanox/mft/Makefile | 26 +++++++++++++-------- platform/mellanox/mft/templates/control.j2 | 10 ++++++++ platform/mellanox/mft/templates/postinst.j2 | 3 +++ platform/mellanox/mft/templates/postrm.j2 | 3 +++ platform/mellanox/rules.mk | 6 ++--- 5 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 platform/mellanox/mft/templates/control.j2 create mode 100644 platform/mellanox/mft/templates/postinst.j2 create mode 100644 platform/mellanox/mft/templates/postrm.j2 diff --git a/platform/mellanox/mft/Makefile b/platform/mellanox/mft/Makefile index 3139e874cc08..553b3a74ea7e 100644 --- a/platform/mellanox/mft/Makefile +++ b/platform/mellanox/mft/Makefile @@ -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"); @@ -39,7 +39,7 @@ 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)/% : @@ -47,6 +47,17 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : 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 @@ -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) . diff --git a/platform/mellanox/mft/templates/control.j2 b/platform/mellanox/mft/templates/control.j2 new file mode 100644 index 000000000000..629019b23db4 --- /dev/null +++ b/platform/mellanox/mft/templates/control.j2 @@ -0,0 +1,10 @@ +Package: kernel-mft-dkms-modules-{{kversion}} +Source: kernel-mft-dkms-dkms-bin +Version: {{mft_version}} +Architecture: amd64 +Maintainer: Vivek Reddy +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 diff --git a/platform/mellanox/mft/templates/postinst.j2 b/platform/mellanox/mft/templates/postinst.j2 new file mode 100644 index 000000000000..b0dc57909367 --- /dev/null +++ b/platform/mellanox/mft/templates/postinst.j2 @@ -0,0 +1,3 @@ +#!/bin/sh +set -e +depmod -a {{kversion}} diff --git a/platform/mellanox/mft/templates/postrm.j2 b/platform/mellanox/mft/templates/postrm.j2 new file mode 100644 index 000000000000..b0dc57909367 --- /dev/null +++ b/platform/mellanox/mft/templates/postrm.j2 @@ -0,0 +1,3 @@ +#!/bin/sh +set -e +depmod -a {{kversion}} diff --git a/platform/mellanox/rules.mk b/platform/mellanox/rules.mk index 2326e059b6bf..cdb4c2495967 100644 --- a/platform/mellanox/rules.mk +++ b/platform/mellanox/rules.mk @@ -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 @@ -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