drivers,thirdparty: keep copy other thirdparty drivers if with_ofed is 0

If with_ofed is 0, only mlnx driver using kernel native driver. Other
drivers in drivers/thirdparty are commercial quality drivers, they should
be copied to override kernel native drivers before build.

In drivers/thirdparty/copy-drivers.sh, kernel native bnxt directory
is wrong. Fix it by the way.

Signed-off-by: Jianping Liu <frankjpliu@tencent.com>
Reviewed-by: Yongliang Gao <leonylgao@tencent.com>
This commit is contained in:
Jianping Liu 2024-08-28 20:21:14 +08:00
parent c92c287ac7
commit 7a56ca3fca
3 changed files with 24 additions and 21 deletions

View File

@ -10,24 +10,27 @@ check_url_reachable()
}
thirdparty_mlnx(){
# This script may run at dist/sources/ directory or drivers/thirdparty/ directory.
# "make dist-srpm" will run dist-drivers in dist/Makefile, which will cd to dist/sources/ dir
# to run download-and-copy-drivers.sh.
# "make dist-rpm" will run BuildConfig in dist/templates/kernel.template.spec, which will cd
# to drivers/thirdparty/ dir to run download-and-copy-drivers.sh.
mlnx_tgz_url=$(../../drivers/thirdparty/release-drivers/mlnx/get_mlnx_info.sh mlnx_url)
mlnx_tgz_name=$(../../drivers/thirdparty/release-drivers/mlnx/get_mlnx_info.sh mlnx_tgz_name)
mlnx_tgz_sha256=$(../../drivers/thirdparty/release-drivers/mlnx/get_mlnx_info.sh mlnx_tgz_sha256)
get_mlnx_tgz_ok=1
if [ $(stat -c%s ${mlnx_tgz_name}) -gt 1024 ]; then return 0; fi
mv ${mlnx_tgz_name} ${mlnx_tgz_name}_ori
rm -f ${mlnx_tgz_name}
timeout 900 wget -q $mlnx_tgz_url || get_mlnx_tgz_ok=0
sha256_tmp=$(sha256sum ${mlnx_tgz_name} | awk '{printf $1}')
if [[ $sha256_tmp != $mlnx_tgz_sha256 ]]; then get_mlnx_tgz_ok=0; fi
if (( $get_mlnx_tgz_ok == 0 )); then
mv -f ${mlnx_tgz_name}_ori ${mlnx_tgz_name}
echo "Download MLNX_OFED_LINUX-*.tgz fail!"
exit 1
else
rm -f ${mlnx_tgz_name}_ori
fi
}

View File

@ -632,16 +632,21 @@ case $KernUnameR in
# Prepare Kernel config
BuildConfig() {
# Copy mlnx drivers to drivers/thirdparty/release-drivers/mlnx/ dir
pushd ${_KernSrc}/drivers/thirdparty
%if %{with_ofed}
pushd ${_KernSrc}/drivers/thirdparty
rm -f download-and-copy-drivers.sh; cp -a %{SOURCE3000} ./
if [ -e ../../dist/sources ]; then
./copy-drivers.sh
else
## Real MLNX_OFED_LINUX-*.tgz will more than 1024 bytes.
## Dummy MLNX_OFED_LINUX-*.tgz will less than 1024 bytes.
if [ $(stat -c%s %{SOURCE3001}) -gt 1024 ]; then
cp -a %{SOURCE3001} release-drivers/mlnx/
./copy-drivers.sh without_mlnx
else
./copy-drivers.sh
fi
popd
%else
./copy-drivers.sh without_mlnx
%endif
popd
mkdir -p $_KernBuild
pushd $_KernBuild

View File

@ -1,24 +1,17 @@
#!/bin/bash
thirdparty_prepare_source_code(){
thirdparty_mlnx(){
mlnx_tgz_name=$(release-drivers/mlnx/get_mlnx_info.sh mlnx_tgz_name)
if [ ! -e release-drivers/mlnx/${mlnx_tgz_name} ] ; then
## This script will only be called when existing ../../dist/sources dir
if [ $(stat -c%s ../../dist/sources/${mlnx_tgz_name}) -lt 1024 ]; then
## Real MLNX_OFED_LINUX-*.tgz will more than 1024 bytes.
## Real MLNX_OFED_LINUX-*.tgz will more than 1024 bytes.
pushd ../../dist/sources
./download-and-copy-drivers.sh
popd
fi
cp -a ../../dist/sources/${mlnx_tgz_name} release-drivers/mlnx/
./download-and-copy-drivers.sh
mv ${mlnx_tgz_name} release-drivers/mlnx/
fi
}
thirdparty_bnxt(){
if [ -e release-drivers/bnxt ]; then
rm -rf ../../drivers/net/thirdparty_bnxtethernet/broadcom/bnxt
rm -rf ../../drivers/net/ethernet/broadcom/bnxt
cp -a release-drivers/bnxt ../../drivers/net/ethernet/broadcom/
## Use sed to replace "&& BNXT" with "&& BNXT && !THIRDPARTY_BNXT" in
@ -32,6 +25,8 @@ thirdparty_bnxt(){
##
## main , script start run at here.
##
thirdparty_prepare_source_code
if [[ $1 != without_mlnx ]]; then
thirdparty_mlnx
fi
thirdparty_bnxt