File r8168.spec of Package r8168

#
# spec file for package r8168
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           r8168
Version:        8.048.03
Release:        62.0
Summary:        Kernel module for RealTek RTL8111/8168 PCI-Express NICs
License:        GPL-2.0+
Group:          Hardware/Other
Url:            https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software
Source0:        %{name}-%{version}.tar.bz2
Source1:        preamble
Source2:        Module.supported
Patch0:			r8168-kernel_version.patch
Patch1:         r8168-configuration.patch
Patch2:         leap153.patch

BuildRequires:  %kernel_module_package_buildreqs
BuildRequires:  libelf-devel
BuildRequires:  bc
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 x86_64

Provides:	%{name}-kmp-default = %{version}
Obsoletes:  %{name}-kmp-default <= %{version}


%description
This is the Linux device driver released for RealTek RTL8168B/8111B Gigabit Ethernet controllers with PCI-Express interface. 

RTL8111B/RTL8168B/RTL8111/RTL8168
RTL8111C/RTL8111CP/RTL8111D(L)
RTL8168C/RTL8111DP/RTL8111E
RTL8168E/RTL8111F/RTL8411
RTL8111G/RTL8111GUS/RTL8411B(N)
RTL8118AS

Apply to RTL8111H(S)/RTL8118/RTL8119i as well.

%package blacklist-r8169
Summary:        To favour r8168 blacklist the r8169 device driver
Group:          Hardware/Wifi
Requires:       %{name}-kmp = %{version}

%description blacklist-r8169
On many Realtek Ethernet controllers the old device driver r8169 does
not work reliably.  To solve this the r8169 kernel module has to be
blacklisted to enable the system to load the new device driver r8168.

%kernel_module_package -p preamble


%prep
%setup -q
%patch0 -b .p0
%patch1 -b .p1
%if 0%{?sle_version} == 150300 && 0%{?is_opensuse}
%patch2 -p1
%endif

cp %{S:1} .
cp %{S:2} .

%build
ln -sf $(type -p kmod) modinfo
%{__mkdir} obj
for flavor in %{flavors_to_build}
do
    %{__rm}   -rf obj/$flavor
    %{__cp}   -rp src obj/$flavor
    %{__make} -C %{kernel_source $flavor} M=$PWD/obj/$flavor modules
    ./modinfo -F alias $(find $PWD/obj/$flavor/ -name '%{name}.ko')
done

%install
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=updates
for flavor in %{flavors_to_build}
do
    %{__make} -C %{kernel_source $flavor} M=$PWD/obj/$flavor modules_install
done
%{__mkdir_p} %{buildroot}%{_sysconfdir}/modprobe.d/
cat > %{buildroot}%{_sysconfdir}/modprobe.d/50-blacklist-r8169.conf<<-'EOF'
	# On many Realtek Ethernet controllers the old device driver r8169 does
	# not work reliably.  To solve this the r8169 kernel module has to be 
	# blacklisted to enable the system to load the new device driver r8168.
	blacklist r8169
	EOF

%clean
%{__rm} -rf %{buildroot}

%files blacklist-r8169
%defattr(-, root, root)
%config %{_sysconfdir}/modprobe.d/50-blacklist-r8169.conf

%changelog
openSUSE Build Service is sponsored by