6852fcdc24
#### Why I did it Facilitate Automatic integration of sdk kernel patches into SONiC. **Inputs to the Script:** 1) `MLNX_SDK_VERSION` Eg: `4.5.4206` 2) `MLNX_SDK_ISSU_VERSION` Eg: `101` **Note: If nothing is provided the one already present in the sdk.mk file is used** 3) `MLNX_SDK_SOURCE_BASE_URL:` **Note: If nothing is provided the upstream sdk drivers url is used** 4) `CREATE_BRANCH: (y|n)` Creates a branch instead of a commit (optional, default: n) 5) `BRANCH_SONIC`: Only relevant when CREATE_BRANCH is y. `Default: master`. Note: These should be provided through `SONIC_OVERRIDE_BUILD_VARS ` parameter **Output:** 1) Script creates a commit in sonic-linux-kernel with any updates to sdk-kernel patches in sonic in accordance with the version provided by `MLNX_SDK_VERSION` **Note: Script Doesn't commit anything to linux-kernel when there aren't any changes required..** #### How I did it 1) Added a new make target which can be invoked by calling `make integrate-mlnx-sdk` ``` user@server:/sonic-buildimage/src/sonic-linux-kernel$ git rev-parse --abbrev-ref HEAD master_6f38dca_integrate_4.5.4206 user@server:/sonic-buildimage/src/sonic-linux-kernel$ git log --oneline -n 1 d64d1e7 (HEAD -> master_6f38dca_integrate_4.5.4206) Intgerate MLNX SDK 4.5.4206 Kernel Patches ``` Changes made will be summarized under `sonic-buildimage/integrate-mlnx-sdk_user.out` file. Debugging and troubleshooting output is written to `sonic-buildimage/integrate-mlnx-sdk.log` files [log_files.zip](https://github.com/sonic-net/sonic-buildimage/files/11226441/log_files.zip) #### Limitations: 1) Assumes that the sdk kernel patches are always upstreamed #### How to verify it Build the Kernel and test
38 lines
1.3 KiB
Makefile
38 lines
1.3 KiB
Makefile
.ONESHELL:
|
|
SHELL = /bin/bash
|
|
|
|
MAIN_TARGET = sx-kernel_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb
|
|
DERIVED_TARGETS = sx-kernel-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_$(CONFIGURED_ARCH).deb
|
|
PACKAGE_NAME = sx_kernel
|
|
|
|
MLNX_SX_KERNEL_GITHUB_URL_BASE = $(MLNX_SDK_DRIVERS_GITHUB_URL)/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)
|