Skip to content

Commit

Permalink
[202211] [Mellanox] Update SAI build procedure (#15728) (#15742)
Browse files Browse the repository at this point in the history
Backport #15728

Why I did it
To optimize Mellanox platform SAI build

Work item tracking
Microsoft ADO (number only):
How I did it
SAI debs are now downloaded as Spectrum-SDK-Drivers-SONiC-Bins release.

How to verify it
Configure/build for Mellanox platform, check the image and ensure that correct SAI debs are included.
  • Loading branch information
keboliu authored Jul 23, 2023
1 parent 89e2cdd commit 19fd6d5
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@
[submodule "src/scapy"]
path = src/scapy
url = https://github.com/secdev/scapy.git
[submodule "platform/mellanox/mlnx-sai/SAI-Implementation"]
path = platform/mellanox/mlnx-sai/SAI-Implementation
url = https://github.com/Mellanox/SAI-Implementation
[submodule "src/sonic-mgmt-framework"]
path = src/sonic-mgmt-framework
url = https://github.com/sonic-net/sonic-mgmt-framework
Expand Down
2 changes: 0 additions & 2 deletions platform/mellanox/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Subdirectories
mlnx-sai/*
!mlnx-sai/Makefile
hw-management/*
!hw-management/Makefile
!hw-management/*.patch
Expand Down
27 changes: 26 additions & 1 deletion platform/mellanox/mlnx-sai.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
# Mellanox SAI

MLNX_SAI_VERSION = SAIBuild2211.24.0.21
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_DEB_VERSION = $(subst -,.,$(subst _,.,$(MLNX_SAI_VERSION)))

export MLNX_SAI_VERSION
# Place here URL where SAI sources exist
MLNX_SAI_SOURCE_BASE_URL =

ifneq ($(MLNX_SAI_SOURCE_BASE_URL), )
SAI_FROM_SRC = y
else
SAI_FROM_SRC = n
endif

export MLNX_SAI_VERSION MLNX_SAI_SOURCE_BASE_URL

MLNX_SAI = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_$(CONFIGURED_ARCH).deb
$(MLNX_SAI)_SRC_PATH = $(PLATFORM_PATH)/mlnx-sai
Expand All @@ -11,4 +24,16 @@ $(MLNX_SAI)_RDEPENDS += $(MLNX_SDK_RDEBS) $(MLNX_SDK_DEBS)
$(eval $(call add_conflict_package,$(MLNX_SAI),$(LIBSAIVS_DEV)))
MLNX_SAI_DBGSYM = mlnx-sai-dbgsym_1.mlnx.$(MLNX_SAI_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(MLNX_SAI),$(MLNX_SAI_DBGSYM)))

define make_url
$(1)_URL = $(MLNX_SAI_ASSETS_URL)/$(1)

endef

$(eval $(foreach deb,$(MLNX_SAI) $(MLNX_SAI_DBGSYM),$(call make_url,$(deb))))

ifeq ($(SAI_FROM_SRC), y)
SONIC_MAKE_DEBS += $(MLNX_SAI)
else
SONIC_ONLINE_DEBS += $(MLNX_SAI)
endif
6 changes: 6 additions & 0 deletions platform/mellanox/mlnx-sai/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
!Makefile

4 changes: 2 additions & 2 deletions platform/mellanox/mlnx-sai/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ MAIN_TARGET = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_$(CONFIGURED_ARCH).deb
DERIVED_TARGETS = mlnx-sai-dbgsym_1.mlnx.$(MLNX_SAI_VERSION)_$(CONFIGURED_ARCH).deb

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
pushd SAI-Implementation
rm -rf mlnx_sai
wget -c $(MLNX_SAI_SOURCE_BASE_URL)/$(MLNX_SAI_VERSION).tar.gz -O - | tar -xz
pushd mlnx_sai

chmod a+x autogen.sh
debuild -e 'make_extra_flags="DEFS=-DACS_OS -DCONFIG_SYSLOG"' -us -uc -d -b
popd

mv $(DERIVED_TARGETS) $* $(DEST)/
popd
1 change: 0 additions & 1 deletion platform/mellanox/mlnx-sai/SAI-Implementation
Submodule SAI-Implementation deleted from 3c07c2

0 comments on commit 19fd6d5

Please sign in to comment.