1 Star 0 Fork 1

kun-llfl/kmod-intel-QAT20

forked from anolis/kmod-intel-QAT20 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
kmod-intel-QAT20.spec 7.17 KB
一键复制 编辑 原始数据 按行查看 历史
Guixin Liu 提交于 2024-07-08 20:53 . Support yum update
%define anolis_release 1
%define debug_package %{nil}
%define QAT_release 00004
%global pkg intel-QAT20
%global kernel kernel version
%define pkg_version L.0.9.4
Name: kmod-%{pkg}
Version: %(echo %{kernel} | sed -E 's/-/~/g; s/\.(an|al)[0-9]+$//g')
Release: %{pkg_version}__%{QAT_release}~%{anolis_release}%{?dist}
Summary: QAT package(Library and sample application)
Group: QAT/Base
License: BSD and (BSD or GPLv2)
URL: https://www.intel.com/content/www/us/en/download/19081/intel-quickassist-technology-intel-qat-driver-for-linux-for-intel-server-boards-and-systems-based-on-intel-62x-chipset.html
Source: kmod-%{pkg}-%{pkg_version}-%{QAT_release}.tar.gz
Requires: kernel >= %{kernel}
Requires(posttrans): %{_sbindir}/depmod
Requires(postun): %{_sbindir}/depmod
Requires(posttrans): %{_sbindir}/weak-modules
Requires(postun): %{_sbindir}/weak-modules
Requires(posttrans): %{_bindir}/sort
Requires(postun): %{_bindir}/sort
BuildRequires: kernel-devel = %{kernel}
BuildRequires: kernel-headers = %{kernel}
BuildRequires: gcc gcc-c++ make systemd-devel openssl-devel zlib-devel yasm
BuildRequires: libudev-devel >= 1.47
BuildRequires: boost-devel
Provides: kmod-intel-QAT20 = %{version}-%{release}
Obsoletes: kmod-intel-QAT20 < %{version}-%{release}
Obsoletes: kmod-intel-QAT20 < %{version}-%{release}.%{anolis_release}%{?dist}
Provides: kmod-%{pkg}-%{kernel}.%{_arch} = %{version}-%{release}
Obsoletes: kmod-%{pkg}-%{kernel}.%{_arch} < %{version}-%{release}
ExclusiveArch: x86_64
%description
Intel(R) QuickAssist Technology user space library and sample application Linux
version %{version}
%prep
%setup -q -n kmod-%{pkg}-%{pkg_version}-%{QAT_release}
%build
pushd src
unset ICP_ROOT ICP_ARCH_USER ICP_BUILDSYSTEM_PATH ICP_BUILD_OUTPUT ICP_ENV_DIR ICP_TOOLS_TARGET
%configure
%make_build qat-driver-all quickassist-all
popd
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/etc/init.d
mkdir -p %{buildroot}/etc/udev/rules.d
mkdir -p %{buildroot}/%{_libdir}
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}/usr/bin/QAT
mkdir -p %{buildroot}/usr/bin/QAT/build
mkdir -p %{buildroot}/lib/firmware
MODPATH=drivers/crypto/qat
KERNEL_VER=%{kernel}.%{_arch}
SRCMODDIR=${RPM_BUILD_DIR}/kmod-%{pkg}-%{pkg_version}-%{QAT_release}/src/quickassist/qat/${MODPATH}
DSTMODDIR=%{buildroot}/lib/modules/${KERNEL_VER}/extra/${MODPATH}
mkdir -p ${DSTMODDIR}/qat_common/
mkdir -p ${DSTMODDIR}/qat_4xxx/
mkdir -p ${DSTMODDIR}/qat_4xxxvf/
mkdir -p ${DSTMODDIR}/qat_vqat/
/usr/bin/install -D -m 750 ${SRCMODDIR}/qat_common/intel_qat.ko ${DSTMODDIR}/qat_common/
/usr/bin/install -D -m 750 ${SRCMODDIR}/qat_common/qat_vdcm.ko ${DSTMODDIR}/qat_common/
/usr/bin/install -D -m 750 ${SRCMODDIR}/qat_4xxx/qat_4xxx.ko ${DSTMODDIR}/qat_4xxx/qat_4xxx.ko
/usr/bin/install -D -m 750 ${SRCMODDIR}/qat_4xxxvf/qat_4xxxvf.ko ${DSTMODDIR}/qat_4xxxvf/qat_4xxxvf.ko
/usr/bin/install -D -m 750 ${SRCMODDIR}/qat_vqat/qat_vqat.ko ${DSTMODDIR}/qat_vqat/qat_vqat.ko
/usr/bin/install -D -m 750 src/build/usdm_drv.ko %{buildroot}/lib/modules/${KERNEL_VER}/extra/
/usr/bin/install -D -m 750 src/quickassist/qat/fw/qat_4xxx.bin %{buildroot}/lib/firmware/qat_4xxx_oot.bin
/usr/bin/install -D -m 750 src/quickassist/qat/fw/qat_4xxx_mmp.bin %{buildroot}/lib/firmware/qat_4xxx_mmp_oot.bin
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
for kmod in $(find %{buildroot}/lib/modules/%{kernel}.%{_arch}/extra -type f -name \*.ko -printf "%%P\n" | sort)
do
echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
echo "override $(basename $kmod .ko) * extra/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
done
%clean
rm -rf $RPM_BUILD_ROOT
%verifyscript
%files
/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_common/intel_qat.ko
/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_common/qat_vdcm.ko
/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_4xxx/qat_4xxx.ko
/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_4xxxvf/qat_4xxxvf.ko
/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_vqat/qat_vqat.ko
/lib/modules/%{kernel}.%{_arch}/extra/usdm_drv.ko
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
/lib/firmware/qat_4xxx_oot.bin
/lib/firmware/qat_4xxx_mmp_oot.bin
%post
ECHO=/usr/bin/echo
${ECHO} "Creating module.dep file for QAT released kernel object"
${ECHO} "This will take a few moments";
depmod -a
# 将该模块的ko都注册到weak-modules,如果当前环境有安装其他的kABI兼容的内核,那么会在兼容的内核下的weak-updates目录生成软链接。
if [ -x "/usr/sbin/weak-modules" ]; then
printf '%s\n' "/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_common/intel_qat.ko" | /usr/sbin/weak-modules --no-initramfs --add-modules > /dev/null 2>&1
printf '%s\n' "/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_common/qat_vdcm.ko" | /usr/sbin/weak-modules --no-initramfs --add-modules > /dev/null 2>&1
printf '%s\n' "/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_4xxx/qat_4xxx.ko" | /usr/sbin/weak-modules --no-initramfs --add-modules > /dev/null 2>&1
printf '%s\n' "/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_4xxxvf/qat_4xxxvf.ko" | /usr/sbin/weak-modules --no-initramfs --add-modules > /dev/null 2>&1
printf '%s\n' "/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_vqat/qat_vqat.ko" | /usr/sbin/weak-modules --no-initramfs --add-modules > /dev/null 2>&1
printf '%s\n' "/lib/modules/%{kernel}.%{_arch}/extra/usdm_drv.ko" | /usr/sbin/weak-modules --no-initramfs --add-modules > /dev/null 2>&1
fi
%preun
# 这里换成自己的ko路径,目的是将ko路径都保存到一个临时文件里然后在%postun阶段从weak-modules里注销。
echo "/lib/modules/%{kernel}.%{_arch}/extra/usdm_drv.ko" >> /var/run/rpm-%{pkg}-modules.list
echo "/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_common/intel_qat.ko" >> /var/run/rpm-%{pkg}-modules.list
echo "/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_common/qat_vdcm.ko" >> /var/run/rpm-%{pkg}-modules.list
echo "/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_4xxx/qat_4xxx.ko" >> /var/run/rpm-%{pkg}-modules.list
echo "/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_4xxxvf/qat_4xxxvf.ko" >> /var/run/rpm-%{pkg}-modules.list
echo "/lib/modules/%{kernel}.%{_arch}/extra/drivers/crypto/qat/qat_vqat/qat_vqat.ko" >> /var/run/rpm-%{pkg}-modules.list
%postun
depmod -a
# 将模块的ko从weak-modules里注销,这里的rpm-%{pkg}-modules.list是在%preun阶段生成的。
if [ -x "/usr/sbin/weak-modules" ]; then
modules=( $(cat /var/run/rpm-%{pkg}-modules.list) )
printf '%s\n' "${modules[@]}" | /usr/sbin/weak-modules --no-initramfs --remove-modules > /dev/null 2>&1
fi
rm /var/run/rpm-%{pkg}-modules.list
%changelog
* Thu Dec 21 2023 Xingrui Yi <yixingrui@linux.alibaba.com> - 0.9.4-00004.3
- Remove dracut
* Thu Dec 14 2023 Xingrui Yi <yixingrui@linux.alibaba.com> - 0.9.4-00004.2
- Change qat_4xxx fw patch
* Mon Nov 13 2023 Xingrui Yi <yixingrui@linux.alibaba.com> - 0.9.4-00004.1
- Change spec for oot weak module
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kun-llfl/kmod-intel-QAT20.git
git@gitee.com:kun-llfl/kmod-intel-QAT20.git
kun-llfl
kmod-intel-QAT20
kmod-intel-QAT20
devel-5.10-L.0.9.4-00004

搜索帮助