[Nvidia] Fix mlnx-sai build failure (#14)

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

[Nvidia] Enable iproute2 & fix mft build (#16)

* 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>

* Added linux image to the Depends section of mft

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

[Nvidia] [Bookworm] Separate KERNEL_MFT into a new target (#16782)

* [Nvidia] Seperate KERNEL_MFT into a new target because of kernel header dependency

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

* Update linux-kernel submodule

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

* Fix paralell build problem

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

---------

Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
This commit is contained in:
Vivek 2023-09-18 11:54:28 -07:00 committed by Ying Xie
parent 73605a98ef
commit 1fccc97ee7
7 changed files with 60 additions and 24 deletions

View File

@ -31,12 +31,12 @@ export MFT_VERSION MFT_REVISION MFT_FROM_INTERNAL MLNX_MFT_INTERNAL_SOURCE_BASE_
MFT = mft_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb MFT = mft_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb
$(MFT)_SRC_PATH = $(PLATFORM_PATH)/mft $(MFT)_SRC_PATH = $(PLATFORM_PATH)/mft
SONIC_MAKE_DEBS += $(MFT)
$(MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
KERNEL_MFT = kernel-mft-dkms-modules-$(KVERSION)_$(MFT_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(MFT),$(KERNEL_MFT)))
MFT_OEM = mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb MFT_OEM = mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(MFT),$(MFT_OEM))) $(eval $(call add_derived_package,$(MFT),$(MFT_OEM)))
KERNEL_MFT = kernel-mft-dkms-modules-$(KVERSION)_$(MFT_VERSION)_$(CONFIGURED_ARCH).deb
$(KERNEL_MFT)_SRC_PATH = $(PLATFORM_PATH)/mft
$(KERNEL_MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
SONIC_MAKE_DEBS += $(MFT) $(KERNEL_MFT)

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2016-2021 NVIDIA CORPORATION & AFFILIATES. # Copyright (c) 2016-2023 NVIDIA CORPORATION & AFFILIATES.
# Apache-2.0 # Apache-2.0
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
@ -34,19 +34,46 @@ MFT_TGZ_URL = http://www.mellanox.com/downloads/MFT/$(MFT_TGZ)
endif endif
SRC_DEB = kernel-mft-dkms_$(MFT_VERSION)-$(MFT_REVISION)_all.deb SRC_DEB = kernel-mft-dkms_$(MFT_VERSION)-$(MFT_REVISION)_all.deb
MOD_DEB = kernel-mft-dkms-modules-$(KVERSION)_$(MFT_VERSION)_$(CONFIGURED_ARCH).deb KERNEL_MFT_TARGET = kernel-mft-dkms-modules-$(KVERSION)_$(MFT_VERSION)_$(CONFIGURED_ARCH).deb
MAIN_TARGET = mft_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb MAIN_TARGET = mft_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb
DERIVED_TARGETS = $(MOD_DEB) mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb DERIVED_TARGETS = 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) DKMS_TMP := $(shell mktemp -u -d -t dkms.XXXXXXXXXX)
MFT_TMP = /tmp/mft_build/
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
mkdir -p $(MFT_TMP)
pushd $(MFT_TMP)
wget -O $(MFT_TGZ) $(MFT_TGZ_URL)
tar xzf $(MFT_TGZ)
# fix timestamp
touch $(MFT_NAME)/DEBS/*.deb
mv $(MFT_NAME)/DEBS/*.deb $(DEST)
popd
rm -rf $(MFT_TMP)
$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)
$(addprefix $(DEST)/, $(KERNEL_MFT_TARGET)): $(DEST)/% :
rm -rf $(MFT_NAME) rm -rf $(MFT_NAME)
wget -O $(MFT_TGZ) $(MFT_TGZ_URL) wget -O $(MFT_TGZ) $(MFT_TGZ_URL)
tar xzf $(MFT_TGZ) 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 pushd $(MFT_NAME)/SDEBS
# put a lock here because dpkg does not allow installing packages in parallel # put a lock here because dpkg does not allow installing packages in parallel
@ -59,15 +86,10 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
popd popd
sudo dkms build kernel-mft-dkms/$(MFT_VERSION) -k $(KVERSION) -a $(CONFIGURED_ARCH) 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 # copy the built modules
mkdir -p $(DKMS_TMP)/DEBIAN cp -r $(DKMS_CTRL)/kernel-$(KVERSION)-$(CONFIGURED_ARCH)/module/*.ko \
$(DKMS_TMP)/lib/modules/$(KVERSION)/updates/dkms/
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
pushd $(MFT_NAME)/DEBS pushd $(MFT_NAME)/DEBS
dpkg -b $(DKMS_TMP) . dpkg -b $(DKMS_TMP) .
@ -75,8 +97,6 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
rm -rf $(DKMS_TMP) rm -rf $(DKMS_TMP)
# fix timestamp because we do not actually build tools, only kernel mv $(MFT_NAME)/DEBS/$(KERNEL_MFT_TARGET) $(DEST)
touch $(MFT_NAME)/DEBS/*.deb
mv $(MFT_NAME)/DEBS/*.deb $(DEST)
$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)

View File

@ -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

View File

@ -0,0 +1,3 @@
#!/bin/sh
set -e
depmod -a {{kversion}}

View File

@ -0,0 +1,3 @@
#!/bin/sh
set -e
depmod -a {{kversion}}

View File

@ -3,7 +3,7 @@
MLNX_SAI_VERSION = SAIBuild2211.25.1.4 MLNX_SAI_VERSION = SAIBuild2211.25.1.4
MLNX_SAI_ASSETS_GITHUB_URL = https://github.com/Mellanox/Spectrum-SDK-Drivers-SONiC-Bins MLNX_SAI_ASSETS_GITHUB_URL = https://github.com/Mellanox/Spectrum-SDK-Drivers-SONiC-Bins
MLNX_SAI_ASSETS_RELEASE_TAG = sai-$(MLNX_SAI_VERSION)-$(BLDENV)-$(CONFIGURED_ARCH) MLNX_SAI_ASSETS_RELEASE_TAG = sai-$(MLNX_SAI_VERSION)-$(BLDENV)-$(CONFIGURED_ARCH)
MLNX_SAI_ASSETS_URL = $(MLNX_ASSETS_GITHUB_URL)/releases/download/$(MLNX_SAI_ASSETS_RELEASE_TAG) MLNX_SAI_ASSETS_URL = $(MLNX_SAI_ASSETS_GITHUB_URL)/releases/download/$(MLNX_SAI_ASSETS_RELEASE_TAG)
MLNX_SAI_DEB_VERSION = $(subst -,.,$(subst _,.,$(MLNX_SAI_VERSION))) MLNX_SAI_DEB_VERSION = $(subst -,.,$(subst _,.,$(MLNX_SAI_VERSION)))
# Place here URL where SAI sources exist # Place here URL where SAI sources exist

View File

@ -6,7 +6,7 @@ DOCKER_PLATFORM_MONITOR_DBG = $(DOCKER_PLATFORM_MONITOR_STEM)-$(DBG_IMAGE_MARK).
$(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/$(DOCKER_PLATFORM_MONITOR_STEM) $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/$(DOCKER_PLATFORM_MONITOR_STEM)
$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS) $(FANCONTROL) $(SENSORD) $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON) $(MFT) $(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS) $(FANCONTROL) $(SENSORD) $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3)