Skip to content

Commit

Permalink
[Nvidia] Fix mlnx-sai build failure (#14)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
vivekrnv authored and yxieca committed Nov 22, 2023
1 parent 73605a9 commit 1fccc97
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 23 deletions.
10 changes: 5 additions & 5 deletions platform/mellanox/mft.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)_SRC_PATH = $(PLATFORM_PATH)/mft
SONIC_MAKE_DEBS += $(MFT)

$(MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
MFT_OEM = mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(MFT),$(MFT_OEM)))

KERNEL_MFT = kernel-mft-dkms-modules-$(KVERSION)_$(MFT_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(MFT),$(KERNEL_MFT)))
$(KERNEL_MFT)_SRC_PATH = $(PLATFORM_PATH)/mft
$(KERNEL_MFT)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)

MFT_OEM = mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(MFT),$(MFT_OEM)))
SONIC_MAKE_DEBS += $(MFT) $(KERNEL_MFT)
52 changes: 36 additions & 16 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 @@ -34,19 +34,46 @@ MFT_TGZ_URL = http://www.mellanox.com/downloads/MFT/$(MFT_TGZ)
endif

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

MFT_TMP = /tmp/mft_build/

$(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)
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,24 +86,17 @@ $(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) .
popd

rm -rf $(DKMS_TMP)

# fix timestamp because we do not actually build tools, only kernel
touch $(MFT_NAME)/DEBS/*.deb
mv $(MFT_NAME)/DEBS/*.deb $(DEST)
mv $(MFT_NAME)/DEBS/$(KERNEL_MFT_TARGET) $(DEST)


$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)
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}}
2 changes: 1 addition & 1 deletion platform/mellanox/mlnx-sai.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
MLNX_SAI_VERSION = SAIBuild2211.25.1.4
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_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)))

# Place here URL where SAI sources exist
Expand Down
2 changes: 1 addition & 1 deletion rules/docker-platform-monitor.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)_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)
Expand Down

0 comments on commit 1fccc97

Please sign in to comment.