From f3821c6d2faeceae73ae3ed284e40198365428b0 Mon Sep 17 00:00:00 2001 From: Lior Avramov <73036155+liorghub@users.noreply.github.com> Date: Mon, 28 Nov 2022 13:30:40 +0200 Subject: [PATCH] [Mellanox] Add SDK hash calculator debian and update SDK makefile to compile it (#12840) - Why I did it Add SDK hash calculator Debian and update SDK makefile to compile it. - How I did it SDK hash calculator Debian will be used by ECMP calculator (PR #12482) - How to verify it Compile sonic-buildimage and verify SDK hash calculator Debian exist in target folder. --- .../mellanox/sdk-src/sx-hash-calc/Makefile | 27 +++++++++++++++++++ .../sdk-src/sx-kernel/Switch-SDK-drivers | 2 +- platform/mellanox/sdk.dep | 17 ++++++++++++ platform/mellanox/sdk.mk | 17 +++++++++--- 4 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 platform/mellanox/sdk-src/sx-hash-calc/Makefile diff --git a/platform/mellanox/sdk-src/sx-hash-calc/Makefile b/platform/mellanox/sdk-src/sx-hash-calc/Makefile new file mode 100644 index 0000000000..927d4bc892 --- /dev/null +++ b/platform/mellanox/sdk-src/sx-hash-calc/Makefile @@ -0,0 +1,27 @@ +.ONESHELL: +SHELL = /bin/bash + +MAIN_TARGET = sx-hash-calc_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +DERIVED_TARGETS = sx-hash-calc-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +PACKAGE_NAME = sx_hash_calc + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # get sources + rm -rf $(PACKAGE_NAME)-$(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 + + # build + pushd $(PACKAGE_NAME)-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION) + + if [ -f autogen.sh ]; then + ./autogen.sh + fi + + debuild -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + + popd + + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) diff --git a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers index 438e8b4982..5edd4865cb 160000 --- a/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers +++ b/platform/mellanox/sdk-src/sx-kernel/Switch-SDK-drivers @@ -1 +1 @@ -Subproject commit 438e8b4982eb073e241e802c37013f828a08ff80 +Subproject commit 5edd4865cbf1149430e122bb9a8948ed9f762469 diff --git a/platform/mellanox/sdk.dep b/platform/mellanox/sdk.dep index 08c9f2e7c9..bf4d203eb6 100644 --- a/platform/mellanox/sdk.dep +++ b/platform/mellanox/sdk.dep @@ -216,6 +216,23 @@ $(WJH_LIBS_DBGSYM)_DEP_FLAGS := $(MLNX_SDK_COMMON_FLAGS_LIST) $(WJH_LIBS_DBGSYM)_DEP_FILES := $(DEP_FILES) endif +# SX_HASH_CALC + +SPATH := $($(SX_HASH_CALC)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_PATH)/sdk.mk $(PLATFORM_PATH)/sdk.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files -- $(SPATH)) + +$(SX_HASH_CALC)_CACHE_MODE := GIT_CONTENT_SHA +$(SX_HASH_CALC)_DEP_FLAGS := $(MLNX_SDK_COMMON_FLAGS_LIST) +$(SX_HASH_CALC)_DEP_FILES := $(DEP_FILES) + +ifeq ($(SDK_FROM_SRC),y) +$(SX_HASH_CALC_DBGSYM)_CACHE_MODE := GIT_CONTENT_SHA +$(SX_HASH_CALC_DBGSYM)_DEP_FLAGS := $(MLNX_SDK_COMMON_FLAGS_LIST) +$(SX_HASH_CALC_DBGSYM)_DEP_FILES := $(DEP_FILES) +endif + # SX_KERNEL SPATH := $($(SX_KERNEL)_SRC_PATH) diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 226bae633b..15fe0be670 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -33,16 +33,18 @@ endif export MLNX_SDK_SOURCE_BASE_URL MLNX_SDK_VERSION MLNX_SDK_ISSU_VERSION MLNX_SDK_DEB_VERSION MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_COMPLIB) $(SX_EXAMPLES) \ - $(SX_GEN_UTILS) $(SX_SCEW) $(SXD_LIBS) $(WJH_LIBS) $(SX_ACL_HELPER) + $(SX_GEN_UTILS) $(SX_SCEW) $(SXD_LIBS) $(WJH_LIBS) $(SX_ACL_HELPER) \ + $(SX_HASH_CALC) MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_MLNX_DEV) $(SX_COMPLIB_DEV) \ $(SX_COMPLIB_DEV_STATIC) $(SX_EXAMPLES_DEV) $(SX_GEN_UTILS_DEV) \ $(SX_SCEW_DEV) $(SX_SCEW_DEV_STATIC) $(SXD_LIBS_DEV)\ - $(SXD_LIBS_DEV_STATIC) $(WJH_LIBS_DEV) $(SX_ACL_HELPER_DEV) + $(SXD_LIBS_DEV_STATIC) $(WJH_LIBS_DEV) $(SX_ACL_HELPER_DEV) $(SX_HASH_CALC) MLNX_SDK_DBG_DEBS += $(APPLIBS_DBGSYM) $(IPROUTE2_MLNX_DBGSYM) $(SX_COMPLIB_DBGSYM) \ $(SX_EXAMPLES_DBGSYM) $(SX_GEN_UTILS_DBGSYM) $(SX_SCEW_DBGSYM) \ - $(SXD_LIBS_DBGSYM) $(WJH_LIBS_DBGSYM) $(SX_ACL_HELPER_DBGSYM) + $(SXD_LIBS_DBGSYM) $(WJH_LIBS_DBGSYM) $(SX_ACL_HELPER_DBGSYM) \ + $(SX_HASH_CALC_DBGSYM) APPLIBS = applibs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(APPLIBS)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/applibs @@ -146,6 +148,15 @@ ifeq ($(SDK_FROM_SRC),y) $(eval $(call add_derived_package,$(WJH_LIBS),$(WJH_LIBS_DBGSYM))) endif +SX_HASH_CALC = sx-hash-calc_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +$(SX_HASH_CALC)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-hash-calc +$(SX_HASH_CALC)_DEPENDS += $(SX_COMPLIB_DEV) $(SXD_LIBS_DEV) $(APPLIBS_DEV) $(SX_GEN_UTILS_DEV) +$(SX_HASH_CALC)_RDEPENDS += $(SX_COMPLIB) $(SXD_LIBS) $(APPLIBS) +SX_HASH_CALC_DBGSYM = sx-hash-calc-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +ifeq ($(SDK_FROM_SRC),y) +$(eval $(call add_derived_package,$(SX_HASH_CALC),$(SX_HASH_CALC_DBGSYM))) +endif + SX_KERNEL = sx-kernel_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb $(SX_KERNEL)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(SX_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel