Compare commits

...
Sign in to create a new pull request.

63 commits

Author SHA1 Message Date
Fedora Release Engineering
a9a2e93c7c Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-24 18:51:05 +00:00
Leigh Scott
85465af0fc
Use fedora compression flags 2025-03-06 10:09:00 +00:00
Fedora Release Engineering
5a91c4b4b1 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-17 09:36:10 +00:00
Fedora Release Engineering
99f961acbc Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-18 12:29:17 +00:00
Fedora Release Engineering
2cd63319b0 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-25 00:43:05 +00:00
Fedora Release Engineering
5aadb92d21 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-21 01:07:17 +00:00
Fedora Release Engineering
d3f79a681f Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-20 09:23:07 +00:00
Fedora Release Engineering
474076d6f1 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 14:58:21 +00:00
FeRD (Frank Dana)
2de1084241 Fix usage output on unrecognized argument 2023-01-12 01:28:22 -05:00
Fedora Release Engineering
7f1eac8d7a Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-21 16:27:31 +00:00
Sérgio M. Basto
138b7e74e6 kernel-abi-whitelists is not needed and break builds on el9 2022-04-03 07:53:40 +01:00
Fedora Release Engineering
2220f8d290 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-20 15:00:40 +00:00
Nicolas Chauvet
b7b636d9c6 Update changelog 2021-12-20 15:38:24 +01:00
Nicolas Chauvet
93cf8a667b Revert "Take care of OpenSuse distribution in kmodtool-kmodtool"
This reverts commit 703b25c113.
2021-12-20 15:36:49 +01:00
Nicolas Chauvet
72fc032594 Revert "Fix Take care of OpenSuse distribution in kmodtool-kmodtool rhbz#2034193"
This reverts commit 9beff26501.
2021-12-20 15:36:42 +01:00
Nicolas Viéville
9beff26501 Fix Take care of OpenSuse distribution in kmodtool-kmodtool rhbz#2034193
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2021-12-20 13:37:36 +01:00
Nicolas Viéville
703b25c113 Take care of OpenSuse distribution in kmodtool-kmodtool
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2021-12-02 20:52:53 +01:00
Nicolas Viéville
1900f33c17 Add signing and zipping modules methods for Fedora and RHEL
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2021-10-23 00:40:27 +02:00
Nicolas Viéville
67c73b2cf8 Update SPEC file and changelog
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2021-10-23 00:26:45 +02:00
Nicolas Viéville
4bd6a84826 Try to fix: check if uname from Makefile is the same as kernel variable
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2021-10-23 00:21:10 +02:00
Nicolas Viéville
4852d351ab Standardize globally kmod package names macros and kernel_uname_r variables in order to ease the build of kmod packages for non-default distribution (Fedora), for example for RHEL
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2021-10-23 00:21:10 +02:00
Nicolas Viéville
83f7c9f623 Remove grep pipe after find command
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2021-10-23 00:21:10 +02:00
Nicolas Viéville
063b999a0c Force remove temporary file
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2021-10-23 00:21:10 +02:00
Nicolas Viéville
c843631516 Remove unused variables and code
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2021-10-23 00:21:10 +02:00
Nicolas Viéville
b578b49e0a Convert if statement from "[!] $variable" to "[!] -n $variable"
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2021-10-23 00:21:10 +02:00
Nicolas Viéville
8fbaff07a6 Add installonlypkg(kernel-module) to allow kmod packages co-install (RHEL)
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2021-10-23 00:21:10 +02:00
Nicolas Viéville
1d832117e5 Fix indentation
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2021-10-23 00:21:10 +02:00
Fedora Release Engineering
ca789abc9d - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-22 10:14:41 +00:00
Fedora Release Engineering
c45f32ac60 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 15:59:01 +00:00
Fedora Release Engineering
643a065273 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-28 03:32:10 +00:00
Neal Gompa
72d7d0a864 Always use /lib/modules for kmod install path
The Fedora and RHEL kernels install things into /lib/modules and
generally expect that to be set up that way. Let's not be inconsistent
here, since it causes kmod builds to randomly fail when they get properties
from the kernel makefile build system itself.
2020-07-06 09:39:23 -04:00
Neal Gompa
c83c7f64f8 Don't force-disable debuginfo subpackages
Fedora and RHEL support generating debuginfo from kmods as long as
they are built properly, so don't force-disable debuginfo subpackages.
2020-07-06 09:15:34 -04:00
Fedora Release Engineering
f96249e601 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-29 07:40:38 +00:00
Sérgio M. Basto
e9f8c73d7e Fix package name in epel scriptlets 2019-10-13 16:39:19 +01:00
Leigh Scott
26e909573c Fix package name in epel scriptlets 2019-10-11 16:11:49 +01:00
Leigh Scott
173a447e88 Update changelog 2019-10-10 20:22:24 +01:00
Leigh Scott
91b62c7880 Fix naming conflict with kmod meta package 2019-10-10 18:56:04 +01:00
Fedora Release Engineering
20a2f602c9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-25 11:57:07 +00:00
Nicolas Chauvet
2f667b3575 Update changelog 2019-05-16 20:16:37 +02:00
Nicolas Chauvet
3d21d3cac0 Update copyright date 2019-05-16 20:15:18 +02:00
Nicolas Chauvet
b385f3e1da Add _kmodtool_depmod_post - rhbz#1703715
Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2019-05-16 19:57:45 +02:00
Alexander Larsson
476c84d2f3 Call out to akmods-ostree-post from %post
We need this for silverblue, so that we can build the
module in %post which is run during construction of the image.

To work with previous versions of akmods we check for
/usr/sbin/akmods-ostree-post before running it.

kmodtool: Forward %dist if set

This allows one to build .fc30 packages on .fc29. Otherwise everything
of the package will be .fc30 except the .srpm that is embedded, which
will be called .fc29.
2019-02-28 20:48:21 +01:00
Fedora Release Engineering
e142e6b767 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-01 05:52:37 +00:00
Nicolas Viéville
0f7338ef58 Improve and fix kernel_uname_r* variables
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2019-01-26 16:47:17 +01:00
Nicolas Viéville
2187151bcc Last clean-up - remove space at end of line
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2019-01-25 17:18:33 +01:00
Nicolas Viéville
61bc95e30a Fix minor glitches
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2019-01-25 16:23:36 +01:00
Nicolas Chauvet
26978bb447 Add rt as a known kernel variant 2019-01-25 16:07:01 +01:00
Nicolas Viéville
49f20c452d Update RPM changelog 2018-11-07 19:31:13 +01:00
Nicolas Viéville
f51f85ec08 Update copyrights 2018-11-07 19:13:56 +01:00
Nicolas Viéville
10a8eafc53 Add BuildRequires for gcc to build kmod modules for fc29
Signed-off-by: Nicolas Viéville <nicolas.vieville@uphf.fr>
2018-11-07 11:55:05 +01:00
Fedora Release Engineering
a918338bce - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-13 07:18:40 +00:00
Nicolas Chauvet
312951bbe3 Update changelog 2018-03-26 17:41:03 +02:00
nvieville
f79ab68093 Add -e to depmod (i.e. -aeF).
Signed-off-by: nvieville <nicolas.vieville@univ-valenciennes.fr>
2018-03-26 17:38:24 +02:00
Nicolas Chauvet
c7adfbbc61 Drop group field 2018-03-26 17:38:23 +02:00
Nicolas Chauvet
3cf848b166 Update copyrights 2018-03-26 17:38:22 +02:00
nvieville
0e36b508bf Enhancements for RHEL kernel:
- remove unneeded uname-r sub-package for RHEL
- enforce a range dependency for kernels
- register modules with /usr/sbin/weak-modules
- use depmod as seen in example file /usr/lib/rpm/redhat/kmodtool

Rework and squashed commits by Nicolas Chauvet <kwizart@gmail.com>

