File r8168.spec of Package r8168 (Revision 41)
Currently displaying revision 41 , Show latest
138
1
#
2
# spec file for package r8168
3
#
4
# Copyright (c) 2019 Packman Team <packman@links2linux.de>
5
# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany.
6
#
7
# All modifications and additions to the file contributed by third parties
8
# remain the property of their copyright owners, unless otherwise agreed
9
# upon. The license for this file, and modifications and additions to the
10
# file, is the same license as for the pristine package itself (unless the
11
# license for the pristine package is not an Open Source License, in which
12
# case the license is the MIT License). An "Open Source License" is a
13
# license that conforms to the Open Source Definition (Version 1.9)
14
# published by the Open Source Initiative.
15
16
# Please submit bugfixes or comments via https://bugs.links2linux.org/
17
#
18
19
#!BuildIgnore: enough-build-resources
20
Name: r8168
21
Version: 8.053.00
22
Release: 0
23
Summary: Device driver for RealTek Gigabit Ethernet controllers
24
License: GPL-2.0-or-later
25
Group: System/Kernel
26
URL: https://github.com/mtorromeo/r8168
27
Source0: https://github.com/mtorromeo/r8168/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
28
Source1: preamble
29
Source2: Module.supported
30
Source3: https://github.com/mtorromeo/r8168/releases/download/%{version}/%{name}-%{version}.tar.gz.asc
31
Source4: r8168.keyring
32
Patch0: r8168-kernel_version.patch
33
Patch1: r8168-configuration.patch
34
Patch2: r8168-support-linux-5.19.patch
35
Patch3: r8168-support-ethtool_keee.patch
36
Patch4: r8168-support-dev0x8136.patch
37
Patch5: r8168-support-linux-L15.5.patch
38
BuildRequires: kernel-source
39
BuildRequires: kernel-syms
40
BuildRequires: libelf-devel
41
BuildRequires: module-init-tools
42
BuildRequires: suse-module-tools-scriptlets
43
%if %{defined kernel_module_package_buildreqs}
44
BuildRequires: %kernel_module_package_buildreqs
45
%endif
46
Requires: r8168-kmp
47
ExclusiveArch: %{ix86} x86_64
48
%if %{defined kernel_module_package}
49
%kernel_module_package -n r8168 -p %_sourcedir/preamble
50
%endif
51
52
%description
53
This is the Linux device driver released for RealTek RTL8168B/8111B,
54
RTL8168C/8111C, RTL8168CP/8111CP, RTL8168D/8111D, RTL8168DP/8111DP,
55
and RTL8168E/8111E Gigabit Ethernet controllers with PCI-Express interface.
56
57
%package blacklist-r8169
58
Summary: To favour r8168 blacklist the r8169 device driver
59
Group: Hardware/Wifi
60
BuildArch: noarch
61
Requires: %{name}-kmp = %{version}
62
63
%description blacklist-r8169
64
On many Realtek Ethernet controllers the old device driver r8169 does
65
not work reliably. To solve this the r8169 kernel module has to be
66
blacklisted to enable the system to load the new device driver r8168.
67
68
%prep
69
version=$(readlink /usr/src/linux | sed -r 's/linux-//;s/-.*//;s/\./,/g')
70
[[ "$version" =~ [0-9]+,[0-9]+,[0-9]+ ]] || \
71
version=$(uname -r|sed -r 's/-.*//;s/\./,/g')
72
%setup -q
73
%patch -P 0 -b .p0
74
%patch -P 1 -b .p1
75
%patch -P 2 -p1 -b .p2
76
%patch -P 4 -p1 -b .p4
77
if test -e /usr/src/linux/include/linux/ethtool.h
78
then
79
argc=$(sed -rn '/\*get_ringparam/,/;$/p' /usr/src/linux/include/linux/ethtool.h | wc -l)
80
if test -n "$argc" -a "$argc" -eq 4
81
then
82
%patch -P 5 -b .p5
83
fi
84
argc=$(sed -rn '/ethtool_keee/p' /usr/src/linux/include/linux/ethtool.h | wc -l)
85
if test -n "$argc" -a "$argc" -eq 3
86
then
87
%patch -P 3 -p1 -b .p3
88
sed -ri "/KERNEL_VERSION/{s/\(6,9,0\)/(${version})/}" src/r8168_n.c
89
fi
90
fi
91
if test -e /usr/src/linux/include/net/gso.h
92
then
93
sed -ri "/KERNEL_VERSION/{s/\(6,4,10\)/(${version})/}" src/r8168_n.c
94
fi
95
cp %{S:1} .
96
cp %{S:2} .
97
98
%build
99
#
100
# SUSE kernel does include some patches/commits which do not increase
101
# the kernel's version, there we test here if the linux/pci-acpi.h exits
102
#
103
if test -e /usr/src/linux/include/linux/pci-aspm.h
104
then
105
sed -ri '/#define HAS_PCI_ASPM_H/{ s/@ASPM@/1/ }' src/r8168_n.c
106
else
107
sed -ri '/#define HAS_PCI_ASPM_H/{ s/@ASPM@/0/ }' src/r8168_n.c
108
fi
109
ln -sf $(type -p kmod) modinfo
110
mkdir obj
111
for flavor in %{flavors_to_build}
112
do
113
rm -rf obj/$flavor
114
cp -rp src obj/$flavor
115
make V=1 -C %{kernel_source $flavor} M=$PWD/obj/$flavor modules
116
./modinfo -F alias $(find $PWD/obj/$flavor/ -name '%{name}.ko')
117
done
118
119
%install
120
export INSTALL_MOD_PATH=%{buildroot}
121
export INSTALL_MOD_DIR=updates
122
for flavor in %{flavors_to_build}
123
do
124
make -C %{kernel_source $flavor} M=$PWD/obj/$flavor modules_install
125
done
126
mkdir -p %{buildroot}%{_sysconfdir}/modprobe.d/
127
cat > %{buildroot}%{_sysconfdir}/modprobe.d/50-blacklist-r8169.conf<<-'EOF'
128
# On many Realtek Ethernet controllers the old device driver r8169 does
129
# not work reliably. To solve this the r8169 kernel module has to be
130
# blacklisted to enable the system to load the new device driver r8168.
131
blacklist r8169
132
EOF
133
134
%files blacklist-r8169
135
%config %{_sysconfdir}/modprobe.d/50-blacklist-r8169.conf
136
137
%changelog
138