forked from rpms/nvidia-open-kmod
Initial package for AlmaLinux
This commit is contained in:
commit
7cfa967c6a
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*.tar.gz
|
||||||
|
*.run
|
@ -0,0 +1,45 @@
|
|||||||
|
From a2e9b73f8d3f593eed007ebfe51dabc9a0e410c2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Neal Gompa <ngompa@almalinux.org>
|
||||||
|
Date: Mon, 7 Apr 2025 19:36:18 -0400
|
||||||
|
Subject: [PATCH] kernel-open/nvidia-drm: Enable kernel mode-setting by default
|
||||||
|
|
||||||
|
The general expectation for the Linux graphics stack for more than
|
||||||
|
a decade has been to use kernel mode-setting. It is now a requirement
|
||||||
|
for things to work properly on Wayland-based graphical environments,
|
||||||
|
so flip the default to use kernel mode-setting by default.
|
||||||
|
|
||||||
|
Signed-off-by: Neal Gompa <ngompa@almalinux.org>
|
||||||
|
---
|
||||||
|
kernel-open/nvidia-drm/nvidia-drm-linux.c | 2 +-
|
||||||
|
kernel-open/nvidia-drm/nvidia-drm-os-interface.c | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kernel-open/nvidia-drm/nvidia-drm-linux.c b/kernel-open/nvidia-drm/nvidia-drm-linux.c
|
||||||
|
index 3cb1815d..209cb469 100644
|
||||||
|
--- a/kernel-open/nvidia-drm/nvidia-drm-linux.c
|
||||||
|
+++ b/kernel-open/nvidia-drm/nvidia-drm-linux.c
|
||||||
|
@@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
MODULE_PARM_DESC(
|
||||||
|
modeset,
|
||||||
|
- "Enable atomic kernel modesetting (1 = enable, 0 = disable (default))");
|
||||||
|
+ "Enable atomic kernel modesetting (1 = enable (default), 0 = disable)");
|
||||||
|
module_param_named(modeset, nv_drm_modeset_module_param, bool, 0400);
|
||||||
|
|
||||||
|
#if defined(NV_DRM_FBDEV_AVAILABLE)
|
||||||
|
diff --git a/kernel-open/nvidia-drm/nvidia-drm-os-interface.c b/kernel-open/nvidia-drm/nvidia-drm-os-interface.c
|
||||||
|
index 7617476d..f22afd77 100644
|
||||||
|
--- a/kernel-open/nvidia-drm/nvidia-drm-os-interface.c
|
||||||
|
+++ b/kernel-open/nvidia-drm/nvidia-drm-os-interface.c
|
||||||
|
@@ -41,7 +41,7 @@
|
||||||
|
#include <drm/drmP.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-bool nv_drm_modeset_module_param = false;
|
||||||
|
+bool nv_drm_modeset_module_param = true;
|
||||||
|
bool nv_drm_fbdev_module_param = true;
|
||||||
|
|
||||||
|
void *nv_drm_calloc(size_t nmemb, size_t size)
|
||||||
|
--
|
||||||
|
2.48.1
|
||||||
|
|
12
kmod-nvidia-open.spec.preamble
Normal file
12
kmod-nvidia-open.spec.preamble
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Conflicts: akmod-%{kmodname}
|
||||||
|
Conflicts: dkms-%{kmodname}
|
||||||
|
# Conflict with legacy driver
|
||||||
|
Conflicts: dkms-nvidia
|
||||||
|
Conflicts: kmod-nvidia${dashvariant}
|
||||||
|
# Declare ourselves as a provider of the nvidia kernel module
|
||||||
|
Conflicts: nvidia-kmod
|
||||||
|
Provides: nvidia-kmod = 3:%{version}-%{release}
|
||||||
|
# Require our parts of the stack
|
||||||
|
Requires: nvidia-open-kmod = %{version}-%{release}
|
||||||
|
# Install if negativo17 packaged userspace libraries are being installed
|
||||||
|
Supplements: (kernel${dashvariant} and (nvidia-driver-libs%{?_isa} or nvidia-driver-cuda-libs%{?_isa}))
|
346
kmodtool-local-override
Executable file
346
kmodtool-local-override
Executable file
@ -0,0 +1,346 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# kmodtool - Helper script for building kernel module RPMs
|
||||||
|
# An original version appeared in Fedora. This version is
|
||||||
|
# generally called only by the %kernel_module_package RPM macro
|
||||||
|
# during the process of building Driver Update Packages (which
|
||||||
|
# are also known as "kmods" in the Fedora community).
|
||||||
|
#
|
||||||
|
# Copyright (c) 2003-2010 Ville Skyttä <ville.skytta@iki.fi>,
|
||||||
|
# Thorsten Leemhuis <fedora@leemhuis.info>
|
||||||
|
# Jon Masters <jcm@redhat.com>
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# Changelog:
|
||||||
|
#
|
||||||
|
# 2010/07/28 - Add fixes for filelists in line with LF standard
|
||||||
|
# - Remove now defunct "framepointer" kernel variant
|
||||||
|
# - Change version to "rhel6-rh2" as a consequence.
|
||||||
|
#
|
||||||
|
# 2010/01/10 - Simplified for RHEL6. We are working on upstream
|
||||||
|
# moving to a newer format and in any case do not
|
||||||
|
# need to retain support for really old systems.
|
||||||
|
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
|
myprog="kmodtool"
|
||||||
|
myver="0.10.10_rhel9"
|
||||||
|
knownvariants=@(debug|kdump|zfcpdump)
|
||||||
|
kmod_name=
|
||||||
|
kver=
|
||||||
|
verrel=
|
||||||
|
variant=
|
||||||
|
|
||||||
|
get_verrel ()
|
||||||
|
{
|
||||||
|
verrel=${1:-$(uname -r)}
|
||||||
|
verrel=${verrel/%[.+]$knownvariants/}
|
||||||
|
}
|
||||||
|
|
||||||
|
print_verrel ()
|
||||||
|
{
|
||||||
|
get_verrel "$@"
|
||||||
|
echo "${verrel}"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_variant ()
|
||||||
|
{
|
||||||
|
get_verrel "$@"
|
||||||
|
variant=${1:-$(uname -r)}
|
||||||
|
variant=${variant/#$verrel?(.+)/}
|
||||||
|
variant=${variant:-'""'}
|
||||||
|
}
|
||||||
|
|
||||||
|
print_variant ()
|
||||||
|
{
|
||||||
|
get_variant $@
|
||||||
|
echo "${variant}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Detect flavor separator character. We have to do that due to
|
||||||
|
# a systemd-tailored patch for kernel spec[1][2] introduced in Fedora and then
|
||||||
|
# imported in RHEL 8 that broke all OOT kmod infrastructure for the flavored
|
||||||
|
# kernels.
|
||||||
|
#
|
||||||
|
# [1] https://lists.fedoraproject.org/pipermail/kernel/2013-June/004262.html
|
||||||
|
# [2] https://src.fedoraproject.org/rpms/kernel/c/faf25207dc86666a611c45ae3ffaf385c170bd2a
|
||||||
|
#
|
||||||
|
# $1 - kver
|
||||||
|
# $2 - variant
|
||||||
|
get_variant_char ()
|
||||||
|
{
|
||||||
|
variant="$2"
|
||||||
|
[ "$variant" != "default" ] || variant=""
|
||||||
|
|
||||||
|
get_verrel "$1"
|
||||||
|
|
||||||
|
variant_char=""
|
||||||
|
[ -n "$variant" ] || return 0
|
||||||
|
|
||||||
|
# We expect that the flavored kernel is already installed in the buildroot
|
||||||
|
variant_char="+"
|
||||||
|
[ -e "/usr/src/kernels/${verrel}+${variant}" ] && return 0
|
||||||
|
|
||||||
|
variant_char="."
|
||||||
|
}
|
||||||
|
|
||||||
|
print_variant_char ()
|
||||||
|
{
|
||||||
|
get_variant_char "$@"
|
||||||
|
echo "${variant_char}"
|
||||||
|
}
|
||||||
|
|
||||||
|
print_kernel_source ()
|
||||||
|
{
|
||||||
|
get_variant_char "$@"
|
||||||
|
echo "/usr/src/kernels/${verrel}${variant_char}${variant}"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_filelist() {
|
||||||
|
local IFS=$'\n'
|
||||||
|
filelist=($(cat))
|
||||||
|
|
||||||
|
if [ ${#filelist[@]} -gt 0 ];
|
||||||
|
then
|
||||||
|
for ((n = 0; n < ${#filelist[@]}; n++));
|
||||||
|
do
|
||||||
|
line="${filelist[n]}"
|
||||||
|
line=$(echo "$line" \
|
||||||
|
| sed -e "s/%verrel/$verrel/g" \
|
||||||
|
| sed -e "s/%variant/$variant/g" \
|
||||||
|
| sed -e "s/%dashvariant/$dashvariant/g" \
|
||||||
|
| sed -e "s/%dotvariant/$dotvariant/g" \
|
||||||
|
| sed -e "s/\+%1/$dotvariant/g" \
|
||||||
|
| sed -e "s/\.%1/$dotvariant/g" \
|
||||||
|
| sed -e "s/\-%1/$dotvariant/g" \
|
||||||
|
| sed -e "s/%2/$verrel/g")
|
||||||
|
echo "$line"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "%defattr(644,root,root,755)"
|
||||||
|
echo "/lib/modules/${verrel}${dotvariant}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
get_rpmtemplate ()
|
||||||
|
{
|
||||||
|
local variant="${1}"
|
||||||
|
|
||||||
|
get_variant_char "${verrel}" "${variant}"
|
||||||
|
|
||||||
|
local dashvariant="${variant:+-${variant}}"
|
||||||
|
local dotvariant="${variant:+${variant_char}${variant}}"
|
||||||
|
|
||||||
|
echo "%package -n kmod-${kmod_name}${dashvariant}"
|
||||||
|
|
||||||
|
if [ -z "$kmod_provides_summary" ]; then
|
||||||
|
echo "Summary: ${kmod_name} kernel module(s)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$kmod_provides_group" ]; then
|
||||||
|
echo "Group: System Environment/Kernel"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$kmod_version" ]; then
|
||||||
|
echo "Version: %{kmod_version}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$kmod_release" ]; then
|
||||||
|
echo "Release: %{kmod_release}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
Provides: kernel-modules >= ${verrel}${dotvariant}
|
||||||
|
Provides: kernel${dashvariant}-modules >= ${verrel}
|
||||||
|
Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||||
|
Requires(post): /usr/sbin/depmod
|
||||||
|
Requires(postun): /usr/sbin/depmod
|
||||||
|
Requires(post): /usr/sbin/weak-modules
|
||||||
|
Requires(postun): /usr/sbin/weak-modules
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "yes" != "$nobuildreqs" ]
|
||||||
|
then
|
||||||
|
cat <<EOF
|
||||||
|
BuildRequires: kernel${dashvariant}-devel
|
||||||
|
BuildRequires: kernel-abi-stablelists
|
||||||
|
BuildRequires: redhat-rpm-config kernel-rpm-macros
|
||||||
|
BuildRequires: elfutils-libelf-devel kmod
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "" != "$override_preamble" ]
|
||||||
|
then
|
||||||
|
cat "$override_preamble" | dashvariant=${dashvariant} envsubst
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
%description -n kmod-${kmod_name}${dashvariant}
|
||||||
|
This package provides the ${kmod_name} kernel modules built for
|
||||||
|
the Linux kernel ${verrel}${dotvariant} for the %{_target_cpu}
|
||||||
|
family of processors.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
## The following are not part of this script directly, they are scripts ##
|
||||||
|
## that will be executed by RPM during various stages of package processing ##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
%post -n kmod-${kmod_name}${dashvariant}
|
||||||
|
if [ -e "/boot/System.map-${verrel}${dotvariant}" ]; then
|
||||||
|
/usr/sbin/depmod -aeF "/boot/System.map-${verrel}${dotvariant}" "${verrel}${dotvariant}" > /dev/null || :
|
||||||
|
fi
|
||||||
|
|
||||||
|
modules=( \$(find /lib/modules/${verrel}${dotvariant}/extra/${kmod_name} | grep -E '\.ko(\.gz|\.bz2|\.xz|\.zst)?$') )
|
||||||
|
if [ -x "/usr/sbin/weak-modules" ]; then
|
||||||
|
printf '%s\n' "\${modules[@]}" \
|
||||||
|
| /usr/sbin/weak-modules --add-modules
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
%preun -n kmod-${kmod_name}${dashvariant}
|
||||||
|
rpm -ql kmod-${kmod_name}${dashvariant}-%{kmod_version}-%{kmod_release}.$(arch) | grep -E '\.ko(\.gz|\.bz2|\.xz|\.zst)?$' > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
%postun -n kmod-${kmod_name}${dashvariant}
|
||||||
|
if [ -e "/boot/System.map-${verrel}${dotvariant}" ]; then
|
||||||
|
/usr/sbin/depmod -aeF "/boot/System.map-${verrel}${dotvariant}" "${verrel}${dotvariant}" > /dev/null || :
|
||||||
|
fi
|
||||||
|
|
||||||
|
modules=( \$(cat /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules) )
|
||||||
|
rm /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
|
||||||
|
if [ -x "/usr/sbin/weak-modules" ]; then
|
||||||
|
printf '%s\n' "\${modules[@]}" \
|
||||||
|
| /usr/sbin/weak-modules --remove-modules
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "%files -n kmod-${kmod_name}${dashvariant}"
|
||||||
|
|
||||||
|
if [ "" == "$override_filelist" ];
|
||||||
|
then
|
||||||
|
echo "%defattr(644,root,root,755)"
|
||||||
|
echo "/lib/modules/${verrel}${dotvariant}"
|
||||||
|
else
|
||||||
|
cat "$override_filelist" | get_filelist
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
print_rpmtemplate ()
|
||||||
|
{
|
||||||
|
kmod_name="${1}"
|
||||||
|
shift
|
||||||
|
kver="${1}"
|
||||||
|
get_verrel "${1}"
|
||||||
|
shift
|
||||||
|
if [ -z "${kmod_name}" ] ; then
|
||||||
|
echo "Please provide the kmodule-name as first parameter." >&2
|
||||||
|
exit 2
|
||||||
|
elif [ -z "${kver}" ] ; then
|
||||||
|
echo "Please provide the kver as second parameter." >&2
|
||||||
|
exit 2
|
||||||
|
elif [ -z "${verrel}" ] ; then
|
||||||
|
echo "Couldn't find out the verrel." >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
for variant in "$@" ; do
|
||||||
|
if [ "default" == "$variant" ];
|
||||||
|
then
|
||||||
|
get_rpmtemplate ""
|
||||||
|
else
|
||||||
|
get_rpmtemplate "${variant}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
usage ()
|
||||||
|
{
|
||||||
|
cat <<EOF
|
||||||
|
You called: ${invocation}
|
||||||
|
|
||||||
|
Usage: ${myprog} <command> <option>+
|
||||||
|
Commands:
|
||||||
|
verrel <uname>
|
||||||
|
- Get "base" version-release.
|
||||||
|
variant <uname>
|
||||||
|
- Get variant from uname.
|
||||||
|
variant_char <uname> <variant>
|
||||||
|
- Get kernel variant separator character.
|
||||||
|
kernel_source <uname> <variant>
|
||||||
|
- Get path to kernel source directory.
|
||||||
|
rpmtemplate <mainpgkname> <uname> <variants>
|
||||||
|
- Return a template for use in a source RPM
|
||||||
|
version
|
||||||
|
- Output version number and exit.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
invocation="$(basename ${0}) $@"
|
||||||
|
while [ "${1}" ] ; do
|
||||||
|
case "${1}" in
|
||||||
|
verrel)
|
||||||
|
shift
|
||||||
|
print_verrel "$@"
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
variant)
|
||||||
|
shift
|
||||||
|
print_variant "$@"
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
variant_char)
|
||||||
|
shift
|
||||||
|
print_variant_char "$@"
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
kernel_source)
|
||||||
|
shift
|
||||||
|
print_kernel_source "$@"
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
rpmtemplate)
|
||||||
|
shift
|
||||||
|
print_rpmtemplate "$@"
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
version)
|
||||||
|
echo "${myprog} ${myver}"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Error: Unknown option '${1}'." >&2
|
||||||
|
usage >&2
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# mode: sh
|
||||||
|
# sh-indentation: 2
|
||||||
|
# indent-tabs-mode: nil
|
||||||
|
# End:
|
||||||
|
# ex: ts=2 sw=2 et
|
97
kmp-local-override.macros
Normal file
97
kmp-local-override.macros
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
# Use these macros to differentiate between RH and other KMP implementation(s).
|
||||||
|
redhat_kernel_module_package 1
|
||||||
|
kernel_module_package_release 1
|
||||||
|
|
||||||
|
redhat_kmp_has_post_hooks 1
|
||||||
|
|
||||||
|
%__brp_kmod_set_exec_bit /usr/lib/rpm/redhat/brp-kmod-set-exec-bit
|
||||||
|
%__brp_kmod_restore_perms /usr/lib/rpm/redhat/brp-kmod-restore-perms
|
||||||
|
|
||||||
|
%__kmod_brps_added 0
|
||||||
|
|
||||||
|
#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ]
|
||||||
|
# [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ...
|
||||||
|
|
||||||
|
%kernel_module_package_buildreqs %global kmodtool_generate_buildreqs 1 \
|
||||||
|
kernel-devel redhat-rpm-config kernel-rpm-macros elfutils-libelf-devel kmod
|
||||||
|
|
||||||
|
%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \
|
||||||
|
## An ugly hack: we want kmods to be processed by find-debuginfo,
|
||||||
|
## but it processes only files with executable permission set.
|
||||||
|
## It is important now since, as of now, if debuginfo package
|
||||||
|
## is enabled (and it is enabled), there's an RPM build error
|
||||||
|
## as a result of lack of ether absence or emptiness of
|
||||||
|
## debugsourcefiles.list (which is likely a bug in RPM, but it looks
|
||||||
|
## like that there's no obvious fix and apparently no one have
|
||||||
|
## any issues with this).
|
||||||
|
## In order to minimise intrusiveness, usually (in Red Hat-built kmod
|
||||||
|
## RPMs) *.ko files just have executable permission being set as a part
|
||||||
|
## of %build section. There are two caveats with kmp, however:
|
||||||
|
## * We have no control over %build section itself (and it wasn't
|
||||||
|
## required previously)
|
||||||
|
## * Changing the criteria used in find-debuginfo.sh/brp-strip
|
||||||
|
## for selecting files that have to undergo debug section separation
|
||||||
|
## may introduce regression.
|
||||||
|
## As a result, we insert additional hooks in __spec_install_post
|
||||||
|
## (__brp_kmod_set_exec_bit in the beginning and
|
||||||
|
## __brp_kmod_restore_perms in the end) that (temporarily) set
|
||||||
|
## executable permission for *.ko files so find-debuginfo.sh will pick
|
||||||
|
## them up.
|
||||||
|
## Unfortunately, __spec_install_post's body is copied here since
|
||||||
|
## we want that __debug_package macro expansion has been performed
|
||||||
|
## lazily and it looks like RPM has no ability to provide a body
|
||||||
|
## of a macro verbatim.
|
||||||
|
if [ 0 = "%{__kmod_brps_added}" ]; then \
|
||||||
|
echo "%%global __spec_install_post \\\\" \
|
||||||
|
echo " %%{?__brp_kmod_set_exec_bit} \\\\" \
|
||||||
|
echo " %%%%{?__debug_package:%%%%{__debug_install_post}} \\\\" \
|
||||||
|
echo " %%{__arch_install_post} \\\\" \
|
||||||
|
echo " %%{__os_install_post} \\\\" \
|
||||||
|
echo " %%{?__brp_kmod_pre_sign_process} \\\\" \
|
||||||
|
echo " %%{?__brp_kmod_sign} \\\\" \
|
||||||
|
echo " %%{?__brp_kmod_post_sign_process} \\\\" \
|
||||||
|
echo " %%{?__brp_kmod_compress} \\\\" \
|
||||||
|
echo " %%{?__brp_kmod_post_compress_process} \\\\" \
|
||||||
|
echo " %%{?__brp_kmod_restore_perms} \\\\" \
|
||||||
|
echo "%%{nil}" \
|
||||||
|
fi \
|
||||||
|
%global __kmod_brps_added 1 \
|
||||||
|
%global kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
|
||||||
|
%global kmod_version %{-v*}%{!-v:%{version}} \
|
||||||
|
%global kmod_release %{-r*}%{!-r:%{release}} \
|
||||||
|
%global latest_kernel %({ rpm -q --qf '%%{VERSION}-%%{RELEASE}.%%{ARCH}\\\\n' `rpm -qa | egrep "^kernel(-64k|-rt|-aarch64)?-devel" | /usr/lib/rpm/redhat/rpmsort -r | head -n 1`; echo '%%%%{nil}'; } | head -n 1) \
|
||||||
|
%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
|
||||||
|
%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
|
||||||
|
flavors="default" \
|
||||||
|
if [ "$(arch)" = "aarch64" ]; then \
|
||||||
|
flavors="$flavors 64k" \
|
||||||
|
fi \
|
||||||
|
if [ -z "%*" ]; then \
|
||||||
|
flavors_to_build=$flavors \
|
||||||
|
elif [ -z "%{-x}" ]; then \
|
||||||
|
flavors_to_build="%*" \
|
||||||
|
else \
|
||||||
|
flavors_to_build=" $flavors "\
|
||||||
|
for i in %* \
|
||||||
|
do \
|
||||||
|
flavors_to_build=${flavors_to_build//$i /}
|
||||||
|
done \
|
||||||
|
fi \
|
||||||
|
echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
|
||||||
|
echo "%%global kernel_source() \\\$([ default = \"%%%%{1}\" ] && echo \"/usr/src/kernels//%%%%kverrel\" || %{kmodtool} kernel_source \"%%%%{kverrel}\" \"%%%%{1}\" 2>/dev/null || { ls -Ud \"/usr/src/kernels///%%%%{kverrel}\"[.+]\"%%%%{1}\" | sort -V | tail -n 1; } || echo \"/usr/src/kernels////%%%%kverrel.%%%%1\")" \
|
||||||
|
echo "%%global kernel_module_package_moddir() extra" \
|
||||||
|
if [ ! -z "%{-f*}" ] \
|
||||||
|
then \
|
||||||
|
filelist="%{-f*}" \
|
||||||
|
fi \
|
||||||
|
if [ ! -z "%{-p*}" ] \
|
||||||
|
then \
|
||||||
|
preamble="%{-p*}" \
|
||||||
|
fi \
|
||||||
|
nobuildreqs="yes" \
|
||||||
|
if [ "x%{kmodtool_generate_buildreqs}" != "x1" ] \
|
||||||
|
then \
|
||||||
|
nobuildreqs="no" \
|
||||||
|
fi \
|
||||||
|
override_filelist="$filelist" override_preamble="$preamble" nobuildreqs="$nobuildreqs" kmod_version=%kmod_version kmod_release=%kmod_release %{kmodtool} rpmtemplate %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
|
||||||
|
)}
|
113
nvidia-open-kmod.spec
Normal file
113
nvidia-open-kmod.spec
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
# Backport missing architecture macros
|
||||||
|
%{!?x86_64: %global x86_64 x86_64 amd64 em64t}
|
||||||
|
%{!?arm64: %global arm64 aarch64}
|
||||||
|
|
||||||
|
# Because Red Hat broke this macro by not including kernel-rpm-macros in the base buildroot
|
||||||
|
%{!?kernel_module_package_buildreqs:%global kernel_module_package_buildreqs kernel-devel kernel-abi-stablelists redhat-rpm-config kernel-rpm-macros elfutils-libelf-devel kmod}
|
||||||
|
|
||||||
|
# Don't enable auto set build flags
|
||||||
|
# We get flags from the kernel
|
||||||
|
%undefine _auto_set_build_flags
|
||||||
|
|
||||||
|
# Kernel package flavors
|
||||||
|
## TODO: Fix kernel packaging macros to handle debug kernel flavor builds
|
||||||
|
%dnl %global kernel_extra_flavor_devel_packages kernel-debug-devel
|
||||||
|
%ifarch %{arm64}
|
||||||
|
%dnl %global kernel_extra_flavor_devel_packages %{?kernel_extra_flavor_devel_packages} kernel-64k-devel kernel-64k-debug-devel
|
||||||
|
%global kernel_extra_flavor_devel_packages %{?kernel_extra_flavor_devel_packages} kernel-64k-devel
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%global kmodname nvidia-open
|
||||||
|
|
||||||
|
|
||||||
|
Name: %{kmodname}-kmod
|
||||||
|
Version: 570.153.02
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Kernel module (kmod) for NVIDIA GPU hardware
|
||||||
|
|
||||||
|
License: GPL-2.0-only and MIT
|
||||||
|
URL: https://github.com/NVIDIA/open-gpu-kernel-modules
|
||||||
|
Source0: %{url}/archive/%{version}/open-gpu-kernel-modules-%{version}.tar.gz
|
||||||
|
|
||||||
|
Patch0: 0001-kernel-open-nvidia-drm-Enable-kernel-mode-setting-by.patch
|
||||||
|
|
||||||
|
# For kmodtool
|
||||||
|
Source10: kmod-%{kmodname}.spec.preamble
|
||||||
|
|
||||||
|
# For locally fixed macros to handle kernel flavors properly
|
||||||
|
Source20: kmp-local-override.macros
|
||||||
|
Source21: kmodtool-local-override
|
||||||
|
|
||||||
|
# patch dependencies
|
||||||
|
BuildRequires: git-core
|
||||||
|
|
||||||
|
# kernel module package macros were split out sometime after EL7...
|
||||||
|
BuildRequires: kernel-rpm-macros
|
||||||
|
# kmod dependencies
|
||||||
|
BuildRequires: %kernel_module_package_buildreqs
|
||||||
|
%{?kernel_extra_flavor_devel_packages:BuildRequires: %kernel_extra_flavor_devel_packages}
|
||||||
|
BuildRequires: gettext-envsubst
|
||||||
|
BuildRequires: gcc
|
||||||
|
BuildRequires: gcc-c++
|
||||||
|
BuildRequires: make
|
||||||
|
|
||||||
|
# Depend on negativo17 kmod support packaging
|
||||||
|
Requires: nvidia-kmod-common = 3:%{version}
|
||||||
|
|
||||||
|
# Only supported architectures for the driver
|
||||||
|
ExclusiveArch: %{x86_64} %{arm64}
|
||||||
|
|
||||||
|
# Load override macros
|
||||||
|
%{load:%{S:20}}
|
||||||
|
|
||||||
|
%{?kernel_module_package:%kernel_module_package -s %{S:21} -n %{kmodname} -p %{S:10}}
|
||||||
|
|
||||||
|
%description
|
||||||
|
This package contains the kernel modules for providing
|
||||||
|
hardware support for the NVIDIA Turing (GTX 16/RTX 20)
|
||||||
|
and newer models of GPU hardware.
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n open-gpu-kernel-modules-%{version} -S git_am
|
||||||
|
|
||||||
|
|
||||||
|
for flavor in %{flavors_to_build}; do
|
||||||
|
cp -a ../open-gpu-kernel-modules-%{version} ../%{name}-%{version}-kmodbuild-$flavor
|
||||||
|
mv ../%{name}-%{version}-kmodbuild-$flavor .
|
||||||
|
done
|
||||||
|
|
||||||
|
%build
|
||||||
|
# This module is useless
|
||||||
|
export NV_EXCLUDE_KERNEL_MODULES=nvidia-peermem
|
||||||
|
for flavor in %{flavors_to_build}; do
|
||||||
|
pushd %{name}-%{version}-kmodbuild-$flavor
|
||||||
|
export SYSSRC=%{kernel_source $flavor}
|
||||||
|
%make_build modules
|
||||||
|
popd
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
%install
|
||||||
|
# Set correct install paths
|
||||||
|
export INSTALL_MOD_PATH=%{buildroot}
|
||||||
|
export INSTALL_MOD_DIR=extra/%{kmodname}
|
||||||
|
# This module is useless
|
||||||
|
export NV_EXCLUDE_KERNEL_MODULES=nvidia-peermem
|
||||||
|
for flavor in %{flavors_to_build}; do
|
||||||
|
pushd %{name}-%{version}-kmodbuild-$flavor
|
||||||
|
export SYSSRC=%{kernel_source $flavor}
|
||||||
|
%{__make} V=1 modules_install
|
||||||
|
popd
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license COPYING
|
||||||
|
%doc README.md
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon May 26 2025 Neal Gompa <ngompa@almalinux.org> - 570.153.02-1
|
||||||
|
- Initial package
|
||||||
|
|
Loading…
Reference in New Issue
Block a user