Add ability to load 3rd party binary kernel modules from a special directory

This commit is contained in:
Mikhail Novosyolov 2020-08-19 20:02:58 +03:00
parent ceb968ac04
commit edab2cbe56

View file

@ -87,6 +87,7 @@
%endif %endif
%bcond_with ccache %bcond_with ccache
%bcond_without flow_abi
# Kernel flavour # Kernel flavour
%if %{with nickel} %if %{with nickel}
@ -391,6 +392,10 @@ Requires: dracut >= 046
Requires: linux-firmware >= 20181026 Requires: linux-firmware >= 20181026
Requires: wireless-regdb Requires: wireless-regdb
%if %{with flow_abi}
Requires: kernel-%{kernelversion}.%{patchlevel}-rosa-flow-abi
%endif
Recommends: crda Recommends: crda
# Keep these deps on old platforms # Keep these deps on old platforms
@ -960,7 +965,31 @@ Meta package to pull VirtualBox guest kernel modules for kernel-%{flavour}-%{ker
%endif #binary_extra_modules %endif #binary_extra_modules
############################################################################ ############################
%if %{with flow_abi}
%package -n kernel-%{kernelversion}.%{patchlevel}-rosa-flow-abi
Summary: Directory to install third-party binary kernel modules for kernels %{kernelversion}.%{patchlevel}.x
Group: System/Kernel and hardware
%description -n kernel-%{kernelversion}.%{patchlevel}-rosa-flow-abi
This package contains a directory to install third-party binary kernel modules for kernels %{kernelversion}.%{patchlevel}.x.
Some vendors provide binary-only kernel modules. They can put them into /lib/modules/%{kernelversion}.%{patchlevel}-rosa-flow-abi.
kmod tools will find them for kernels 5.4.x of "generic" and "nickel" flavours,
but there is no guarantee that these modules will load and work correctly on newer
or older kernels then the ones they were build against.
We call this "flow ABI" because most ABIs are not changed between %{kernelversion}.%{patchlevel}.x releases,
but there are no specific guarantees. ABI may evolve and change.
We highly recommend to use DKMS and build third-party kernel modules from source for every kernel!
This package does nothing, just owns a directory for third-party binary kernel modules.
%files -n kernel-%{kernelversion}.%{patchlevel}-rosa-flow-abi
/lib/modules/%{kernelversion}.%{patchlevel}-rosa-flow-abi
%endif #with flow_abi
################################################
%prep %prep
%setup -q -n %top_dir_name -c %setup -q -n %top_dir_name -c
@ -1687,3 +1716,10 @@ install -m755 %{SOURCE52} %{buildroot}%{_bindir}/cpupower-start.sh
# delete junk # delete junk
rm -fr %{buildroot}%{_usr}/src/*/kernel-source-* rm -fr %{buildroot}%{_usr}/src/*/kernel-source-*
%if %{with flow_abi}
# Prefix with "zzz" to put this directory into the end of search list
# and avoid tricks with depmod configs
mkdir -p %{buildroot}/lib/modules/%{kernelversion}.%{patchlevel}-rosa-flow-abi
ln -s /lib/modules/%{kernelversion}.%{patchlevel}-rosa-flow-abi %{buildroot}%{_modulesdir}/%{kver_full}/kernel/zzz-%{kernelversion}.%{patchlevel}-rosa-flow-abi
%endif