Blame SPECS/bnx2x.spec

ddba73
%define kmod_name		bnx2x
3828ce
%define kmod_driver_version	1.712.30
3828ce
%define kmod_rpm_release	1
3828ce
%define kmod_git_hash		233fd923ea4759062abb3c26493beea638264c72
3828ce
%define kmod_kernel_version	3.10.0-327.el7
3828ce
%define kernel_version		3.10.0-327.el7
ddba73
%define kmod_kbuild_dir		drivers/net/ethernet/broadcom/bnx2x
3828ce
%define kmod_firmware_version	7.13.1
ddba73
ddba73
%{!?dist: %define dist .el7}
ddba73
ddba73
Source0:	%{kmod_name}-%{kmod_driver_version}.tar.bz2			
ddba73
Source1:	%{kmod_name}.files			
ddba73
Source2:	depmodconf			
ddba73
Source3:	find-requires.ksyms			
ddba73
Source4:	find-provides.ksyms			
ddba73
Source5:	kmodtool			
ddba73
Source6:	bnx2x-firmware.files			
ddba73
Source7:	bnx2x.preamble			
ddba73
Source8:	symbols.greylist-x86_64			
ddba73
ddba73
Patch0:		bnx2x.patch
ddba73
ddba73
%define __find_requires %_sourcedir/find-requires.ksyms
ddba73
%define __find_provides %_sourcedir/find-provides.ksyms %{kmod_name} %{?epoch:%{epoch}:}%{version}-%{release}
ddba73
ddba73
Name:		%{kmod_name}
ddba73
Version:	%{kmod_driver_version}
ddba73
Release:	%{kmod_rpm_release}%{?dist}
ddba73
Summary:	%{kmod_name} kernel module
ddba73
ddba73
Group:		System/Kernel
ddba73
License:	GPLv2
ddba73
URL:		http://www.kernel.org/
ddba73
BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
ddba73
BuildRequires:	%kernel_module_package_buildreqs
ddba73
ExclusiveArch:  x86_64
ddba73
ddba73
ddba73
# firmware package
ddba73
%package -n kmod-%{kmod_name}-firmware
ddba73
Summary:       %{kmod_name} kernel module firmware
ddba73
Provides:      firmware(%{kmod_name}) = %{kmod_firmware_version}
ddba73
# firmware package has to provide kernel-modules to be recognized and
ddba73
# unpacked by Anaconda during installation
ddba73
Provides:      kernel-modules = %{kmod_kernel_version}.%{_target_cpu}
ddba73
ddba73
%description -n kmod-%{kmod_name}-firmware
ddba73
%{kmod_name} - driver update firmware
ddba73
ddba73
%files -n kmod-%{kmod_name}-firmware -f %{SOURCE6}
ddba73
ddba73
# Build only for standard kernel variant(s); for debug packages, append "debug"
ddba73
# after "default" (separated by space)
ddba73
%kernel_module_package -s %{SOURCE5} -f %{SOURCE1} -p %{SOURCE7} default
ddba73
ddba73
%description
ddba73
%{kmod_name} - driver update
ddba73
ddba73
%prep
ddba73
%setup
ddba73
%patch0 -p1
ddba73
set -- *
ddba73
mkdir source
ddba73
mv "$@" source/
ddba73
cp %{SOURCE8} source/
ddba73
mkdir obj
ddba73
ddba73
%build
ddba73
for flavor in %flavors_to_build; do
ddba73
	rm -rf obj/$flavor
ddba73
	cp -r source obj/$flavor
ddba73
ddba73
	# update symvers file if existing
ddba73
	symvers=source/Module.symvers-%{_target_cpu}
ddba73
	if [ -e $symvers ]; then
ddba73
		cp $symvers obj/$flavor/%{kmod_kbuild_dir}/Module.symvers
ddba73
	fi
ddba73
ddba73
	make -C %{kernel_source $flavor} M=$PWD/obj/$flavor/%{kmod_kbuild_dir} \
ddba73
		NOSTDINC_FLAGS="-I $PWD/obj/$flavor/include"
ddba73
ddba73
	# mark modules executable so that strip-to-file can strip them
ddba73
	find obj/$flavor/%{kmod_kbuild_dir} -name "*.ko" -type f -exec chmod u+x '{}' +
ddba73
done
ddba73
ddba73
%{SOURCE2} %{name} %{kmod_kernel_version} obj > source/depmod.conf
ddba73
ddba73
greylist=source/symbols.greylist-%{_target_cpu}
ddba73
if [ -f $greylist ]; then
ddba73
	cp $greylist source/symbols.greylist
ddba73
else
ddba73
	touch source/symbols.greylist
ddba73
fi
ddba73
ddba73
if [ -d source/firmware ]; then
ddba73
	make -C source/firmware
ddba73
fi
ddba73
ddba73
%install
ddba73
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
ddba73
export INSTALL_MOD_DIR=extra/%{name}
ddba73
for flavor in %flavors_to_build ; do
ddba73
	make -C %{kernel_source $flavor} modules_install \
ddba73
		M=$PWD/obj/$flavor/%{kmod_kbuild_dir}
ddba73
	# Cleanup unnecessary kernel-generated module dependency files.
ddba73
	find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \;
ddba73
done
ddba73
ddba73
install -m 644 -D source/depmod.conf $RPM_BUILD_ROOT/etc/depmod.d/%{kmod_name}.conf
ddba73
install -m 644 -D source/symbols.greylist $RPM_BUILD_ROOT/usr/share/doc/kmod-%{kmod_name}/greylist.txt
ddba73
ddba73
if [ -d source/firmware ]; then
ddba73
	make -C source/firmware INSTALL_PATH=$RPM_BUILD_ROOT INSTALL_DIR=updates install
ddba73
fi
ddba73
ddba73
%clean
ddba73
rm -rf $RPM_BUILD_ROOT
ddba73
ddba73
%changelog
3828ce
* Wed Jul 13 2016 Petr Oros <poros@redhat.com> 1.712.30 1
ddba73
- bnx2x DUP module
3828ce
- Resolves: #1347013