Signed-off-by: nvieville <nicolas.vieville@univ-valenciennes.fr>
2018-03-26 17:37:43 +02:00
nvieville
cfc5b51a25 Disable globally the build of package-debuginfo as it fails on RHEL too.
Signed-off-by: nvieville <nicolas.vieville@univ-valenciennes.fr>
2018-03-26 15:06:19 +02:00
nvieville
9b6b821ce3 kmodtool-kmodtool clean-up (indentation, spacing, etc.)
Signed-off-by: nvieville <nicolas.vieville@univ-valenciennes.fr>
2018-03-26 15:05:28 +02:00
Fedora Release Engineering
8020df4c3e - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-07 20:18:04 +00:00
Robert Scheck
3d9ef4c198 Revert my previous conditional fix for (/usr)/sbin/depmod and apply the kmodtool patch by Nicolas Vieville (#1484293) 2017-10-09 17:03:04 +02:00
Robert Scheck
888d8b8136 Add conditional fix for (/usr)/sbin/depmod for RHEL/CentOS 6 2017-09-19 22:10:21 +02:00
Fedora Release Engineering
4a01da57f0 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-26 17:51:58 +00:00
Hans de Goede
66527c329c Initial fedora kmodtool import 2017-02-28 08:44:46 +01:00
5 changed files with 1135 additions and 0 deletions

45
kmodtool-brp-kmodsign Normal file
View file

@ -0,0 +1,45 @@
#! /bin/bash
# The modules_sign target checks for corresponding .o files for every .ko that
# is signed. This doesn't work for package builds which re-use the same build
# directory for every flavour, and the .config may change between flavours.
# So instead of using this script to just sign lib/modules/$KernelVer/extra,
# sign all .ko in the buildroot.
# This essentially duplicates the 'modules_sign' Kbuild target and runs the
# same commands for those modules.
MODSECKEY="$1"
MODPUBKEY="$2"
KERNELSRCDIR="$4"
MOD_DIR="$3"
SCRIPTS_SIGN_BIN="scripts/sign-file"
if [ -z "${MODSECKEY}" ] || [ -z "${MODPUBKEY}" ] || [ -z "${MOD_DIR}" ] ; then
echo "brp-kmodsign: missing parameters"
exit 1
fi
if [ -z "${KERNELSRCDIR}" ] ; then
KERNELSRCDIR="."
fi
if [ ! -x "${KERNELSRCDIR}/${SCRIPTS_SIGN_BIN}" ] ; then
echo "brp-kmodsign: ${KERNELSRCDIR}/${SCRIPTS_SIGN_BIN} not found or not executable"
exit 1
fi
MODULES=$(find "${MOD_DIR}" -name "*.ko")
for MOD in ${MODULES}
do
"${KERNELSRCDIR}/${SCRIPTS_SIGN_BIN}" sha256 "${MODSECKEY}" "${MODPUBKEY}" "${MOD}"
rm -f "${MOD}".{sig,dig}
done
RANDOMMOD=$(find "${MOD_DIR}" -type f -name "*.ko" | sort -R | head -n 1)
if [ "~Module signature appended~" != "$(tail -c 28 ${RANDOMMOD})" ] ; then
echo "brp-kmodsign: modules are unsigned!"
exit 1
fi
exit 0

1
kmodtool-kernel-variants Normal file
View file

@ -0,0 +1 @@
@(smp?(-debug)|PAE?(-debug)|lpae|debug|kdump|xen|kirkwood|highbank|imx|omap|tegra|rt)

648
kmodtool-kmodtool Normal file
View file

@ -0,0 +1,648 @@
#!/bin/bash
# kmodtool - Helper script for building kernel module RPMs
# Copyright (c) 2003-2012 Ville Skyttä <ville.skytta@iki.fi>,
# Thorsten Leemhuis <fedora@leemhuis.info>
# Copyright (c) 2012-2019 Nicolas Chauvet <kwizart@gmail.com>
# Copyright (c) 2017-2018 Nicolas Viéville <nicolas.vieville@uphf.fr>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
shopt -s extglob
myprog="kmodtool-${repo}"
myver="0.12.1"
kmodname=
build_kernels="current"
kernels_known_variants=
kernel_versions=
kernel_versions_to_build_for=
filterfile=
target=
kernel_uname_r=""
kernel_uname_r_vanilla=""
kernel_uname_r_short=""
kernel_uname_r_wo_arch=""
kernel_uname_r_dist=""
kernel_uname_r_rel=""
kernel_uname_r_rel_plus_one=""
kernel_uname_r_short_plus_one=""
kernel_uname_r_rel_minor=""
error_out()
{
local errorlevel=${1}
shift
echo "Error: $@" >&2
# the next line is not multi-line safe -- not needed *yet*
echo "%global kmodtool_check echo \"kmodtool error: $@\"; exit ${errorlevel};"
exit ${errorlevel}
}
print_rpmtemplate_header()
{
echo
echo '%global kmodinstdir_prefix '${usr_lib_modules}/
echo '%global kmodinstdir_postfix '/extra/${kmodname}/
echo '%global kernel_versions '${kernel_versions}
echo
}
init_kernel_uname_r_vars()
{
## Build some interesting strings with kernel uname -r
## Examples:
## - Fedora and rhel:
## kernel_uname_r 3.10.0-693.2.2.el7.x86_64
## kernel_uname_r_vanilla 3.10.0
## kernel_uname_r_short 3.10.0-693.el7
## kernel_uname_r_wo_arch 3.10.0-693.2.2.el7
## kernel_uname_r_dist el7
## kernel_uname_r_rel 693
## kernel_uname_r_rel_plus_one 694
## kernel_uname_r_short_plus_one 3.10.0-694.el7
## kernel_uname_r_rel_minor 2.2
##
kernel_uname_r=${1}
kernel_uname_r_vanilla=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\([[:alnum:]\.]\+\|\)-\(.*\)/\1/p")
kernel_uname_r_short=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\)\(\.[[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\1-\2\4/p")
kernel_uname_r_wo_arch=$(echo ${1} | sed -e "s/\.${target}//")
kernel_uname_r_dist=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\.[[:alnum:]]\+\-\|[[:alnum:]]\+\)\([[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\4/" -e "s/^\.//p")
kernel_uname_r_rel=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\.[[:alnum:]]\+\-\|[[:alnum:]]\+\.\)\([[:alnum:]\.]\+\|\)\(.*\)/\2/" -e "s/^\.//" -e "s/[\.\-]$//p")
if $(echo "${kernel_uname_r_rel}" | grep -qE '^[0-9]+$') ; then
kernel_uname_r_rel_plus_one=$(( kernel_uname_r_rel+1 ))
else
kernel_uname_r_rel_plus_one=""
fi
kernel_uname_r_short_plus_one=$(echo ${kernel_uname_r_short} | sed -e "s/(//" -e "s/-${kernel_uname_r_rel}\./-${kernel_uname_r_rel_plus_one}\./")
kernel_uname_r_rel_minor=$(echo ${1} | sed -n -e "s/\.${target}//" -e "s/\(.*\)-\([[:alnum:]]\+\.[[:alnum:]]\+\-\|[[:alnum:]]\+\.\)\([[:alnum:]\.]\+\|\)\(\.el.*\|\.fc.*\)/\3/" -e "s/^\.//p")
}
print_rpmtemplate_macros()
{
# Defines package names macros depending on distributions (default
# is Fedora):
# - rhel_kabi is set if building for RHEL
# - kmod_pkg_name and pkg_kmod_name are the two possible forms of
# the package name used when building packages modules. First one
# uses kmod as prefix, the second one uses kmod as suffix. These
# macros allow to modify the naming schema regarding the target
# distribution (for example with suffix and prefix different from
# kmod).
# - kmod_obsolete_name same as kmod_pkg_name and pkg_kmod_name but
# for obsolete package name
#
if [[ -n ${obsolete_name} ]] ; then
echo '%global obsolete_name '${obsolete_name}
fi
cat <<EOF
%{?rhel:%global with_rhel_kabi 1}
%if 0%{?rhel} || 0%{?fedora}
%global kmod_pkg_name kmod-${kmodname}
%global pkg_kmod_name ${kmodname}-kmod
%{?obsolete_name:%global kmod_obsolete_name kmod-%{obsolete_name}}
%endif
EOF
}
print_rpmtemplate_macros_pkg_name_version()
{
# Defines package name with kernel version macros (depends on
# init_kernel_uname_r_vars for kernel_uname_r* variables):
# - rhel_kabi is set if building for RHEL
# - kmod_for_kernel defines target kernel version string
# - package_kmod_name complete package name including target kernel
# version
#
init_kernel_uname_r_vars ${1}
cat <<EOF
%if 0%{?rhel} || 0%{?fedora}
%global kmod_for_kernel %{?with_rhel_kabi:${kernel_uname_r_short}}%{!?with_rhel_kabi:${kernel_uname_r}}
%global package_kmod_name %{kmod_pkg_name}-%{kmod_for_kernel}
%endif
EOF
}
print_akmodtemplate ()
{
echo
cat <<EOF
%global akmod_install mkdir -p \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/; \\\
rpmbuild --define "_sourcedir %{_sourcedir}" \\\
--define "_srcrpmdir \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/" \\\
%{?dist:--define 'dist %{dist}}' \\\
-bs --nodeps %{_specdir}/%{name}.spec ; \\\
ln -s \$(ls \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/) \$RPM_BUILD_ROOT/%{_usrsrc}/akmods/%{pkg_kmod_name}.latest
%package -n akmod-${kmodname}
Summary: Akmod package for ${kmodname} kernel module(s)
Requires: kmodtool
Requires: akmods
%{?AkmodsBuildRequires:Requires: %{AkmodsBuildRequires}}
# same requires and provides as a kmods package would have
Requires: %{pkg_kmod_name}-common >= %{?epoch:%{epoch}:}%{version}
Provides: %{pkg_kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
EOF
if [[ -n "${obsolete_name}" ]] ; then
echo "Provides: akmod-${obsolete_name} = ${obsolete_version}"
echo "Obsoletes: akmod-${obsolete_name} < ${obsolete_version}"
fi
cat <<EOF
%description -n akmod-${kmodname}
This package provides the akmod package for the ${kmodname} kernel modules.
%posttrans -n akmod-${kmodname}
nohup /usr/sbin/akmods --from-akmod-posttrans --akmod ${kmodname} &> /dev/null &
%post -n akmod-${kmodname}
[ -x /usr/sbin/akmods-ostree-post ] && /usr/sbin/akmods-ostree-post ${kmodname} %{_usrsrc}/akmods/%{pkg_kmod_name}-%{version}-%{release}.src.rpm
%files -n akmod-${kmodname}
%defattr(-,root,root,-)
%{_usrsrc}/akmods/*
EOF
}
print_akmodmeta ()
{
cat <<EOF
%package -n %{kmod_pkg_name}
Summary: Metapackage which tracks in ${kmodname} kernel module for newest kernel
Provides: %{pkg_kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{kmod_pkg_name}-xen = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{kmod_pkg_name}-smp = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{kmod_pkg_name}-PAE = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: akmod-${kmodname} = %{?epoch:%{epoch}:}%{version}-%{release}
EOF
if [[ -n "${obsolete_name}" ]] ; then
echo "Provides: %{kmod_obsolete_name} = ${obsolete_version}"
echo "Obsoletes: %{kmod_obsolete_name} < ${obsolete_version}"
fi
cat <<EOF
%description -n %{kmod_pkg_name}
This is a meta-package without payload which sole purpose is to require the
${kmodname} kernel module(s) for the newest kernel,
to make sure you get it together with a new kernel.
%files -n %{kmod_pkg_name}
%defattr(644,root,root,755)
EOF
}
print_rpmtemplate_per_kmodpkg ()
{
if [[ "${1}" == "--custom" ]] ; then
shift
local customkernel=true
elif [[ "${1}" == "--redhat" ]] ; then
# this is needed for akmods
shift
local redhatkernel=true
fi
if [[ -h /sbin ]] ; then
echo '%global _prefix_usr '/usr
fi
# first part
#
# According to:
# https://github.com/rpm-software-management/yum/blob/master/yum/config.py#L780
# https://github.com/rpm-software-management/dnf/blob/master/dnf/const.py.in#L30
#
# and in order to be able to co-install multiples packages with the
# same name but different version on RHEL without upgrading theme,
# one has to add in package section:
# Provides: installonlypkg(kernel-module)
cat <<EOF
%package -n %{package_kmod_name}
Summary: ${kmodname} kernel module(s) for %{kmod_for_kernel}
Provides: kernel-modules%{!?with_rhel_kabi:-for-kernel} = ${kernel_uname_r}
%if %{with rhel_kabi}
Provides: installonlypkg(kernel-module)
%endif
Provides: %{pkg_kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: %{pkg_kmod_name}-common >= %{?epoch:%{epoch}:}%{version}
Requires(post): %{?_prefix_usr}/sbin/depmod
Requires(postun): %{?_prefix_usr}/sbin/depmod
%if %{with rhel_kabi}
Requires(post): %{?_prefix_usr}/sbin/weak-modules
Requires(postun): %{?_prefix_usr}/sbin/weak-modules
%endif
EOF
if [[ -n "${obsolete_name}" ]] ; then
echo
echo "Provides: %{kmod_obsolete_name}-${kernel_uname_r} = ${obsolete_version}"
echo "Obsoletes: %{kmod_obsolete_name}-${kernel_uname_r} < ${obsolete_version}"
fi
# second part
if [[ ! -n "${customkernel}" ]] ; then
cat <<EOF
%global _kmodtool_depmod_post \\\
if [ -f /boot/System.map-${kernel_uname_r} ] ; then \\\
%{?_prefix_usr}/sbin/depmod -aeF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} >/dev/null ; \\\
elif [ -f /lib/modules/${kernel_uname_r}/System.map ] ; then \\\
%{?_prefix_usr}/sbin/depmod -aeF /lib/modules/${kernel_uname_r}/System.map ${kernel_uname_r} >/dev/null ; \\\
else \\\
%{?_prefix_usr}/sbin/depmod -a >/dev/null ; \\\
fi || :
%if %{with rhel_kabi}
Requires: kernel >= ${kernel_uname_r_short}
Requires: kernel < ${kernel_uname_r_short_plus_one}
BuildRequires: kernel-devel = ${kernel_uname_r_wo_arch} redhat-rpm-config
%else
Requires: kernel-uname-r = ${kernel_uname_r}
BuildRequires: kernel-devel-uname-r = ${kernel_uname_r}
BuildRequires: gcc
%endif
%post -n %{package_kmod_name}
%{_kmodtool_depmod_post}
%if %{with rhel_kabi}
modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ -name "*.ko" -o -name "*.ko.xz") )
printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules
%endif
%if %{with rhel_kabi}
%preun -n %{package_kmod_name}
rpm -ql %{package_kmod_name}-%{version}-%{release}.$(arch) | grep -e '\.ko$' -e '\.ko.xz$' > /var/run/rpm-%{package_kmod_name}-modules
%endif
%postun -n %{package_kmod_name}
%{_kmodtool_depmod_post}
%if %{with rhel_kabi}
modules=( \$(cat /var/run/rpm-%{package_kmod_name}-modules) )
rm -f /var/run/rpm-%{package_kmod_name}-modules
printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --remove-modules
%endif
EOF
else
cat <<EOF
%post -n %{package_kmod_name}
[[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || :
%if %{with rhel_kabi}
if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then
modules=( \$(find ${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/ -name "*.ko" -o -name "*.ko.xz") )
printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --add-modules
fi
%endif
%if %{with rhel_kabi}
%preun -n %{package_kmod_name}
if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then
rpm -ql %{package_kmod_name}-%{version}-%{release}.$(arch) | grep -e '\.ko$' -e '\.ko.xz$' > /var/run/rpm-%{package_kmod_name}-modules
fi
%endif
%postun -n %{package_kmod_name}
[[ "\$(uname -r)" == "${kernel_uname_r}" ]] && %{?_prefix_usr}/sbin/depmod -a > /dev/null || :
%if %{with rhel_kabi}
if [[ "\$(uname -r)" == "${kernel_uname_r}" ]] ; then
modules=( \$(cat /var/run/rpm-%{package_kmod_name}-modules) )
rm -f /var/run/rpm-%{package_kmod_name}-modules
printf '%s\n' "\${modules[@]}" | %{?_prefix_usr}/sbin/weak-modules --remove-modules
fi
%endif
EOF
fi
# third part
cat <<EOF
%description -n %{package_kmod_name}
This package provides the ${kmodname} kernel modules built for the Linux
kernel %{kmod_for_kernel} for the %{_target_cpu} family of processors.
%files -n %{package_kmod_name}
%defattr(644,root,root,755)
%dir ${usr_lib_modules}/${kernel_uname_r}/extra
${usr_lib_modules}/${kernel_uname_r}/extra/${kmodname}/
EOF
## Set global macros and update global __spec_install_post macro to
## take in account signing and zipping macros provided in
## /etc/rpm/macros.kmodtool file.
## The global __spec_install_post macro is set per package build and
## is not included in the global /etc/rpm/macros.kmodtool file to
## avoid unwanted effects on other packages builds.
## For further explanations see comments included in
## /etc/rpm/macros.kmodtool file.
# Comment from Fedora kernel.spec about this hack. FIXME candidate.
#
# Disgusting hack alert! We need to ensure we sign modules *after* all
# invocations of strip occur, which is in __debug_install_post if
# find-debuginfo.sh runs, and __os_install_post if not.
#
cat <<EOF
%global __kmodtool_kernel_uname_r ${kernel_uname_r}
%global __spec_install_post \\
%{?__debug_package:%{__debug_install_post}}\\
%{__arch_install_post}\\
%{__os_install_post}\\
%{?__kmodtool_signmodules:%{__kmodtool_modsign_install_post}}\\
%{?__kmodtool_zipmodules:%{__kmodtool_modzip_install_post}}
EOF
}
print_rpmtemplate_kmodmetapkg ()
{
local kernel_variant="${1:+-${1}}"
cat <<EOF
%package -n %{kmod_pkg_name}${kernel_variant}
Summary: Metapackage which tracks in ${kmodname} kernel module for newest kernel${kernel_variant}
Provides: %{pkg_kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: %{package_kmod_name} >= %{?epoch:%{epoch}:}%{version}-%{release}
EOF
if [[ -n "${obsolete_name}" ]] ; then
echo "Provides: %{kmod_obsolete_name}${kernel_variant} = ${obsolete_version}"
echo "Obsoletes: %{kmod_obsolete_name}${kernel_variant} < ${obsolete_version}"
fi
cat <<EOF
%description -n %{kmod_pkg_name}${kernel_variant}
This is a meta-package without payload which sole purpose is to require the
${kmodname} kernel module(s) for the newest kernel${kernel_variant}.
to make sure you get it together with a new kernel.
%files -n %{kmod_pkg_name}${kernel_variant}
%defattr(644,root,root,755)
EOF
}
print_customrpmtemplate ()
{
for kernel in ${1}
do
if [[ -e "/usr/src/kernels/${kernel}" ]] ; then
# this looks like a Fedora/RH kernel -- print a normal template (which includes the proper BR) and be happy :)
kernel_versions="${kernel_versions}${kernel}___%{_usrsrc}/kernels/${kernel} "
# parse kernel versions string and print template
local kernel_verrelarch=${kernel%%${kernels_known_variants}}
print_rpmtemplate_macros_pkg_name_version "${kernel}"
print_rpmtemplate_per_kmodpkg --redhat ${kernel##${kernel_verrelarch}}
elif [[ -e "${usr_lib_modules}"/"${kernel}"/source/Makefile ]] ; then
# likely a user-build-kernel with available buildfiles
# check if uname from Makefile is the same as ${kernel}
KMF_VERSION="$(grep -m1 -e "^VERSION = " "${usr_lib_modules}"/"${kernel}"/source/Makefile | sed -e 's/^.*= //g')"
KMF_PATCHLEVEL="$(grep -m1 -e "^PATCHLEVEL = " "${usr_lib_modules}"/"${kernel}"/source/Makefile | sed -e 's/^.*= //g')"
KMF_SUBLEVEL="$(grep -m1 -e "^SUBLEVEL = " "${usr_lib_modules}"/"${kernel}"/source/Makefile | sed -e 's/^.*= //g')"
KMF_EXTRAVERSION="$(grep -m1 -e "^EXTRAVERSION = " "${usr_lib_modules}"/"${kernel}"/source/Makefile | sed -e 's/^.*= //g')"
# Bundled bonus
#KMF_NAME="$(grep -m1 -e "^NAME = " "${usr_lib_modules}"/"${kernel}"/source/Makefile | sed -e 's/^.*= //g')"
if [[ "${KMF_VERSION}.${KMF_PATCHLEVEL}.${KMF_SUBLEVEL}${KMF_EXTRAVERSION}" == "${kernel}" ]] ; then
kernel_versions="${kernel_versions}${kernel}___${usr_lib_modules}/${kernel}/source/ "
print_rpmtemplate_macros_pkg_name_version "${kernel}"
print_rpmtemplate_per_kmodpkg --custom
else
error_out 2 "Kernel uname from ${usr_lib_modules}/${kernel}/source/Makefile doesn't match ${kernel} from --for-kernels argument."
fi
else
error_out 2 "Don't know how to handle ${kernel} -- ${usr_lib_modules}/${kernel}/source/Makefile not found"
fi
done
# well, it's no header anymore, but who cares ;-)
print_rpmtemplate_header
}
print_rpmtemplate ()
{
# create kernel_versions var
for kernel_version in ${kernel_versions_to_build_for}
do
kernel_versions="${kernel_versions}${kernel_version}___%{_usrsrc}/kernels/${kernel_version} "
done
# and print it and some other required stuff as macro
print_rpmtemplate_header
# now print the packages itselfs
for kernel in ${kernel_versions_to_build_for} ; do
local kernel_verrelarch=${kernel%%${kernels_known_variants}}
print_rpmtemplate_macros_pkg_name_version "${kernel}"
# create metapackage
print_rpmtemplate_kmodmetapkg ${kernel##${kernel_verrelarch}}
# create package
print_rpmtemplate_per_kmodpkg ${kernel##${kernel_verrelarch}}
done
}
myprog_help ()
{
echo "Usage: $(basename ${0}) [OPTIONS]"
echo $'\n'"Creates a template to be used during kmod building"
echo $'\n'"Available options:"
# FIXME echo " --datadir <dir> -- look for our shared files in <dir>"
echo " --filterfile <file> -- filter the results with grep --file <file>"
echo " --for-kernels <list> -- created templates only for these kernels"
echo " --kmodname <file> -- name of the kmod (required)"
echo " --noakmod -- no akmod package"
echo " --repo <name> -- use buildsys-build-<name>-kerneldevpkgs"
echo " --target <arch> -- target-arch (required)"
}
while [ "${1}" ] ; do
case "${1}" in
--filterfile)
shift
if [[ ! -n "${1}" ]] ; then
error_out 2 "Please provide path to a filter-file together with --filterfile" >&2
elif [[ ! -e "${1}" ]] ; then
error_out 2 "Filterfile ${1} not found" >&2
fi
filterfile="${1}"
shift
;;
--kmodname)
shift
if [[ ! -n "${1}" ]] ; then
error_out 2 "Please provide the name of the kmod together with --kmodname" >&2
fi
# strip pending -kmod
kmodname="${1%%-kmod}"
shift
;;
--repo)
shift
if [[ ! -n "${1}" ]] ; then
error_out 2 "Please provide the name of the repo together with --repo" >&2
fi
repo=${1}
shift
;;
--for-kernels)
shift
if [[ ! -n "${1}" ]] ; then
error_out 2 "Please provide the name of the kmod together with --kmodname" >&2
fi
for_kernels="${1}"
shift
;;
--noakmod)
shift
noakmod="true"
;;
--obsolete-name)
shift
if [[ ! -n "${1}" ]] ; then
error_out 2 "Please provide the name of the kmod to obsolte together with --obsolete-name" >&2
fi
obsolete_name="${1}"
shift
;;
--obsolete-version)
shift
if [[ ! -n "${1}" ]] ; then
error_out 2 "Please provide the version of the kmod to obsolte together with --obsolete-version" >&2
fi
obsolete_version="${1}"
shift
;;
--target)
shift
target="${1}"
shift
;;
--akmod)
shift
build_kernels="akmod"
;;
--newest)
shift
build_kernels="newest"
;;
--current)
shift
build_kernels="current"
;;
--help)
myprog_help
exit 0
;;
--version)
echo "${myprog} ${myver}"
exit 0
;;
*)
echo "Error: Unknown option '${1}'." >&2
myprog_help >&2
exit 2
;;
esac
done
# These should always be in /lib/modules
# as that's how the kernel package lays them out
usr_lib_modules=/lib/modules
if [[ -e ./kmodtool-kernel-variants ]] ; then
kernels_known_variants="$(cat ./kmodtool-kernel-variants)"
elif [[ -e /usr/share/kmodtool/kernel-variants ]] ; then
kernels_known_variants="$(cat /usr/share/kmodtool/kernel-variants)"
else
error_out 2 "Could not find /usr/share/kmodtool/kernel-variants"
fi
# general sanity checks
if [[ ! -n "${target}" ]] ; then
error_out 2 "please pass target arch with --target"
elif [[ ! -n "${kmodname}" ]] ; then
error_out 2 "please pass kmodname with --kmodname"
elif [[ ! -n "${kernels_known_variants}" ]] ; then
error_out 2 "could not determine known variants"
elif ( [[ -n "${obsolete_name}" ]] && [[ ! -n "${obsolete_version}" ]] ) || ( [[ ! -n "${obsolete_name}" ]] && [[ -n "${obsolete_version}" ]] ) ; then
error_out 2 "you need to provide both --obsolete-name and --obsolete-version"
fi
# go
print_rpmtemplate_macros
if [[ -n "${for_kernels}" ]] ; then
# this is easy:
print_customrpmtemplate "${for_kernels}"
elif [[ "${build_kernels}" == "akmod" ]] ; then
# do only a akmod package
print_akmodtemplate
print_akmodmeta
else
# seems we are on out own to decide for which kernels to build
# we need more sanity checks in this case
if [[ ! -n "${repo}" ]] ; then
error_out 2 "please provide repo name with --repo"
elif ! $(which buildsys-build-${repo}-kerneldevpkgs &> /dev/null) ; then
error_out 2 "buildsys-build-${repo}-kerneldevpkgs not found"
fi
# call buildsys-build-${repo}-kerneldevpkgs to get the list of kernels
cmdoptions="--target ${target}"
# filterfile to filter list of kernels?
if [[ -n "${filterfile}" ]] ; then
cmdoptions="${cmdoptions} --filterfile ${filterfile}"
fi
kernel_versions_to_build_for="$(buildsys-build-${repo}-kerneldevpkgs --${build_kernels} ${cmdoptions})"
returncode=$?
if (( ${returncode} != 0 )) ; then
error_out 2 "buildsys-build-${repo}-kerneldevpkgs failed: $(buildsys-build-${repo}-kerneldevpkgs --${build_kernels} ${cmdoptions})"
fi
if [[ "${build_kernels}" == "current" ]] && [[ ! -n "${noakmod}" ]] ; then
print_akmodtemplate
fi
print_rpmtemplate
fi

327
kmodtool.spec Normal file
View file

@ -0,0 +1,327 @@
# Define rpm macros directory for rhel6 and rhel7
%{!?_rpmmacrodir: %define _rpmmacrodir /usr/lib/rpm/macros.d}
Name: kmodtool
Version: 1.1
Release: 14%{?dist}
Summary: Tool for building kmod packages
License: MIT
URL: http://rpmfusion.org/Packaging/KernelModules/Kmods2
# We are upstream, these files are maintained directly in pkg-git
Source1: %{name}-kmodtool
Source2: %{name}-kernel-variants
Source3: kmodtool-brp-kmodsign
Source4: macros.kmodtool
BuildArch: noarch
%description
This package contains tools and list of recent kernels that get used when
building kmod-packages.
%prep
# nothing to prep
%build
# nothing to build
%install
mkdir -p -m 0755 %{buildroot}%{_bindir} \
%{buildroot}%{_datadir}/%{name} \
%{buildroot}%{_rpmconfigdir} \
%{buildroot}%{_rpmmacrodir}
install -p -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/kmodtool
install -p -m 0644 %{SOURCE2} %{buildroot}%{_datadir}/%{name}/kernel-variants
install -p -m 0755 %{SOURCE3} %{buildroot}%{_rpmconfigdir}/brp-kmodsign
install -p -m 0644 %{SOURCE4} %{buildroot}%{_rpmmacrodir}/
%files
%{_bindir}/*
%{_datadir}/%{name}
%{_rpmconfigdir}/brp-kmodsign
%{_rpmmacrodir}/macros.kmodtool
%changelog
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Thu Mar 06 2025 Leigh Scott <leigh123linux@gmail.com> - 1.1-13
- Use fedora compression flags
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jan 12 2023 FeRD (Frank Dana) <ferdnyc@gmail.com> - 1.1-6
- Fix usage output on unrecognized argument
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Sun Apr 03 2022 Sérgio Basto <sergio@serjux.com> - 1.1-4
- kernel-abi-whitelists is not needed and break builds on el9
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Dec 20 2021 Nicolas Chauvet <kwizart@gmail.com> - 1.1-2
- Revert suse commit in kmodtool
* Fri Oct 22 2021 Nicolas Viéville <nicolas.vieville@uphf.fr> - 1.1-1
- Add signing module method to use with UEFI Secure Boot machines thanks
to Stanislas Leduc (#1454824) (reworked method)
- Add as well zipping module method and support for it in Fedora and RHEL
* Fri Oct 22 2021 Nicolas Viéville <nicolas.vieville@uphf.fr> - 1-44
- Fix indentation
- Add installonlypkg(kernel-module) to allow kmod packages co-install (RHEL)
- Convert if statement from "[!] $variable" to "[!] -n $variable"
- Remove unused variables and code
- Force remove temporary file
- Remove grep pipe after find command
- Standardize globally kmod package names macros and kernel_uname_r
variables in order to ease the build of kmod packages for non-default
distribution (Fedora), for example for RHEL
- Try to fix: check if uname from Makefile is the same as kernel variable
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1-43
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1-42
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1-41
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 06 2020 Neal Gompa <ngompa13@gmail.com> - 1-40
- Always use /lib/modules for kmod install path
* Mon Jul 06 2020 Neal Gompa <ngompa13@gmail.com> - 1-39
- Don't force-disable debuginfo subpackages
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1-38
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sun Oct 13 2019 Sérgio Basto <sergio@serjux.com> - 1-37
- Fix package name in epel scriptlets
* Thu Oct 10 2019 Leigh Scott <leigh123linux@gmail.com> - 1-36
- Fix naming conflict with kmod meta package
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1-35
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu May 16 2019 Nicolas Chauvet <kwizart@gmail.com> - 1-34
- Add _kmodtool_depmod_post - rhbz#1703715
* Thu Feb 28 2019 Alexander Larsson <alexl@redhat.com> - 1-33
- Call akmods-ostree-post to support ostree/silverblue builds - rhbz#1667014
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1-32
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Nov 07 2018 Nicolas Viéville <nicolas.vieville@uphf.fr> - 1-31
- Update copyrights
- Add BuildRequires for gcc to build kmod modules for fc29+
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1-30
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Mar 26 2018 Nicolas Chauvet <kwizart@gmail.com> - 1-29
- Update copyrights
- Drop Group field
- Patches from Nicolas Vieville - Enhancements for RHEL kernel:
- remove unneeded uname-r sub-package for RHEL
- enforce a range dependency for kernels
- register modules with /usr/sbin/weak-modules
- use depmod as seen in example file /usr/lib/rpm/redhat/kmodtool
- Add -e to depmod.
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1-28
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Mon Oct 09 2017 Robert Scheck <robert@fedoraproject.org> - 1-27
- Revert my previous conditional fix for (/usr)/sbin/depmod
and apply the kmodtool patch by Nicolas Vieville (#1484293)
* Tue Sep 19 2017 Robert Scheck <robert@fedoraproject.org> - 1-26
- Add conditional fix for (/usr)/sbin/depmod for RHEL/CentOS 6
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Thu Feb 16 2017 Hans de Goede <hdegoede@redhat.com> - 1-24
- Modernize .spec a bit
- Submit to Fedora for package review
* Sat Dec 07 2013 Nicolas Chauvet <kwizart@gmail.com> - 1-23
- Add support for lpae kernel variant for ARM
* Sat Feb 23 2013 Nicolas Chauvet <kwizart@gmail.com> - 1-22
- Fix directory ownership rfbz#2684
* Mon Sep 03 2012 Nicolas Chauvet <kwizart@gmail.com> - 1-21
- Add ARM varriant
* Sat May 26 2012 Nicolas Chauvet <kwizart@gmail.com> - 1-20
- Fix for depmod - rfbz#2340
* Wed Feb 01 2012 Nicolas Chauvet <kwizart@gmail.com> - 1-19
- Update to 0.12.0
* Sun Mar 29 2009 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 1-18
- rebuild for new F11 features
* Thu Feb 26 2009 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-17
- add support for obsoletes to kmodtool
* Sun Feb 01 2009 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-16
- add posttrans hooks to akmod packages, to make akmods build them
after install or update
* Sat Jan 31 2009 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-15
- require kmod-${kmodname}-${kernel_uname_r} with >= in meta package to
avoid problems if user has a newer akmods package that wants to install
a newer kmod-${kmodname}-${kernel_uname_r}
* Sun Dec 14 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-14
- don't require the kmod-meta package in kmod-(uname -r) packages
* Tue Sep 30 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-13
- rebuild for RPM Fusion
* Sat Aug 02 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-12
- fix #2056 (kmod provides in akmod package needs epoch)
* Sat Jun 14 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-11
- fix #2011
* Sun Apr 06 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-10
- use better Requires and BuildRequires to avoid fileslist download
* Sat Mar 29 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-9
- adjust to recent "arch and flavor in uname" changes from j-rod
* Sat Feb 23 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-8
- add AkmodsBuildRequires stuff to akmods template, so those rare kmod
packages that need special BR can be added to the akmod package
* Sat Jan 26 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-7
- fix the akmods vs. akmod confusion and use akmod normally
* Wed Jan 09 2008 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-6
- integrate akmodstool into kmodtool
* Mon Dec 17 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-5
- update kmodtool, so the kmod-foo-<uname -r> package does not require the
kmod-foo package when building for kernels that were passed with for-kernels
* Tue Dec 04 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-4
- update kmodtool, so the kmod-foo metapackage requires the proper version
of the kmod-foo-<uname -r> package
* Tue Dec 04 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-3
- update kmodtool, so the kmod-foo metapackage provides foo-kmod (which it only
indirectly does); that should fix #1742, as kmod-foo has a shorter name now
then kmod-foo-<uname -r>
* Sat Dec 01 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-2
- update kmodtool, so the kmod-foo-<uname -r> package tracks in kmod-foo
* Sun Oct 28 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 1-1
- split buildsys stuff out into a seperate package
- rename kmod-helpers-livna to kmodtool
- add proper obsoletes
- make package noarch
* Sat Oct 27 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 16-2
- Update to latest kernels 2.6.23.1-35.fc8 2.6.21-2950.fc8xen
* Sat Oct 27 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 16-1
- Update to latest kernels 2.6.23.1-35.fc8 2.6.21-2949.fc8xen
* Thu Oct 18 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 15-1
- rebuilt for latest kernels
* Thu Oct 18 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 14-1
- rebuilt for latest kernels
* Thu Oct 18 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 13-1
- rebuilt for latest kernels
* Thu Oct 18 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 12-1
- rebuilt for latest kernels
* Fri Oct 12 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 11-1
- rebuilt for latest kernels
* Thu Oct 11 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 10-1
- rebuilt for latest kernels
* Wed Oct 10 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 9-2
- fix typo
* Wed Oct 10 2007 Thorsten Leemhuis <fedora[AT]leemhuis[DOT]info> - 9-1
- rebuilt for latest kernels
* Sun Oct 07 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 8-1
- update for 2.6.23-0.224.rc9.git6.fc8
* Sun Oct 07 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 7-1
- update for 2.6.23-0.222.rc9.git1.fc8
* Wed Oct 03 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 6-1
- update for 2.6.23-0.217.rc9.git1.fc8 and 2.6.21-2947.fc8xen
* Wed Oct 03 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 5-1
- disable --all-but-latest stuff -- does not work as expected
- rename up2date list of kernels from "latest" to "current" as latest
and newest are to similar in wording; asjust script as well
- kmodtool: don't provide kernel-modules, not needed anymore with
the new stayle and hurts
* Sun Sep 09 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 4-2
- fix typos in spec file and list-kernels script
- interdependencies between the two buildsys-build packages needs to be
arch specific as well
* Sun Sep 09 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 4-1
- s/latests/latest/
- update kernel lists for rawhide and test2 kernels
- make kmod-helpers-livna-list-kernels print BuildRequires for all kernels
as well; this is not needed and will slow build a bit as it will track
all the kernel-devel packages in, but that way we make sure they are really
available in the buildsys
* Fri Sep 07 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 3-4
- implement proper arch deps
* Fri Sep 07 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 3-3
- proper list of todays rawhide-kernels
* Fri Sep 07 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 3-2
- fix typo in kmod-helpers-livna-latests-kernels
* Fri Sep 07 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 3-1
- adjust for devel
* Sat Sep 01 2007 Thorsten Leemhuis <fedora [AT] leemhuis [DOT] info> - 2-1
- initial package

114
macros.kmodtool Normal file
View file

@ -0,0 +1,114 @@
# /etc/rpm/macros.kmodtool: kmodtool keypair sign and zip config.
#
# This file controls signing and zipping modules on the system, included
# akmods ones.
# It uses the rpm macros syntax to define global symbol imported
# directly by kmodtool while rebuilding kmods.
#
# Signing modules
#
# __kmodtool_signmodules can take one of these two values:
# 1 - Modules would be signed when rebuilding modules.
# 0 - No signed modules when rebuilding modules.
# __kmodtool_signmodules_pubkey gives path and name of the public key to
# be used to sign newly build modules.
# __kmodtool_signmodules_privkey gives path and name of the private key to
# be used to sign newly build modules.
#
# __kmodtool_signmodules* macros can be overriden by users and/or
# packagers provided that those values and their dependencies are
# manually checked. Be carefull when modifying these values. To override
# these macros please define these ones in your spec file (one
# underscore as prefix and not two):
# - _kmodtool_signmodules
# - _kmodtool_signmodules_pubkey
# - _kmodtool_signmodules_privkey
# It is also possible to uncomment one or several of the macros provided
# below:
#%%_kmodtool_signmodules 0
#%%_kmodtool_signmodules 1
#%%_kmodtool_signmodules_pubkey /path/to/your/public_key.der
#%%_kmodtool_signmodules_privkey /path/to/your/private_key.der
#
# Signing modules is enabled in Fedora kernels for every arches,
# even if kernels are not signed for arches other than
# %%{ix86} x86_64 aarch64.
#
# Sign modules on x86. Make sure the config files match this setting if
# more architectures are added.
%__kmodtool_signmodules %{?_kmodtool_signmodules:%{_kmodtool_signmodules}}%{!?_kmodtool_signmodules:1}
# This is current keypair enrolled in MOK to sign modules
%__kmodtool_signmodules_pubkey %{?_kmodtool_signmodules_pubkey:%{_kmodtool_signmodules_pubkey}}%{!?_kmodtool_signmodules_pubkey:/etc/pki/akmods/certs/public_key.der}
%__kmodtool_signmodules_privkey %{?_kmodtool_signmodules_privkey:%{_kmodtool_signmodules_privkey}}%{!?_kmodtool_signmodules_privkey:/etc/pki/akmods/private/private_key.priv}
# Define signing macros
#
%__kmodtool_modsign_cmd %{_rpmconfigdir}/brp-kmodsign
%__kmodtool_modsign_install_post \
if [ "%{__kmodtool_signmodules}" -eq "1" ] && [ -x %{__kmodtool_modsign_cmd} ] && [ -e %{__kmodtool_signmodules_privkey} ] && [ -e %{__kmodtool_signmodules_pubkey} ] ; then\
%{__kmodtool_modsign_cmd} %{__kmodtool_signmodules_privkey} %{__kmodtool_signmodules_pubkey} %{buildroot}%{kmodinstdir_prefix}%{__kmodtool_kernel_uname_r}%{kmodinstdir_postfix} /usr/src/kernels/%{__kmodtool_kernel_uname_r}\
fi\
%{nil}
# Zipping modules
#
# __kmodtool_zipmodules can take one of these two values:
# 1 - Modules would be zipped when rebuilding modules.
# 0 - No zipped modules when rebuilding modules.
#
# __kmodtool_zipmodules* macros can be overriden by users and/or packagers
# provided that those values and their dependencies are manually
# checked. Be carefull when modifying these values. To override these
# macros please define these ones in your spec file (one underscore as
# prefix and not two):
# - _kmodtool_zipmodules
# It is also possible to uncomment one of the macros provided below:
#%%_kmodtool_zipmodules 0
#%%_kmodtool_zipmodules 1
#
# Zipping modules according to Fedora kernels sources is enabled only
# for arches %%{ix86} x86_64 aarch64. For information zipping kernel
# modules is available since rhel 7.x and fedora 21.
# Settings below conform to this directives.
#
# Zip modules on x86 x86_64 aarch64. Make sure the config files match
# this setting if more architectures are added.
%__kmodtool_zipmodules_arch_ok %(
echo %{ix86} x86_64 aarch64 | grep -qwo %{_arch}
if [ $? -eq 0 ] ; then
echo 1
else
echo 0
fi
)
# Distributions where zipping is enabled by default
%__kmodtool_zipmodules_dist_ok %(
if (( %{?rhel} + 0 > 6 || %{?fedora} + 0 > 20 )) ; then
echo 1
else
echo 0
fi
)
# Put arches and distributions conditions together
%__kmodtool_zipmodules_ok %(
if (( %{?__kmodtool_zipmodules_arch_ok} && %{?__kmodtool_zipmodules_dist_ok} )) ; then
echo 1
else
echo 0
fi
)
# Put them all in place
%__kmodtool_zipmodules %{?_kmodtool_zipmodules:%{_kmodtool_zipmodules}}%{!?_kmodtool_zipmodules:%{?__kmodtool_zipmodules_ok}}
# Define zipping macros
#
%__kmodtool_modzip_install_post\
if [ "%{__kmodtool_zipmodules}" -eq "1" ] ; then\
find %{buildroot}%{kmodinstdir_prefix}%{__kmodtool_kernel_uname_r}%{kmodinstdir_postfix} -type f -name '*.ko' | xargs xz --compress --check=crc32 --lzma2=dict=1MiB;\
fi\
%{nil}