Blame SPECS/kmod-skge.spec

459d90
%global pkg skge
459d90
459d90
%global kernel_version_min 4.18.0-240.el8
459d90
459d90
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
459d90
# Otherwise the latest installed kernel-devel version later than
459d90
# %%{kernel_version_min} will be used.
459d90
459d90
%global kernel_version_latest %({ echo %{kernel_version_min}; rpm --query kernel-devel --queryformat '%%{VERSION}-%%{RELEASE}\\\n' | grep -v "package kernel-devel is not installed"; } | sort -V | sed -e '0,/^%{kernel_version_min}$/d' | tail -n 1)
459d90
459d90
%if "%{kernel_version_latest}" != ""
459d90
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
459d90
%endif
459d90
459d90
%global _use_internal_dependency_generator 0
459d90
%global __find_requires %{nil}
459d90
%global __find_provides /usr/lib/rpm/find-provides
459d90
459d90
%global debug_package %{nil}
459d90
459d90
%global __spec_install_post \
459d90
  %{?__debug_package:%{__debug_install_post}} \
459d90
  %{__arch_install_post} \
459d90
  %{__os_install_post} \
459d90
  %{__mod_compress_install_post}
459d90
459d90
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
459d90
459d90
459d90
Name:             kmod-%{pkg}
459d90
Version:          5.7
459d90
Release:          2%{?dist}
459d90
Summary:          SysKonnect/Marvell Yukon Gigabit Ethernet (%{pkg}) driver
459d90
459d90
License:          GPLv2
459d90
URL:              https://www.kernel.org/
459d90
459d90
Source0:          %{pkg}-%{version}.tar.xz
459d90
459d90
ExclusiveArch:    x86_64 aarch64
459d90
459d90
BuildRequires:    elfutils-libelf-devel
459d90
BuildRequires:    gcc
459d90
BuildRequires:    kmod
459d90
BuildRequires:    make
459d90
BuildRequires:    redhat-rpm-config
459d90
BuildRequires:    xz
459d90
459d90
%{!?kernel_version:
459d90
BuildRequires:    kernel-devel >= %{kernel_version_min}
459d90
}
459d90
459d90
%{?kernel_version:
459d90
BuildRequires:    kernel-devel = %{kernel_version}
459d90
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
459d90
459d90
Requires:         kernel-core = %{kernel_version}
459d90
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
459d90
Requires:         kernel-modules = %{kernel_version}
459d90
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
459d90
459d90
Provides:         installonlypkg(kernel-module)
459d90
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
459d90
}
459d90
459d90
Requires(post):   /usr/sbin/depmod
459d90
Requires(postun): /usr/sbin/depmod
459d90
459d90
Requires(post):   /usr/bin/dracut
459d90
Requires(postun): /usr/bin/dracut
459d90
459d90
459d90
%description
459d90
This driver supports Gigabit Ethernet adapters based on the Marvell Yukon
459d90
chipset:
459d90
459d90
- 0x10B7:0x1700: 3Com 3C940
459d90
- 0x10B7:0x80EB: 3Com 3C940B
459d90
- 0x1148:0x4300: SysKonnect SK-9xx
459d90
- 0x1148:0x4320: SysKonnect SK-98xx V2.0
459d90
- 0x1186:0x4302: D-Link DGE-530T Rev C1
459d90
- 0x1186:0x4B01: D-Link DGE-530T Rev B
459d90
- 0x1186:0x4C00: D-Link DGE-530T
459d90
- 0x11AB:0x4320: Marvell Yukon 88E8001/8003/8010
459d90
- 0x11AB:0x5005: Belkin
459d90
- 0x1371:0x434E: CNet PowerG-2000
459d90
- 0x1737:0x1032:*:0x0015: Linksys EG1032 v2
459d90
- 0x1737:0x1064: Linksys EG1064 v2
459d90
459d90
459d90
%prep
459d90
%autosetup -p1 -n %{pkg}-%{version}
459d90
459d90
459d90
%build
459d90
pushd src
459d90
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
459d90
popd
459d90
459d90
459d90
%install
459d90
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/ethernet/marvell src/%{pkg}.ko
459d90
459d90
# Make .ko objects temporarily executable for automatic stripping
459d90
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
459d90
459d90
459d90
%clean
459d90
%{__rm} -rf %{buildroot}
459d90
459d90
459d90
%post
459d90
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
459d90
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
459d90
459d90
459d90
%preun
459d90
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
459d90
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
459d90
459d90
459d90
%postun
459d90
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
459d90
then
459d90
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
459d90
    then
459d90
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
459d90
    fi
459d90
459d90
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
459d90
    then
459d90
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
459d90
        then
459d90
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
459d90
            then
459d90
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
459d90
            else
459d90
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
459d90
            fi
459d90
        fi
459d90
    fi
459d90
459d90
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
459d90
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
459d90
fi
459d90
459d90
459d90
%posttrans
459d90
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
459d90
then
459d90
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
459d90
    then
459d90
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
459d90
    fi
459d90
459d90
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
459d90
    then
459d90
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
459d90
        then
459d90
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
459d90
            then
459d90
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
459d90
            else
459d90
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
459d90
            fi
459d90
        fi
459d90
    fi
459d90
459d90
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
459d90
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
459d90
fi
459d90
459d90
459d90
%files
459d90
%defattr(644,root,root,755)
459d90
/lib/modules/%{kernel_version}.%{_arch}
459d90
%license COPYING
459d90
459d90
459d90
%changelog
459d90
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.7-2
459d90
- Initial version