Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mellanox] add makefiles to build Mellanox SDK from sources #2701

Merged
merged 6 commits into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,31 @@ target/
*.buildinfo

# Subdirectories in src
src/bash/*
!src/bash/Makefile
src/ixgbe/*
!src/ixgbe/Makefile
src/isc-dhcp/*
!src/isc-dhcp/Makefile
!src/isc-dhcp/patch
src/socat/*
!src/socat/Makefile
!src/socat/*.patch
src/tacacs/*
src/tacacs/nsm/*
src/tacacs/pam/*
!src/tacacs/nsm/Makefile
!src/tacacs/nsm/*.patch
!src/tacacs/pam/Makefile
!src/tacacs/pam/*.patch
src/hiredis/*
!src/hiredis/Makefile
src/igb/*
!src/igb/Makefile
src/initramfs-tools/*
!src/initramfs-tools/Makefile
src/iproute2/*
!src/iproute2/Makefile
src/isc-dhcp/*
!src/isc-dhcp/Makefile
!src/isc-dhcp/patch/
Expand Down Expand Up @@ -84,3 +103,6 @@ installer/x86_64/platforms/
src/sonic-config-engine/**/*.pyc
src/sonic-config-engine/build
src/sonic-config-engine/sonic_config_engine.egg-info
src/sonic-daemon-base/**/*.pyc
src/sonic-daemon-base/build
src/sonic-daemon-base/sonic_daemon_base.egg-info
3 changes: 2 additions & 1 deletion Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ SONIC_BUILD_INSTRUCTION := make \
KERNEL_PROCURE_METHOD=$(KERNEL_PROCURE_METHOD) \
HTTP_PROXY=$(http_proxy) \
HTTPS_PROXY=$(https_proxy) \
SONIC_ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY)
SONIC_ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY) \
$(SONIC_OVERRIDE_BUILD_VARS)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added SONIC_OVERRIDE_BUILD_VARS to have ability to pass variables to slave makefile, specifically to pass MLNX_SDK_SOURCE_BASE_URL in build time this way, instead of introducing vendor build parameters in root makefile

usage:

make SONIC_BUILD_JOBS=12 SONIC_OVERRIDE_BUILD_VARS="MLNX_SDK_SOURCE_BASE_URL=http://arc-build-server/stepanb/sx_sdk_eth/sx_sdk_eth-4.3.0136/SOURCES MLNX_SDK_VERSION=4.3.0136" target/sonic-mellanox.bin


.PHONY: sonic-slave-build sonic-slave-bash init reset

Expand Down
10 changes: 10 additions & 0 deletions platform/mellanox/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ hw-management/*
!hw-management/*.patch
mft/*
!mft/Makefile
sdk-src/*/*
!sdk-src/*/Makefile
!sdk-src/*/*.patch
*/build
*/deb_dist
*/dist
*/*.gz
*/*.egg-info

# Autogenerated Dockerfiles
docker-syncd-mlnx/Dockerfile
docker-syncd-mlnx-rpc/Dockerfile
docker-saiserver-mlnx/Dockerfile
4 changes: 3 additions & 1 deletion platform/mellanox/fw.mk
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# mellanox firmware

MLNX_FW_BASE_URL = $(MLNX_SDK_BASE_URL)

MLNX_SPC_FW_VERSION = 13.1910.0920
MLNX_SPC_FW_FILE = fw-SPC-rel-$(subst .,_,$(MLNX_SPC_FW_VERSION))-EVB.mfa
$(MLNX_SPC_FW_FILE)_URL = $(MLNX_SDK_BASE_URL)/$(MLNX_SPC_FW_FILE)
SONIC_ONLINE_FILES += $(MLNX_SPC_FW_FILE)

MLNX_SPC2_FW_VERSION = 29.1961.0006
MLNX_SPC2_FW_FILE = fw-SPC2-rel-$(subst .,_,$(MLNX_SPC2_FW_VERSION))-EVB.mfa
$(MLNX_SPC2_FW_FILE)_URL = $(MLNX_SDK_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)

export MLNX_SPC_FW_VERSION
Expand Down
3 changes: 2 additions & 1 deletion platform/mellanox/mlnx-sai.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Mellanox SAI

MLNX_SAI_REPO = https://github.com/Mellanox/SAI-Implementation.git
MLNX_SAI_VERSION = SAIRel1.13.7-master
MLNX_SAI_REVISION = 52dbd2f5e51cdb538b05f6c2f387b0fccbff9a8e

export MLNX_SAI_VERSION MLNX_SAI_REVISION
export MLNX_SAI_REPO MLNX_SAI_VERSION MLNX_SAI_REVISION

