[mellanox] build SDK driver from open source (#3580)

* build SDK driver package sx-kernel from open sourced repository Mellanox/Switch-SDK-driver
* copy SDK packages and FW binaries from Mellanox/Switch-SDK-driver

Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
This commit is contained in:
Stepan Blyshchak 2019-10-08 17:57:13 +03:00 committed by lguohan
parent ce2ecf2680
commit aec2477060
6 changed files with 43 additions and 14 deletions

3
.gitmodules vendored
View File

@ -66,3 +66,6 @@
[submodule "platform/mellanox/mlnx-sai/SAI-Implementation"] [submodule "platform/mellanox/mlnx-sai/SAI-Implementation"]
path = platform/mellanox/mlnx-sai/SAI-Implementation path = platform/mellanox/mlnx-sai/SAI-Implementation
url = https://github.com/Mellanox/SAI-Implementation url = https://github.com/Mellanox/SAI-Implementation
[submodule "Switch-SDK-drivers"]
path = platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers
url = https://github.com/Mellanox/Switch-SDK-drivers

View File

@ -8,6 +8,7 @@ mft/*
!mft/Makefile !mft/Makefile
sdk-src/*/* sdk-src/*/*
!sdk-src/*/Makefile !sdk-src/*/Makefile
!sdk-src/sx-kernel/Switch-SDK-drivers/
!sdk-src/*/*.patch !sdk-src/*/*.patch
*/build */build
*/deb_dist */deb_dist

View File

@ -1,16 +1,32 @@
# mellanox firmware # mellanox firmware
MLNX_FW_BASE_URL = $(MLNX_SDK_BASE_URL) 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
endif
MLNX_SPC_FW_VERSION = 13.2000.2162 MLNX_SPC_FW_VERSION = 13.2000.2162
MLNX_SPC_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_SPC_FW_VERSION))-EVB.mfa MLNX_SPC_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_SPC_FW_VERSION))-EVB.mfa
$(MLNX_SPC_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH)
$(MLNX_SPC_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC_FW_FILE) $(MLNX_SPC_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC_FW_FILE)
SONIC_ONLINE_FILES += $(MLNX_SPC_FW_FILE)
MLNX_SPC2_FW_VERSION = 29.2000.2162 MLNX_SPC2_FW_VERSION = 29.2000.2162
MLNX_SPC2_FW_FILE = fw-SPC2-rel-$(subst .,_,$(MLNX_SPC2_FW_VERSION))-EVB.mfa MLNX_SPC2_FW_FILE = fw-SPC2-rel-$(subst .,_,$(MLNX_SPC2_FW_VERSION))-EVB.mfa
$(MLNX_SPC2_FW_FILE)_PATH = $(MLNX_FW_BASE_PATH)
$(MLNX_SPC2_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC2_FW_FILE) $(MLNX_SPC2_FW_FILE)_URL = $(MLNX_FW_BASE_URL)/$(MLNX_SPC2_FW_FILE)
SONIC_ONLINE_FILES += $(MLNX_SPC2_FW_FILE)
ifeq ($(FW_FROM_URL),n)
SONIC_COPY_FILES += $(MLNX_SPC_FW_FILE) $(MLNX_SPC2_FW_FILE)
else
SONIC_ONLINE_FILES += $(MLNX_SPC_FW_FILE) $(MLNX_SPC2_FW_FILE)
endif
export MLNX_SPC_FW_VERSION export MLNX_SPC_FW_VERSION
export MLNX_SPC_FW_FILE export MLNX_SPC_FW_FILE

View File

@ -7,12 +7,18 @@ PACKAGE_NAME = sx_kernel
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# get sources # get sources
rm -rf sx_kernel-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION)
wget -c $(MLNX_SDK_SOURCE_BASE_URL)/$(PACKAGE_NAME)-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION).tar.gz -O - | tar -xz if [ ! -z "$(MLNX_SDK_SOURCE_BASE_URL)" ]; then
rm -rf sx_kernel-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION)
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
fi
# build # build
pushd sx_kernel-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION)
patch -p1 < ../sx_kernel_makefile_sonic_build.patch patch -p1 < ../sx_kernel_makefile_sonic_build.patch
debuild -e KVERSION=$(KVERSION) -e KSRC_EXT=/lib/modules/$(KVERSION)/source/ -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) debuild -e KVERSION=$(KVERSION) -e KSRC_EXT=/lib/modules/$(KVERSION)/source/ -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS)

@ -0,0 +1 @@
Subproject commit 3acd88b3e04ec09e5fb7e2b74ed94540a9fea21e

View File

@ -1,4 +1,4 @@
MLNX_SDK_BASE_URL = https://github.com/Mellanox/SAI-Implementation/raw/350187a41e408daaf03380401a0a2351b6cb0f9e/sdk MLNX_SDK_BASE_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel/Switch-SDK-drivers/bin/
MLNX_SDK_VERSION = 4.3.2104 MLNX_SDK_VERSION = 4.3.2104
MLNX_SDK_ISSU_VERSION = 101 MLNX_SDK_ISSU_VERSION = 101
@ -135,19 +135,21 @@ $(SX_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel
SX_KERNEL_DEV = sx-kernel-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb SX_KERNEL_DEV = sx-kernel-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(SX_KERNEL),$(SX_KERNEL_DEV))) $(eval $(call add_derived_package,$(SX_KERNEL),$(SX_KERNEL_DEV)))
define make_url define make_path
$(1)_URL = $(MLNX_SDK_BASE_URL)/$(1) $(1)_PATH = $(MLNX_SDK_BASE_PATH)
endef endef
$(eval $(foreach deb,$(MLNX_SDK_DEBS),$(call make_url,$(deb)))) $(eval $(foreach deb,$(MLNX_SDK_DEBS),$(call make_path,$(deb))))
$(eval $(foreach deb,$(MLNX_SDK_RDEBS),$(call make_url,$(deb)))) $(eval $(foreach deb,$(MLNX_SDK_RDEBS),$(call make_path,$(deb))))
$(eval $(foreach deb,$(PYTHON_SDK_API) $(SX_KERNEL) $(SX_KERNEL_DEV),$(call make_url,$(deb)))) $(eval $(foreach deb,$(PYTHON_SDK_API) $(SX_KERNEL) $(SX_KERNEL_DEV),$(call make_path,$(deb))))
SONIC_MAKE_DEBS += $(SX_KERNEL)
ifeq ($(SDK_FROM_SRC), y) ifeq ($(SDK_FROM_SRC), y)
SONIC_MAKE_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API) $(SX_KERNEL) SONIC_MAKE_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API)
else else
SONIC_ONLINE_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API) $(SX_KERNEL) SONIC_COPY_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API)
endif endif
SONIC_STRETCH_DEBS += $(SX_KERNEL) SONIC_STRETCH_DEBS += $(SX_KERNEL)