Skip to content

Commit

Permalink
[202012][Mellanox] update sdk/fw build procedure (#14025) (#14220)
Browse files Browse the repository at this point in the history
- Why I did it
To optimize Mellanox platform build

- How I did it
sdk debs are now downloaded as Spectrum-SDK-Drivers-SONiC-Bins release
sx kernel is downloaded as zip from Spectrum-SDK-Drivers
  • Loading branch information
Yakiv-Huryk authored Mar 16, 2023
1 parent e2e3625 commit ab51158
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@
[submodule "src/sonic-telemetry"]
path = src/sonic-telemetry
url = https://github.com/sonic-net/sonic-gnmi
[submodule "Switch-SDK-drivers"]
path = platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers
url = https://github.com/Mellanox/Switch-SDK-drivers
[submodule "src/sonic-ztp"]
path = src/sonic-ztp
url = https://github.com/sonic-net/sonic-ztp
Expand Down
9 changes: 6 additions & 3 deletions platform/mellanox/fw.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ MLNX_FW_BASE_PATH = $(MLNX_SDK_BASE_PATH)
# Place an URL here to FW if you want to download FW instead
MLNX_FW_BASE_URL =

ifneq ($(MLNX_FW_BASE_URL), )
FW_FROM_URL = y
else
FW_FROM_URL = n

MLNX_FW_ASSETS_RELEASE_TAG = fw-2010.3196
MLNX_FW_ASSETS_URL = $(MLNX_ASSETS_GITHUB_URL)/releases/download/$(MLNX_FW_ASSETS_RELEASE_TAG)

ifeq ($(MLNX_FW_BASE_URL), )
MLNX_FW_BASE_URL = $(MLNX_FW_ASSETS_URL)
endif

MLNX_SPC_FW_VERSION = 13.2010.3196
Expand Down
14 changes: 11 additions & 3 deletions platform/mellanox/sdk-src/sx-kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ MAIN_TARGET = sx-kernel_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
DERIVED_TARGETS = sx-kernel-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
PACKAGE_NAME = sx_kernel

MLNX_SX_KERNEL_GITHUB_URL_BASE = https://github.com/Mellanox/Spectrum-SDK-Drivers/archive/refs/heads

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# get sources

Expand All @@ -13,9 +15,15 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
wget -c $(MLNX_SDK_SOURCE_BASE_URL)/$(PACKAGE_NAME)-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION).tar.gz -O - | tar -xz
pushd sx_kernel-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION)
else
pushd Switch-SDK-drivers
git reset --hard
git clean -xfd
rm -rf Spectrum-SDK-Drivers-$(MLNX_SDK_VERSION)
wget -c $(MLNX_SX_KERNEL_GITHUB_URL_BASE)/$(MLNX_SDK_VERSION).zip
unzip $(MLNX_SDK_VERSION).zip
rm -rf $(MLNX_SDK_VERSION).zip

pushd Spectrum-SDK-Drivers-$(MLNX_SDK_VERSION)
ln -s ./sx_scripts/Makefile ./Makefile
ln -s ./sx_scripts/makefile ./makefile
ln -s ./sx_scripts/configure ./configure
fi

# build
Expand Down
1 change: 0 additions & 1 deletion platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers
Submodule Switch-SDK-drivers deleted from a12968
17 changes: 8 additions & 9 deletions platform/mellanox/sdk.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
MLNX_SDK_BASE_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel/Switch-SDK-drivers/bin/
MLNX_SDK_PKG_BASE_PATH = $(MLNX_SDK_BASE_PATH)/$(BLDENV)/$(CONFIGURED_ARCH)/
MLNX_SDK_VERSION = 4.5.3196
MLNX_SDK_ISSU_VERSION = 101

MLNX_ASSETS_GITHUB_URL = https://github.com/Mellanox/Spectrum-SDK-Drivers-SONiC-Bins
MLNX_SDK_ASSETS_RELEASE_TAG = sdk-$(MLNX_SDK_VERSION)-$(BLDENV)-$(CONFIGURED_ARCH)
MLNX_SDK_ASSETS_URL = $(MLNX_ASSETS_GITHUB_URL)/releases/download/$(MLNX_SDK_ASSETS_RELEASE_TAG)
MLNX_SDK_DEB_VERSION = $(subst -,.,$(subst _,.,$(MLNX_SDK_VERSION)))

# Place here URL where SDK sources exist
Expand All @@ -14,7 +15,7 @@ else
SDK_FROM_SRC = n
endif

export MLNX_SDK_SOURCE_BASE_URL MLNX_SDK_VERSION MLNX_SDK_ISSU_VERSION MLNX_SDK_DEB_VERSION
export MLNX_SDK_SOURCE_BASE_URL MLNX_SDK_VERSION MLNX_SDK_ISSU_VERSION MLNX_SDK_DEB_VERSION MLNX_ASSETS_GITHUB_URL

MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_COMPLIB) $(SX_EXAMPLES) \
$(SX_GEN_UTILS) $(SX_SCEW) $(SXD_LIBS) $(WJH_LIBS) $(SX_ACL_HELPER)
Expand Down Expand Up @@ -136,21 +137,19 @@ $(SX_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel
SX_KERNEL_DEV = sx-kernel-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_KERNEL),$(SX_KERNEL_DEV)))

define make_path
$(1)_PATH = $(MLNX_SDK_PKG_BASE_PATH)
define make_url
$(1)_URL = $(MLNX_SDK_ASSETS_URL)/$(1)

endef

$(eval $(foreach deb,$(MLNX_SDK_DEBS),$(call make_path,$(deb))))
$(eval $(foreach deb,$(MLNX_SDK_RDEBS),$(call make_path,$(deb))))
$(eval $(foreach deb,$(PYTHON_SDK_API) $(SX_KERNEL) $(SX_KERNEL_DEV),$(call make_path,$(deb))))
$(eval $(foreach deb,$(MLNX_SDK_DEBS) $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API),$(call make_url,$(deb))))

SONIC_MAKE_DEBS += $(SX_KERNEL)

ifeq ($(SDK_FROM_SRC), y)
SONIC_MAKE_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API)
else
SONIC_COPY_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API)
SONIC_ONLINE_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API)
endif

mlnx-sdk-packages: $(addprefix $(DEBS_PATH)/, $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API) $(SX_KERNEL))
Expand Down

0 comments on commit ab51158

Please sign in to comment.