Skip to content

Commit 19fd6d5

Browse files
authored
[202211] [Mellanox] Update SAI build procedure (#15728) (#15742)
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.
1 parent 89e2cdd commit 19fd6d5

6 files changed

Lines changed: 34 additions & 9 deletions

File tree

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@
7272
[submodule "src/scapy"]
7373
path = src/scapy
7474
url = https://github.com/secdev/scapy.git
75-
[submodule "platform/mellanox/mlnx-sai/SAI-Implementation"]
76-
path = platform/mellanox/mlnx-sai/SAI-Implementation
77-
url = https://github.com/Mellanox/SAI-Implementation
7875
[submodule "src/sonic-mgmt-framework"]
7976
path = src/sonic-mgmt-framework
8077
url = https://github.com/sonic-net/sonic-mgmt-framework

platform/mellanox/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Subdirectories
2-
mlnx-sai/*
3-
!mlnx-sai/Makefile
42
hw-management/*
53
!hw-management/Makefile
64
!hw-management/*.patch

platform/mellanox/mlnx-sai.mk

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
# Mellanox SAI
22

33
MLNX_SAI_VERSION = SAIBuild2211.24.0.21
4+
MLNX_SAI_ASSETS_GITHUB_URL = https://github.com/Mellanox/Spectrum-SDK-Drivers-SONiC-Bins
5+
MLNX_SAI_ASSETS_RELEASE_TAG = sai-$(MLNX_SAI_VERSION)-$(BLDENV)-$(CONFIGURED_ARCH)
6+
MLNX_SAI_ASSETS_URL = $(MLNX_ASSETS_GITHUB_URL)/releases/download/$(MLNX_SAI_ASSETS_RELEASE_TAG)
7+
MLNX_SAI_DEB_VERSION = $(subst -,.,$(subst _,.,$(MLNX_SAI_VERSION)))
48

5-
export MLNX_SAI_VERSION
9+
# Place here URL where SAI sources exist
10+
MLNX_SAI_SOURCE_BASE_URL =
11+
12+
ifneq ($(MLNX_SAI_SOURCE_BASE_URL), )
13+
SAI_FROM_SRC = y
14+
else
15+
SAI_FROM_SRC = n
16+
endif
17+
18+
export MLNX_SAI_VERSION MLNX_SAI_SOURCE_BASE_URL
619

720
MLNX_SAI = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_$(CONFIGURED_ARCH).deb
821
$(MLNX_SAI)_SRC_PATH = $(PLATFORM_PATH)/mlnx-sai
@@ -11,4 +24,16 @@ $(MLNX_SAI)_RDEPENDS += $(MLNX_SDK_RDEBS) $(MLNX_SDK_DEBS)
1124
$(eval $(call add_conflict_package,$(MLNX_SAI),$(LIBSAIVS_DEV)))
1225
MLNX_SAI_DBGSYM = mlnx-sai-dbgsym_1.mlnx.$(MLNX_SAI_VERSION)_$(CONFIGURED_ARCH).deb
1326
$(eval $(call add_derived_package,$(MLNX_SAI),$(MLNX_SAI_DBGSYM)))
27+
28+
define make_url
29+
$(1)_URL = $(MLNX_SAI_ASSETS_URL)/$(1)
30+
31+
endef
32+
33+
$(eval $(foreach deb,$(MLNX_SAI) $(MLNX_SAI_DBGSYM),$(call make_url,$(deb))))
34+
35+
ifeq ($(SAI_FROM_SRC), y)
1436
SONIC_MAKE_DEBS += $(MLNX_SAI)
37+
else
38+
SONIC_ONLINE_DEBS += $(MLNX_SAI)
39+
endif
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ignore everything in this directory
2+
*
3+
# Except this file
4+
!.gitignore
5+
!Makefile
6+

platform/mellanox/mlnx-sai/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ MAIN_TARGET = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_$(CONFIGURED_ARCH).deb
66
DERIVED_TARGETS = mlnx-sai-dbgsym_1.mlnx.$(MLNX_SAI_VERSION)_$(CONFIGURED_ARCH).deb
77

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

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

1617
mv $(DERIVED_TARGETS) $* $(DEST)/
17-
popd
Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)