sonic-buildimage/platform/mellanox/sdk-src/sx-kernel/Makefile
Yakiv Huryk 1098f6ed4c
[Mellanox] update sdk/fw build procedure (#14104)
* sdk debs are now downloaded as Spectrum-SDK-Drivers-SONiC-Bins release
* sx kernel is downloaded as zip from Spectrum-SDK-Drivers

Signed-off-by: Yakiv Huryk <yhuryk@nvidia.com>
2023-03-06 10:33:06 -08:00

38 lines
1.2 KiB
Makefile

.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
MLNX_SX_KERNEL_GITHUB_URL_BASE = https://github.com/Mellanox/Spectrum-SDK-Drivers/archive/refs/heads
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# get sources
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
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
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)