MLNX_SAI = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb
$(MLNX_SAI)_SRC_PATH = $(PLATFORM_PATH)/mlnx-sai
Expand Down
2 changes: 1 addition & 1 deletion platform/mellanox/mlnx-sai/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MAIN_TARGET = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# get sources
rm -rf SAI-Implementation
git clone https://github.com/Mellanox/SAI-Implementation.git
git clone $(MLNX_SAI_REPO) SAI-Implementation

# build
pushd SAI-Implementation
Expand Down
30 changes: 30 additions & 0 deletions platform/mellanox/sdk-src/applibs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.ONESHELL:
SHELL = /bin/bash

MAIN_TARGET = applibs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
DERIVED_TARGETS = applibs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
PACKAGE_NAME = applibs

$(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)

sed -i "s/sx-libnl/$(LIBNL3)/g" ./debian/control
sed -i "s/-Werror//g" ./configure.in

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)
27 changes: 27 additions & 0 deletions platform/mellanox/sdk-src/iproute2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.ONESHELL:
SHELL = /bin/bash

MAIN_TARGET = iproute2_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
DERIVED_TARGETS = iproute2-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
PACKAGE_NAME = iproute2-3.19.0

$(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)
27 changes: 27 additions & 0 deletions platform/mellanox/sdk-src/python-sdk-api/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.ONESHELL:
SHELL = /bin/bash

MAIN_TARGET = python-sdk-api_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
DERIVED_TARGETS =
PACKAGE_NAME = python_sdk_api

$(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)
28 changes: 28 additions & 0 deletions platform/mellanox/sdk-src/sx-complib/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.ONESHELL:
SHELL = /bin/bash

MAIN_TARGET = sx-complib_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
DERIVED_TARGETS = sx-complib-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \
sx-complib-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
PACKAGE_NAME = sx_complib

$(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)
27 changes: 27 additions & 0 deletions platform/mellanox/sdk-src/sx-examples/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.ONESHELL:
SHELL = /bin/bash

MAIN_TARGET = sx-examples_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
DERIVED_TARGETS = sx-examples-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
PACKAGE_NAME = sx_examples

$(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)
27 changes: 27 additions & 0 deletions platform/mellanox/sdk-src/sx-gen-utils/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.ONESHELL:
SHELL = /bin/bash

MAIN_TARGET = sx-gen-utils_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
DERIVED_TARGETS = sx-gen-utils-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
PACKAGE_NAME = sx_gen_utils

$(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)
24 changes: 24 additions & 0 deletions platform/mellanox/sdk-src/sx-kernel/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.ONESHELL:
SHELL = /bin/bash

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

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# 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

# build
pushd sx_kernel-$(MLNX_SDK_VERSION)-$(MLNX_SDK_ISSU_VERSION)
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)

popd

mv $(DERIVED_TARGETS) $* $(DEST)/

$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/makefile b/makefile
index f23f0ac..a16b2ce 100644
--- a/makefile
+++ b/makefile
@@ -93,10 +93,10 @@ V ?= 1

ifneq ($(findstring 3.10,$(KVERSION))$(findstring 3.13,$(KVERSION))$(findstring 3.14,$(KVERSION))$(findstring 3.16,$(KVERSION)),)
MLNX_LINUX_AUTOCONF_FILE = include/generated/autoconf.h
-MLNX_LINUX_EXTRA_INCLUDE_FILES = -include include/linux/kconfig.h
+MLNX_LINUX_EXTRA_INCLUDE_FILES = -include $(KSRC_EXT)/include/linux/kconfig.h
MLNX_LINUX_EXTRA_INCLUDE_FOLDERS = \
- -Iarch/$$(SRCARCH)/include/uapi \
- -Iinclude/uapi \
+ -I$(KSRC_EXT)/arch/$$(SRCARCH)/include/uapi \
+ -I$(KSRC_EXT)/include/uapi \
-Iarch/$$(SRCARCH)/include/generated/uapi \
-Iarch/$$(SRCARCH)/include/generated \
-Iinclude/generated/uapi
28 changes: 28 additions & 0 deletions platform/mellanox/sdk-src/sx-scew/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.ONESHELL:
SHELL = /bin/bash

MAIN_TARGET = sx-scew_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
DERIVED_TARGETS = sx-scew-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \
sx-scew-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
PACKAGE_NAME = sx_scew

$(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)
28 changes: 28 additions & 0 deletions platform/mellanox/sdk-src/sxd-libs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.ONESHELL:
SHELL = /bin/bash

MAIN_TARGET = sxd-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
DERIVED_TARGETS = sxd-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \
sxd-libs-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb
PACKAGE_NAME = sxd_libs

$(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)
Loading