!11 Add net and rdma code

From: @hcf85679 
Reviewed-by: @king7290 
Signed-off-by: @king7290
This commit is contained in:
openeuler-ci-bot 2024-11-29 08:44:37 +00:00 committed by Gitee
commit 8681dc1d98
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 42 additions and 10 deletions

View File

@ -1,6 +1,6 @@
%global pkg dinghai
%define pkg_version 2.24.20.02
%define release 1
%define pkg_version 2.24.30.01
%define release 3
%global debug_package %{nil}
@ -9,7 +9,7 @@ Version: %{pkg_version}
Release: %{release}%{?dist}
Summary: ZTE SmartNIC and DPU driver
License: GPLv2
URL: https://gitee.com/anolis/kmod-dinghai
URL: https://gitee.com/src-openeuler/kmod-dinghai
Source0: kmod-%{pkg}.tar.gz
Epoch: 1
@ -42,16 +42,30 @@ RPM Package for ZXDH Driver
%setup -q -n kmod-%{pkg}
%build
cat /usr/include/linux/version.h
echo "kernel_version:%{kernel_version}"
pushd crypto/zsda
%{__make} %{?_smp_mflags} -C %{kernel_source} M=$PWD modules CONFIG_ACC_ZSDA_COMMON=m CONFIG_ACC_ZSDA_PF=m CONFIG_ACC_ZSDA_VF=m
popd
pushd net/build
./builder.sh -t clean --ksrc %{kernel_source}
./builder.sh -t kernel -m CONFIG_DINGHAI_ETH -m CONFIG_ZXDH_AUXILIARY -m CONFIG_DINGHAI_PF -m CONFIG_ZXDH_SF -m CONFIG_DINGHAI_EN_AUX -m HAVE_DEV_PM_DOMAIN_ATTACH -m HAVE_BUS_FIND_DEVICE_GET_CONST -m CONFIG_DINGHAI_DH_CMD -m CONFIG_DINGHAI_NP -m CONFIG_ZXDH_MSGQ -m CONFIG_ZXDH_HARDWARE_BOND -m CONFIG_DINGHAI_PTP -m CONFIG_DINGHAI_TSN -m HAVE_DEVLINK_ALLOC_GET_1_PARAMS --ksrc %{kernel_source} -j 7
popd
pushd rdma
./build.sh --ksrc %{kernel_source} --use_rel_net_path
popd
%install
mkdir -p %{buildroot}/lib/modules/%{kernel_version}/extra/drivers/dinghai/crypto/zsda/
for ko in $(find crypto/zsda/accdevice/ -name '*.ko'); do
mkdir -p %{buildroot}/lib/modules/%{kernel_version}/extra/dinghai/crypto/
mkdir -p %{buildroot}/lib/modules/%{kernel_version}/extra/dinghai/net/
mkdir -p %{buildroot}/lib/modules/%{kernel_version}/extra/dinghai/rdma
for ko in $(find crypto/zsda/accdevice/ net/drivers/ rdma/ -name '*.ko'); do
if [[ $ko == crypto/zsda/accdevice/* ]]; then
target_dir=%{buildroot}/lib/modules/%{kernel_version}/extra/drivers/dinghai/crypto/zsda/
target_dir=%{buildroot}/lib/modules/%{kernel_version}/extra/dinghai/crypto/
elif [[ $ko == net/drivers/* ]]; then
target_dir=%{buildroot}/lib/modules/%{kernel_version}/extra/dinghai/net/
elif [[ $ko == rdma/* ]]; then
target_dir=%{buildroot}/lib/modules/%{kernel_version}/extra/dinghai/rdma/
fi
%{__install} -D -t $target_dir $ko
done
@ -70,18 +84,24 @@ do
echo "override $(basename $kmod .ko) * extra/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
done
# Add zxdh_en_aux udev conf
%{__install} -d %{buildroot}%{_sysconfdir}/udev/rules.d/
echo 'ACTION!="add", GOTO="drivers_end"' > %{buildroot}%{_sysconfdir}/udev/rules.d/80-%{name}-zxdh_en_aux-drivers.rules
echo 'ENV{MODALIAS}=="zxdh_auxiliary:zxdh_pf.en_aux", RUN{builtin}+="kmod load zxdh_en_aux"' >> %{buildroot}%{_sysconfdir}/udev/rules.d/80-%{name}-zxdh_en_aux-drivers.rules
echo 'LABEL="drivers_end"' >> %{buildroot}%{_sysconfdir}/udev/rules.d/80-%{name}-zxdh_en_aux-drivers.rules
%clean
%{__rm} -rf %{buildroot}
%post
depmod -a > /dev/null 2>&1
%preun
list_file="/var/run/rpm-%{pkg}-modules.list"
mkdir -p /var/run
for ko in $(find %{buildroot}/lib/modules/%{kernel_version}/extra/drivers/dinghai/crypto/zsda/ -name '*.ko'); do
echo "${ko#%{buildroot}}" >> $list_file
for ko in $(find /lib/modules/%{kernel_version}/extra/dinghai/ -name '*.ko'); do
echo "${ko}" >> $list_file
done
%postun
@ -97,9 +117,21 @@ rm /var/run/rpm-%{pkg}-modules.list
%defattr(644,root,root,755)
/lib/modules/%{kernel_version}
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
%{_sysconfdir}/udev/rules.d/80-%{name}-zxdh_en_aux-drivers.rules
%changelog
* Fri Nov 29 2024 hcf <han.chengfei@zte.com.cn> - 1:2.24.30.01-3
- rename compile shell
* Fri Nov 29 2024 hcf <han.chengfei@zte.com.cn> - 1:2.24.30.01-2
- rename compile shell
* Fri Nov 29 2024 hcf <han.chengfei@zte.com.cn> - 1:2.24.30.01-1
- update pkg_version
* Mon Oct 28 2024 hcf <han.chengfei@zte.com.cn> - 1:2.24.20.03-1
- Add net and rdma ko
* Wed Aug 28 2024 hcf <han.chengfei@zte.com.cn> - 1:2.24.20.02-1
- Dinghai driver init

Binary file not shown.