Blame SPECS/kmod-redhat-ice.spec

2eb987
%define kmod_name		ice
2eb987
%define kmod_vendor		redhat
2eb987
%define kmod_rpm_name		kmod-redhat-ice
2eb987
%define kmod_driver_version	0.8.2_k_dup8.2
2eb987
%define kmod_driver_epoch	%{nil}
2eb987
%define kmod_rpm_release	1
2eb987
%define kmod_kernel_version	4.18.0-193.el8
2eb987
%define kmod_kernel_version_min	%{nil}
2eb987
%define kmod_kernel_version_dep	%{nil}
2eb987
%define kmod_kbuild_dir		drivers/net/ethernet/intel/ice
2eb987
%define kmod_dependencies       %{nil}
2eb987
%define kmod_dist_build_deps	%{nil}
2eb987
%define kmod_build_dependencies	%{nil}
2eb987
%define kmod_devel_package	0
2eb987
%define kmod_devel_src_paths	%{nil}
2eb987
%define kmod_install_path	extra/kmod-redhat-ice
2eb987
%define kernel_pkg		kernel
2eb987
%define kernel_devel_pkg	kernel-devel
2eb987
%define kernel_modules_pkg	kernel-modules
2eb987
2eb987
%{!?dist: %define dist .el8_2}
2eb987
%{!?make_build: %define make_build make}
2eb987
2eb987
%if "%{kmod_kernel_version_dep}" == ""
2eb987
%define kmod_kernel_version_dep %{kmod_kernel_version}
2eb987
%endif
2eb987
2eb987
%if "%{kmod_dist_build_deps}" == ""
2eb987
%if (0%{?rhel} > 7) || (0%{?centos} > 7)
2eb987
%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists elfutils-libelf-devel kernel-rpm-macros kmod
2eb987
%else
2eb987
%define kmod_dist_build_deps redhat-rpm-config kernel-abi-whitelists
2eb987
%endif
2eb987
%endif
2eb987
2eb987
Source0:	%{kmod_name}-%{kmod_vendor}-%{kmod_driver_version}.tar.bz2
2eb987
# Source code patches
2eb987
Patch0:	0001-Revert-netdrv-ice-Don-t-reset-and-rebuild-for-Tx-tim.patch
2eb987
Patch1:	0002-Revert-netdrv-ice-Fix-format-specifier.patch
2eb987
Patch2:	0003-Revert-netdrv-ice-add-function-argument-description-.patch
2eb987
Patch3:	0004-Revert-netdrv-ice-Removing-hung_queue-variable-to-us.patch
2eb987
Patch4:	0005-Revert-netdev-pass-the-stuck-queue-to-the-timeout-ha.patch
2eb987
Patch5:	0006-Revert-netdrv-ice-add-a-devlink-region-for-dumping-N.patch
2eb987
Patch6:	0007-Revert-netdrv-ice-let-core-reject-the-unsupported-co.patch
2eb987
Patch7:	0008-Revert-netdrv-ice-Support-XDP-UMEM-wake-up-mechanism.patch
2eb987
Patch8:	0009-Revert-net-xsk-ixgbe-i40e-ice-mlx5-Xsk_umem_discard_.patch
2eb987
Patch9:	9000-bump-driver-version.patch
2eb987
Patch10:	9001-change-fw-name.patch
2eb987
Patch11:	9002-add-backport_compat.patch
2eb987
Patch12:	9003-add-pci_get_dsn.patch
2eb987
Patch13:	9004-add-pci_aer_clear_nonfatal_status.patch
2eb987
Patch14:	9005-remove-ndo_xsk_wakeup.patch
2eb987
Patch15:	9006-add-DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID.patch
2eb987
2eb987
%define findpat %( echo "%""P" )
2eb987
%define __find_requires /usr/lib/rpm/redhat/find-requires.ksyms
2eb987
%define __find_provides /usr/lib/rpm/redhat/find-provides.ksyms %{kmod_name} %{?epoch:%{epoch}:}%{version}-%{release}
2eb987
%define sbindir %( if [ -d "/sbin" -a \! -h "/sbin" ]; then echo "/sbin"; else echo %{_sbindir}; fi )
2eb987
%define dup_state_dir %{_localstatedir}/lib/rpm-state/kmod-dups
2eb987
%define kver_state_dir %{dup_state_dir}/kver
2eb987
%define kver_state_file %{kver_state_dir}/%{kmod_kernel_version}.%(arch)
2eb987
%define dup_module_list %{dup_state_dir}/rpm-kmod-%{kmod_name}-modules
2eb987
2eb987
Name:		kmod-redhat-ice
2eb987
Version:	%{kmod_driver_version}
2eb987
Release:	%{kmod_rpm_release}%{?dist}
2eb987
%if "%{kmod_driver_epoch}" != ""
2eb987
Epoch:		%{kmod_driver_epoch}
2eb987
%endif
2eb987
Summary:	ice kernel module for Driver Update Program
2eb987
Group:		System/Kernel
2eb987
License:	GPLv2
2eb987
URL:		https://www.kernel.org/
2eb987
BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
2eb987
BuildRequires:	%kernel_devel_pkg = %kmod_kernel_version
2eb987
%if "%{kmod_dist_build_deps}" != ""
2eb987
BuildRequires:	%{kmod_dist_build_deps}
2eb987
%endif
2eb987
ExclusiveArch:	x86_64
2eb987
%global kernel_source() /usr/src/kernels/%{kmod_kernel_version}.$(arch)
2eb987
2eb987
%global _use_internal_dependency_generator 0
2eb987
%if "%{?kmod_kernel_version_min}" != ""
2eb987
Provides:	%kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu}
2eb987
%else
2eb987
Provides:	%kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu}
2eb987
%endif
2eb987
Provides:	kmod-%{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
2eb987
Requires(post):	%{sbindir}/weak-modules
2eb987
Requires(postun):	%{sbindir}/weak-modules
2eb987
Requires:	kernel >= 4.18.0-193.el8
2eb987
2eb987
Requires:	kernel < 4.18.0-194.el8
2eb987
%if 1
2eb987
Requires: firmware(%{kmod_name}) = 1.3.4.0_dup8.2
2eb987
%endif
2eb987
%if "%{kmod_build_dependencies}" != ""
2eb987
BuildRequires:  %{kmod_build_dependencies}
2eb987
%endif
2eb987
%if "%{kmod_dependencies}" != ""
2eb987
Requires:       %{kmod_dependencies}
2eb987
%endif
2eb987
# if there are multiple kmods for the same driver from different vendors,
2eb987
# they should conflict with each other.
2eb987
Conflicts:	kmod-%{kmod_name}
2eb987
2eb987
%description
2eb987
ice kernel module for Driver Update Program
2eb987
2eb987
%if 1
2eb987
2eb987
%package -n kmod-redhat-ice-firmware
2eb987
Version:	1.3.4.0_dup8.2
2eb987
Summary:	ice firmware for Driver Update Program
2eb987
Provides:	firmware(%{kmod_name}) = 1.3.4.0_dup8.2
2eb987
%if "%{kmod_kernel_version_min}" != ""
2eb987
Provides:	%kernel_modules_pkg >= %{kmod_kernel_version_min}.%{_target_cpu}
2eb987
%else
2eb987
Provides:	%kernel_modules_pkg = %{kmod_kernel_version_dep}.%{_target_cpu}
2eb987
%endif
2eb987
%description -n  kmod-redhat-ice-firmware
2eb987
ice firmware for Driver Update Program
2eb987
2eb987
2eb987
%files -n kmod-redhat-ice-firmware
2eb987
%defattr(644,root,root,755)
2eb987
/lib/firmware/intel/ice/ddp/ice-1.3.4.0_dup8.2.pkg
2eb987
2eb987
2eb987
%endif
2eb987
2eb987
# Development package
2eb987
%if 0%{kmod_devel_package}
2eb987
%package -n kmod-redhat-ice-devel
2eb987
Version:	%{kmod_driver_version}
2eb987
Requires:	kernel >= 4.18.0-193.el8
2eb987
2eb987
Requires:	kernel < 4.18.0-194.el8
2eb987
Summary:	ice development files for Driver Update Program
2eb987
2eb987
%description -n  kmod-redhat-ice-devel
2eb987
ice development files for Driver Update Program
2eb987
2eb987
2eb987
%files -n kmod-redhat-ice-devel
2eb987
%defattr(644,root,root,755)
2eb987
/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/
2eb987
%endif
2eb987
2eb987
%post
2eb987
modules=( $(find /lib/modules/%{kmod_kernel_version}.%(arch)/%{kmod_install_path} | grep '\.ko$') )
2eb987
printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --add-modules --no-initramfs
2eb987
2eb987
mkdir -p "%{kver_state_dir}"
2eb987
touch "%{kver_state_file}"
2eb987
2eb987
exit 0
2eb987
2eb987
%posttrans
2eb987
# We have to re-implement part of weak-modules here because it doesn't allow
2eb987
# calling initramfs regeneration separately
2eb987
if [ -f "%{kver_state_file}" ]; then
2eb987
	kver_base="%{kmod_kernel_version_dep}"
2eb987
	kvers=$(ls -d "/lib/modules/${kver_base%%.*}"*)
2eb987
2eb987
	for k_dir in $kvers; do
2eb987
		k="${k_dir#/lib/modules/}"
2eb987
2eb987
		tmp_initramfs="/boot/initramfs-$k.tmp"
2eb987
		dst_initramfs="/boot/initramfs-$k.img"
2eb987
2eb987
		# The same check as in weak-modules: we assume that the kernel present
2eb987
		# if the symvers file exists.
2eb987
		if [ -e "/boot/symvers-$k.gz" ]; then
2eb987
			/usr/bin/dracut -f "$tmp_initramfs" "$k" || exit 1
2eb987
			cmp -s "$tmp_initramfs" "$dst_initramfs"
2eb987
			if [ "$?" = 1 ]; then
2eb987
				mv "$tmp_initramfs" "$dst_initramfs"
2eb987
			else
2eb987
				rm -f "$tmp_initramfs"
2eb987
			fi
2eb987
		fi
2eb987
	done
2eb987
2eb987
	rm -f "%{kver_state_file}"
2eb987
	rmdir "%{kver_state_dir}" 2> /dev/null
2eb987
fi
2eb987
2eb987
rmdir "%{dup_state_dir}" 2> /dev/null
2eb987
2eb987
exit 0
2eb987
2eb987
%preun
2eb987
if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then
2eb987
	mkdir -p "%{kver_state_dir}"
2eb987
	touch "%{kver_state_file}"
2eb987
fi
2eb987
2eb987
mkdir -p "%{dup_state_dir}"
2eb987
rpm -ql kmod-redhat-ice-%{kmod_driver_version}-%{kmod_rpm_release}%{?dist}.$(arch) | \
2eb987
	grep '\.ko$' > "%{dup_module_list}"
2eb987
2eb987
%postun
2eb987
if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then
2eb987
	initramfs_opt="--no-initramfs"
2eb987
else
2eb987
	initramfs_opt=""
2eb987
fi
2eb987
2eb987
modules=( $(cat "%{dup_module_list}") )
2eb987
rm -f "%{dup_module_list}"
2eb987
printf '%s\n' "${modules[@]}" | %{sbindir}/weak-modules --remove-modules $initramfs_opt
2eb987
2eb987
rmdir "%{dup_state_dir}" 2> /dev/null
2eb987
2eb987
exit 0
2eb987
2eb987
%files
2eb987
%defattr(644,root,root,755)
2eb987
/lib/modules/%{kmod_kernel_version}.%(arch)
2eb987
/etc/depmod.d/%{kmod_name}.conf
2eb987
%doc /usr/share/doc/%{kmod_rpm_name}/greylist.txt
2eb987
2eb987
2eb987
2eb987
%prep
2eb987
%setup -n %{kmod_name}-%{kmod_vendor}-%{kmod_driver_version}
2eb987
2eb987
%patch0 -p1
2eb987
%patch1 -p1
2eb987
%patch2 -p1
2eb987
%patch3 -p1
2eb987
%patch4 -p1
2eb987
%patch5 -p1
2eb987
%patch6 -p1
2eb987
%patch7 -p1
2eb987
%patch8 -p1
2eb987
%patch9 -p1
2eb987
%patch10 -p1
2eb987
%patch11 -p1
2eb987
%patch12 -p1
2eb987
%patch13 -p1
2eb987
%patch14 -p1
2eb987
%patch15 -p1
2eb987
set -- *
2eb987
mkdir source
2eb987
mv "$@" source/
2eb987
mkdir obj
2eb987
2eb987
%build
2eb987
rm -rf obj
2eb987
cp -r source obj
2eb987
2eb987
PWD_PATH="$PWD"
2eb987
%if "%{workaround_no_pwd_rel_path}" != "1"
2eb987
PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD")
2eb987
%endif
2eb987
%{make_build} -C %{kernel_source} V=1 M="$PWD_PATH/obj/%{kmod_kbuild_dir}" \
2eb987
	NOSTDINC_FLAGS="-I$PWD_PATH/obj/include -I$PWD_PATH/obj/include/uapi %{nil}" \
2eb987
	EXTRA_CFLAGS="%{nil}" \
2eb987
	%{nil}
2eb987
# mark modules executable so that strip-to-file can strip them
2eb987
find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -exec chmod u+x '{}' +
2eb987
2eb987
whitelist="/lib/modules/kabi-current/kabi_whitelist_%{_target_cpu}"
2eb987
for modules in $( find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -printf "%{findpat}\n" | sed 's|\.ko$||' | sort -u ) ; do
2eb987
	# update depmod.conf
2eb987
	module_weak_path=$(echo "$modules" | sed 's/[\/]*[^\/]*$//')
2eb987
	if [ -z "$module_weak_path" ]; then
2eb987
		module_weak_path=%{name}
2eb987
	else
2eb987
		module_weak_path=%{name}/$module_weak_path
2eb987
	fi
2eb987
	echo "override $(echo $modules | sed 's/.*\///')" \
2eb987
	     "$(echo "%{kmod_kernel_version_dep}" |
2eb987
	        sed 's/\.[^\.]*$//;
2eb987
		     s/\([.+?^$\/\\|()\[]\|\]\)/\\\0/g').*" \
2eb987
		     "weak-updates/$module_weak_path" >> source/depmod.conf
2eb987
2eb987
	# update greylist
2eb987
	nm -u obj/%{kmod_kbuild_dir}/$modules.ko | sed 's/.*U //' |  sed 's/^\.//' | sort -u | while read -r symbol; do
2eb987
		grep -q "^\s*$symbol\$" $whitelist || echo "$symbol" >> source/greylist
2eb987
	done
2eb987
done
2eb987
sort -u source/greylist | uniq > source/greylist.txt
2eb987
2eb987
%install
2eb987
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
2eb987
export INSTALL_MOD_DIR=%{kmod_install_path}
2eb987
PWD_PATH="$PWD"
2eb987
%if "%{workaround_no_pwd_rel_path}" != "1"
2eb987
PWD_PATH=$(realpath --relative-to="%{kernel_source}" . 2>/dev/null || echo "$PWD")
2eb987
%endif
2eb987
make -C %{kernel_source} modules_install \
2eb987
	M=$PWD_PATH/obj/%{kmod_kbuild_dir}
2eb987
# Cleanup unnecessary kernel-generated module dependency files.
2eb987
find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \;
2eb987
2eb987
install -m 644 -D source/depmod.conf $RPM_BUILD_ROOT/etc/depmod.d/%{kmod_name}.conf
2eb987
install -m 644 -D source/greylist.txt $RPM_BUILD_ROOT/usr/share/doc/%{kmod_rpm_name}/greylist.txt
2eb987
%if 1
2eb987
install -m 644 -D source/firmware/intel/ice/ddp/ice-1.3.4.0_dup8.2.pkg $RPM_BUILD_ROOT/lib/firmware/intel/ice/ddp/ice-1.3.4.0_dup8.2.pkg
2eb987
2eb987
%endif
2eb987
%if 0%{kmod_devel_package}
2eb987
install -m 644 -D $PWD/obj/%{kmod_kbuild_dir}/Module.symvers $RPM_BUILD_ROOT/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/build/Module.symvers
2eb987
2eb987
if [ -n "%{kmod_devel_src_paths}" ]; then
2eb987
	for i in %{kmod_devel_src_paths}; do
2eb987
		mkdir -p "$RPM_BUILD_ROOT/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/build/$(dirname "$i")"
2eb987
		cp -rv "$PWD/source/$i" \
2eb987
			"$RPM_BUILD_ROOT/lib/modules/%{kmod_rpm_name}-%{kmod_driver_version}/build/$i"
2eb987
	done
2eb987
fi
2eb987
%endif
2eb987
2eb987
2eb987
2eb987
%clean
2eb987
rm -rf $RPM_BUILD_ROOT
2eb987
2eb987
%changelog
2eb987
* Wed Oct 21 2020 Eugene Syromiatnikov <esyr@redhat.com> 0.8.2_k_dup8.2-1
2eb987
- afe1694503958c189ab98273de137c65bc3909f8
2eb987
- ice kernel module for Driver Update Program
2eb987
- Resolves: #bz1875784