From 8e24514bfbca9eae613dff24c4e804aac678162e Mon Sep 17 00:00:00 2001 From: Kebo Liu Date: Sat, 15 Jul 2023 06:03:33 +0800 Subject: [PATCH] [Mellanox] Update SAI build procedure (#15728) = Why I did it To optimize Mellanox platform SAI build - 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. --- .gitmodules | 3 --- platform/mellanox/.gitignore | 2 -- platform/mellanox/mlnx-sai.mk | 27 ++++++++++++++++++- platform/mellanox/mlnx-sai/.gitignore | 6 +++++ platform/mellanox/mlnx-sai/Makefile | 4 +-- platform/mellanox/mlnx-sai/SAI-Implementation | 1 - 6 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 platform/mellanox/mlnx-sai/.gitignore delete mode 160000 platform/mellanox/mlnx-sai/SAI-Implementation diff --git a/.gitmodules b/.gitmodules index 69ce0f77be28..dcc3740421ae 100644 --- a/.gitmodules +++ b/.gitmodules @@ -73,9 +73,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 diff --git a/platform/mellanox/.gitignore b/platform/mellanox/.gitignore index 1f3d15d640d4..9fc0ece98e1a 100644 --- a/platform/mellanox/.gitignore +++ b/platform/mellanox/.gitignore @@ -1,6 +1,4 @@ # Subdirectories -mlnx-sai/* -!mlnx-sai/Makefile hw-management/* !hw-management/Makefile !hw-management/*.patch diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 8f4298245482..3368cfe6b02c 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -1,8 +1,21 @@ # Mellanox SAI MLNX_SAI_VERSION = SAIBuild2205.24.0.2 +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)_amd64.deb $(MLNX_SAI)_SRC_PATH = $(PLATFORM_PATH)/mlnx-sai @@ -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)_amd64.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 diff --git a/platform/mellanox/mlnx-sai/.gitignore b/platform/mellanox/mlnx-sai/.gitignore new file mode 100644 index 000000000000..7e5cb7d266aa --- /dev/null +++ b/platform/mellanox/mlnx-sai/.gitignore @@ -0,0 +1,6 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore +!Makefile + diff --git a/platform/mellanox/mlnx-sai/Makefile b/platform/mellanox/mlnx-sai/Makefile index 0bf5514231a9..bbf26bd53f61 100644 --- a/platform/mellanox/mlnx-sai/Makefile +++ b/platform/mellanox/mlnx-sai/Makefile @@ -6,11 +6,11 @@ MAIN_TARGET = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb DERIVED_TARGETS = mlnx-sai-dbgsym_1.mlnx.$(MLNX_SAI_VERSION)_amd64.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 debuild -e 'make_extra_flags="DEFS=-DACS_OS -DCONFIG_SYSLOG"' -us -uc -d -b popd mv $(DERIVED_TARGETS) $* $(DEST)/ - popd diff --git a/platform/mellanox/mlnx-sai/SAI-Implementation b/platform/mellanox/mlnx-sai/SAI-Implementation deleted file mode 160000 index 2a6270d763be..000000000000 --- a/platform/mellanox/mlnx-sai/SAI-Implementation +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2a6270d763bea7cf80637ff2368cc1927a354bae