|
|
2c76fd |
%define kmod_name i40e
|
|
|
2c76fd |
%define kmod_vendor redhat
|
|
|
2c76fd |
%define kmod_driver_version 2.8.10_k_dup7.7
|
|
|
2c76fd |
%define kmod_driver_epoch %{nil}
|
|
|
2c76fd |
%define kmod_rpm_release 2
|
|
|
2c76fd |
%define kmod_kernel_version 3.10.0-1062.el7
|
|
|
2c76fd |
%define kmod_kernel_version_min %{nil}
|
|
|
2c76fd |
%define kmod_kernel_version_dep %{nil}
|
|
|
2c76fd |
%define kmod_kbuild_dir drivers/net/ethernet/intel/i40e
|
|
|
2c76fd |
%define kmod_dependencies %{nil}
|
|
|
2c76fd |
%define kmod_dist_build_deps %{nil}
|
|
|
2c76fd |
%define kmod_build_dependencies %{nil}
|
|
|
2c76fd |
%define kmod_devel_package 1
|
|
|
2c76fd |
%define kmod_install_path extra/kmod-redhat-i40e
|
|
|
2c76fd |
%define kernel_pkg kernel
|
|
|
2c76fd |
%define kernel_devel_pkg kernel-devel
|
|
|
2c76fd |
%define kernel_modules_pkg kernel-modules
|
|
|
2c76fd |
|
|
|
2c76fd |
%{!?dist: %define dist .el7_7}
|
|
|
2c76fd |
%{!?make_build: %define make_build make}
|
|
|
2c76fd |
|
|
|
2c76fd |
%if "%{kmod_kernel_version_dep}" == ""
|
|
|
2c76fd |
%define kmod_kernel_version_dep %{kmod_kernel_version}
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
|
|
|
2c76fd |
%if "%{kmod_dist_build_deps}" == ""
|
|
|
2c76fd |
%if (0%{?rhel} > 7) || (0%{?centos} > 7)
|
|
|
2c76fd |
%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists elfutils-libelf-devel kernel-rpm-macros kmod
|
|
|
2c76fd |
%else
|
|
|
2c76fd |
%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
|
|
|
2c76fd |
Source0: %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version}.tar.bz2
|
|
|
2c76fd |
# Source code patches
|
|
|
2c76fd |
Patch0: 0000-netdrv-i40e-Add-support-for-X710-device.patch
|
|
|
2c76fd |
Patch1: 0001-netdrv-i40e-enable-X710-support.patch
|
|
|
2c76fd |
Patch2: 9000-bump-version.patch
|
|
|
2c76fd |
Patch3: 9001-add-I40E_DEV_ID_10G_BASE_T_BC-devid.patch
|
|
|
2c76fd |
|
|
|
2c76fd |
%define findpat %( echo "%""P" )
|
|
|
2c76fd |
%define __find_requires /usr/lib/rpm/redhat/find-requires.ksyms
|
|
|
2c76fd |
%define __find_provides /usr/lib/rpm/redhat/find-provides.ksyms %{kmod_name} %{?epoch:%{epoch}:}%{version}-%{release}
|
|
|
2c76fd |
%define sbindir %( if [ -d "/sbin" -a \! -h "/sbin" ]; then echo "/sbin"; else echo %{_sbindir}; fi )
|
|
|
2c76fd |
%define dup_state_dir %{_localstatedir}/lib/rpm-state/kmod-dups
|
|
|
2c76fd |
%define kver_state_dir %{dup_state_dir}/kver
|
|
|
2c76fd |
%define kver_state_file %{kver_state_dir}/%{kmod_kernel_version}.%(arch)
|
|
|
2c76fd |
%define dup_module_list %{dup_state_dir}/rpm-kmod-%{kmod_name}-modules
|
|
|
2c76fd |
|
|
|
2c76fd |
Name: kmod-redhat-i40e
|
|
|
2c76fd |
Version: %{kmod_driver_version}
|
|
|
2c76fd |
Release: %{kmod_rpm_release}%{?dist}
|
|
|
2c76fd |
%if "%{kmod_driver_epoch}" != ""
|
|
|
2c76fd |
Epoch: %{kmod_driver_epoch}
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
Summary: i40e kernel module for Driver Update Program
|
|
|
2c76fd |
Group: System/Kernel
|
|
|
2c76fd |
License: GPLv2
|
|
|
2c76fd |
URL: https://www.kernel.org/
|
|
|
2c76fd |
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
|
|
2c76fd |
BuildRequires: %kernel_devel_pkg = %kmod_kernel_version
|
|
|
2c76fd |
%if "%{kmod_dist_build_deps}" != ""
|
|
|
2c76fd |
BuildRequires: %{kmod_dist_build_deps}
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
ExclusiveArch: x86_64
|
|
|
2c76fd |
%global kernel_source() /usr/src/kernels/%{kmod_kernel_version}.$(arch)
|
|
|
2c76fd |
|
|
|
2c76fd |
%global _use_internal_dependency_generator 0
|
|
|
2c76fd |
%if "%{?kmod_kernel_version_min}" != ""
|
|
|
2c76fd |
Provides: %kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu}
|
|
|
2c76fd |
%else
|
|
|
2c76fd |
Provides: %kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu}
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
Provides: kmod-%{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
|
|
|
2c76fd |
Requires(post): %{sbindir}/weak-modules
|
|
|
2c76fd |
Requires(postun): %{sbindir}/weak-modules
|
|
|
2c76fd |
Requires: kernel >= 3.10.0-1062.el7
|
|
|
2c76fd |
|
|
|
2c76fd |
Requires: kernel < 3.10.0-1063.el7
|
|
|
2c76fd |
%if 0
|
|
|
2c76fd |
Requires: firmware(%{kmod_name}) = ENTER_FIRMWARE_VERSION
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
%if "%{kmod_build_dependencies}" != ""
|
|
|
2c76fd |
BuildRequires: %{kmod_build_dependencies}
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
%if "%{kmod_dependencies}" != ""
|
|
|
2c76fd |
Requires: %{kmod_dependencies}
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
# if there are multiple kmods for the same driver from different vendors,
|
|
|
2c76fd |
# they should conflict with each other.
|
|
|
2c76fd |
Conflicts: kmod-%{kmod_name}
|
|
|
2c76fd |
|
|
|
2c76fd |
%description
|
|
|
2c76fd |
i40e kernel module for Driver Update Program
|
|
|
2c76fd |
|
|
|
2c76fd |
%if 0
|
|
|
2c76fd |
|
|
|
2c76fd |
%package -n kmod-redhat-i40e-firmware
|
|
|
2c76fd |
Version: ENTER_FIRMWARE_VERSION
|
|
|
2c76fd |
Summary: i40e firmware for Driver Update Program
|
|
|
2c76fd |
Provides: firmware(%{kmod_name}) = ENTER_FIRMWARE_VERSION
|
|
|
2c76fd |
%if "%{kmod_kernel_version_min}" != ""
|
|
|
2c76fd |
Provides: %kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu}
|
|
|
2c76fd |
%else
|
|
|
2c76fd |
Provides: %kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu}
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
%description -n kmod-redhat-i40e-firmware
|
|
|
2c76fd |
i40e firmware for Driver Update Program
|
|
|
2c76fd |
|
|
|
2c76fd |
|
|
|
2c76fd |
%files -n kmod-redhat-i40e-firmware
|
|
|
2c76fd |
%defattr(644,root,root,755)
|
|
|
2c76fd |
%{FIRMWARE_FILES}
|
|
|
2c76fd |
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
|
|
|
2c76fd |
# Development package
|
|
|
2c76fd |
%if 0%{kmod_devel_package}
|
|
|
2c76fd |
%package -n kmod-redhat-i40e-devel
|
|
|
2c76fd |
Version: %{kmod_driver_version}
|
|
|
2c76fd |
Requires: kernel >= 3.10.0-1062.el7
|
|
|
2c76fd |
|
|
|
2c76fd |
Requires: kernel < 3.10.0-1063.el7
|
|
|
2c76fd |
Summary: i40e development files for Driver Update Program
|
|
|
2c76fd |
|
|
|
2c76fd |
%description -n kmod-redhat-i40e-devel
|
|
|
2c76fd |
i40e development files for Driver Update Program
|
|
|
2c76fd |
|
|
|
2c76fd |
|
|
|
2c76fd |
%files -n kmod-redhat-i40e-devel
|
|
|
2c76fd |
%defattr(644,root,root,755)
|
|
|
2c76fd |
/usr/share/kmod-%{kmod_vendor}-%{kmod_name}/Module.symvers
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
|
|
|
2c76fd |
%post
|
|
|
2c76fd |
modules=( $(find /lib/modules/%{kmod_kernel_version}.%(arch)/%{kmod_install_path} | grep '\.ko$') )
|
|
|
2c76fd |
printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --add-modules --no-initramfs
|
|
|
2c76fd |
|
|
|
2c76fd |
mkdir -p "%{kver_state_dir}"
|
|
|
2c76fd |
touch "%{kver_state_file}"
|
|
|
2c76fd |
|
|
|
2c76fd |
exit 0
|
|
|
2c76fd |
|
|
|
2c76fd |
%posttrans
|
|
|
2c76fd |
# We have to re-implement part of weak-modules here because it doesn't allow
|
|
|
2c76fd |
# calling initramfs regeneration separately
|
|
|
2c76fd |
if [ -f "%{kver_state_file}" ]; then
|
|
|
2c76fd |
kver_base="%{kmod_kernel_version_dep}"
|
|
|
2c76fd |
kvers=$(ls -d "/lib/modules/${kver_base%%.*}"*)
|
|
|
2c76fd |
|
|
|
2c76fd |
for k_dir in $kvers; do
|
|
|
2c76fd |
k="${k_dir#/lib/modules/}"
|
|
|
2c76fd |
|
|
|
2c76fd |
tmp_initramfs="/boot/initramfs-$k.tmp"
|
|
|
2c76fd |
dst_initramfs="/boot/initramfs-$k.img"
|
|
|
2c76fd |
|
|
|
2c76fd |
# The same check as in weak-modules: we assume that the kernel present
|
|
|
2c76fd |
# if the symvers file exists.
|
|
|
2c76fd |
if [ -e "/boot/symvers-$k.gz" ]; then
|
|
|
2c76fd |
/usr/bin/dracut -f "$tmp_initramfs" "$k" || exit 1
|
|
|
2c76fd |
cmp -s "$tmp_initramfs" "$dst_initramfs"
|
|
|
2c76fd |
if [ "$?" = 1 ]; then
|
|
|
2c76fd |
mv "$tmp_initramfs" "$dst_initramfs"
|
|
|
2c76fd |
else
|
|
|
2c76fd |
rm -f "$tmp_initramfs"
|
|
|
2c76fd |
fi
|
|
|
2c76fd |
fi
|
|
|
2c76fd |
done
|
|
|
2c76fd |
|
|
|
2c76fd |
rm -f "%{kver_state_file}"
|
|
|
2c76fd |
rmdir "%{kver_state_dir}" 2> /dev/null
|
|
|
2c76fd |
fi
|
|
|
2c76fd |
|
|
|
2c76fd |
rmdir "%{dup_state_dir}" 2> /dev/null
|
|
|
2c76fd |
|
|
|
2c76fd |
exit 0
|
|
|
2c76fd |
|
|
|
2c76fd |
%preun
|
|
|
2c76fd |
if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then
|
|
|
2c76fd |
mkdir -p "%{kver_state_dir}"
|
|
|
2c76fd |
touch "%{kver_state_file}"
|
|
|
2c76fd |
fi
|
|
|
2c76fd |
|
|
|
2c76fd |
mkdir -p "%{dup_state_dir}"
|
|
|
2c76fd |
rpm -ql kmod-redhat-i40e-%{kmod_driver_version}-%{kmod_rpm_release}%{?dist}.$(arch) | \
|
|
|
2c76fd |
grep '\.ko$' > "%{dup_module_list}"
|
|
|
2c76fd |
|
|
|
2c76fd |
%postun
|
|
|
2c76fd |
if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then
|
|
|
2c76fd |
initramfs_opt="--no-initramfs"
|
|
|
2c76fd |
else
|
|
|
2c76fd |
initramfs_opt=""
|
|
|
2c76fd |
fi
|
|
|
2c76fd |
|
|
|
2c76fd |
modules=( $(cat "%{dup_module_list}") )
|
|
|
2c76fd |
rm -f "%{dup_module_list}"
|
|
|
2c76fd |
printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --remove-modules $initramfs_opt
|
|
|
2c76fd |
|
|
|
2c76fd |
rmdir "%{dup_state_dir}" 2> /dev/null
|
|
|
2c76fd |
|
|
|
2c76fd |
exit 0
|
|
|
2c76fd |
|
|
|
2c76fd |
%files
|
|
|
2c76fd |
%defattr(644,root,root,755)
|
|
|
2c76fd |
/lib/modules/%{kmod_kernel_version}.%(arch)
|
|
|
2c76fd |
/etc/depmod.d/%{kmod_name}.conf
|
|
|
2c76fd |
/usr/share/doc/kmod-%{kmod_name}/greylist.txt
|
|
|
2c76fd |
|
|
|
2c76fd |
%prep
|
|
|
2c76fd |
%setup -n %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version}
|
|
|
2c76fd |
|
|
|
2c76fd |
%patch0 -p1
|
|
|
2c76fd |
%patch1 -p1
|
|
|
2c76fd |
%patch2 -p1
|
|
|
2c76fd |
%patch3 -p1
|
|
|
2c76fd |
set -- *
|
|
|
2c76fd |
mkdir source
|
|
|
2c76fd |
mv "$@" source/
|
|
|
2c76fd |
mkdir obj
|
|
|
2c76fd |
|
|
|
2c76fd |
%build
|
|
|
2c76fd |
rm -rf obj
|
|
|
2c76fd |
cp -r source obj
|
|
|
2c76fd |
|
|
|
2c76fd |
PWD_PATH="$PWD"
|
|
|
2c76fd |
%if "%{workaround_no_pwd_rel_path}" != "1"
|
|
|
2c76fd |
PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD")
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
%{make_build} -C %{kernel_source} V=1 M="$PWD_PATH/obj/%{kmod_kbuild_dir}" \
|
|
|
2c76fd |
NOSTDINC_FLAGS="-I$PWD_PATH/obj/include -I$PWD_PATH/obj/include/uapi" \
|
|
|
2c76fd |
EXTRA_CFLAGS="%{nil}" \
|
|
|
2c76fd |
%{nil}
|
|
|
2c76fd |
# mark modules executable so that strip-to-file can strip them
|
|
|
2c76fd |
find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -exec chmod u+x '{}' +
|
|
|
2c76fd |
|
|
|
2c76fd |
whitelist="/lib/modules/kabi-current/kabi_whitelist_%{_target_cpu}"
|
|
|
2c76fd |
for modules in $( find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -printf "%{findpat}\n" | sed 's|\.ko$||' | sort -u ) ; do
|
|
|
2c76fd |
# update depmod.conf
|
|
|
2c76fd |
module_weak_path=$(echo "$modules" | sed 's/[\/]*[^\/]*$//')
|
|
|
2c76fd |
if [ -z "$module_weak_path" ]; then
|
|
|
2c76fd |
module_weak_path=%{name}
|
|
|
2c76fd |
else
|
|
|
2c76fd |
module_weak_path=%{name}/$module_weak_path
|
|
|
2c76fd |
fi
|
|
|
2c76fd |
echo "override $(echo $modules | sed 's/.*\///')" \
|
|
|
2c76fd |
"$(echo "%{kmod_kernel_version_dep}" |
|
|
|
2c76fd |
sed 's/\.[^\.]*$//;
|
|
|
2c76fd |
s/\([.+?^$\/\\|()\[]\|\]\)/\\\0/g').*" \
|
|
|
2c76fd |
"weak-updates/$module_weak_path" >> source/depmod.conf
|
|
|
2c76fd |
|
|
|
2c76fd |
# update greylist
|
|
|
2c76fd |
nm -u obj/%{kmod_kbuild_dir}/$modules.ko | sed 's/.*U //' | sed 's/^\.//' | sort -u | while read -r symbol; do
|
|
|
2c76fd |
grep -q "^\s*$symbol\$" $whitelist || echo "$symbol" >> source/greylist
|
|
|
2c76fd |
done
|
|
|
2c76fd |
done
|
|
|
2c76fd |
sort -u source/greylist | uniq > source/greylist.txt
|
|
|
2c76fd |
|
|
|
2c76fd |
%install
|
|
|
2c76fd |
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
|
|
|
2c76fd |
export INSTALL_MOD_DIR=%{kmod_install_path}
|
|
|
2c76fd |
PWD_PATH="$PWD"
|
|
|
2c76fd |
%if "%{workaround_no_pwd_rel_path}" != "1"
|
|
|
2c76fd |
PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD")
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
make -C %{kernel_source} modules_install \
|
|
|
2c76fd |
M=$PWD_PATH/obj/%{kmod_kbuild_dir}
|
|
|
2c76fd |
# Cleanup unnecessary kernel-generated module dependency files.
|
|
|
2c76fd |
find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \;
|
|
|
2c76fd |
|
|
|
2c76fd |
install -m 644 -D source/depmod.conf $RPM_BUILD_ROOT/etc/depmod.d/%{kmod_name}.conf
|
|
|
2c76fd |
install -m 644 -D source/greylist.txt $RPM_BUILD_ROOT/usr/share/doc/kmod-%{kmod_name}/greylist.txt
|
|
|
2c76fd |
%if 0
|
|
|
2c76fd |
%{FIRMWARE_FILES_INSTALL}
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
%if 0%{kmod_devel_package}
|
|
|
2c76fd |
install -m 644 -D $PWD/obj/%{kmod_kbuild_dir}/Module.symvers $RPM_BUILD_ROOT/usr/share/kmod-%{kmod_vendor}-%{kmod_name}/Module.symvers
|
|
|
2c76fd |
%endif
|
|
|
2c76fd |
|
|
|
2c76fd |
%clean
|
|
|
2c76fd |
rm -rf $RPM_BUILD_ROOT
|
|
|
2c76fd |
|
|
|
2c76fd |
%changelog
|
|
|
2c76fd |
* Tue Jan 07 2020 Eugene Syromiatnikov <esyr@redhat.com> 2.8.10_k_dup7.7-2
|
|
|
2c76fd |
- Rebuild due to issues with brew environment
|
|
|
2c76fd |
|
|
|
2c76fd |
* Fri Dec 20 2019 Eugene Syromiatnikov <esyr@redhat.com> 2.8.10_k_dup7.7-1
|
|
|
2c76fd |
- c45db7d2f34d6fad924c20443f73147dca7f6e29
|
|
|
2c76fd |
- i40e kernel module for Driver Update Program
|
|
|
2c76fd |
- Resolves: #bz1784768
|