source renamed from nvidia-470 to nvidia_470 to workaround internal management issues

add sddm configuration to ensure sddm itself and plasma session use X11
run dkms add and install for any found kernel version [release 470.256.02-4mamba;Sat Feb 22 2025]
This commit is contained in:
Silvan Calarco 2025-02-23 11:26:18 +01:00
parent b11ff9520f
commit 22e3d5827f
12 changed files with 422 additions and 130 deletions

View File

@ -1,6 +1,7 @@
# nvidia_470
nvidia proprietary accelerated drivers for the Linux Kernel.
These packages contains parts that are not (fully) released under GPL license.
These modules are packaged apart from the main kernel modules because they are not fully released as GPL. This means that some modules might have been built from binary objects distributed by the hardware manufacturer. By loading this modules you will "taint" the kernel, which means that your running system won't be 100% GPL.
The NVIDIA Accelerated Linux Driver Set brings both accelerated 2D functionality and high performance OpenGL support to Linux x86 with theuse of NVIDIA graphics processing units (GPUs).
These drivers provide optimized hardware acceleration of OpenGL applications via a direct-rendering X Server and support nearly all NVIDIA graphics chips.
TwinView, TV-Out and flat panel displays are also supported.
This package contains the Xorg libraries, DKMS kernel driver and all the NVIDIA libraries.

View File

@ -1,30 +0,0 @@
diff -Nru NVIDIA-Linux-x86-331.20.orig/kernel/conftest.sh NVIDIA-Linux-x86-331.20/kernel/conftest.sh
--- NVIDIA-Linux-x86-331.20.orig/kernel/conftest.sh 2013-10-31 01:30:27.000000000 +0100
+++ NVIDIA-Linux-x86-331.20/kernel/conftest.sh 2013-12-02 01:03:17.234157468 +0100
@@ -175,7 +175,7 @@
if [ "$OUTPUT" != "$SOURCES" ]; then
MACH_CFLAGS="-I$HEADERS/asm-$ARCH/mach-default"
- if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+ if [ "$ARCH" = "x86" -o "$ARCH" = "x86_64" ]; then
MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/arch/x86/include/uapi"
@@ -189,7 +189,7 @@
fi
else
MACH_CFLAGS="-I$HEADERS/asm/mach-default"
- if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+ if [ "$ARCH" = "x86" -o "$ARCH" = "x86_64" ]; then
MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/arch/x86/include/uapi"
@@ -206,7 +206,7 @@
CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS $AUTOCONF_CFLAGS"
CFLAGS="$CFLAGS -I$HEADERS -I$HEADERS/uapi -I$OUTPUT/include/generated/uapi"
- if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+ if [ "$ARCH" = "x86" -o "$ARCH" = "x86_64" ]; then
CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include"
CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include/uapi"
CFLAGS="$CFLAGS -I$OUTPUT/arch/x86/include/generated"

View File

@ -1,42 +0,0 @@
--- a/kernel/nvidia-drm/nvidia-drm-fb.c 2016-05-17 19:36:45.210422962 +0700
+++ b/kernel/nvidia-drm/nvidia-drm-fb.c 2016-05-17 19:43:19.621579825 +0700
@@ -77,7 +77,7 @@
static struct drm_framebuffer *internal_framebuffer_create
(
struct drm_device *dev,
- struct drm_file *file, struct drm_mode_fb_cmd2 *cmd,
+ struct drm_file *file, const struct drm_mode_fb_cmd2 *cmd,
uint64_t nvkms_params_ptr,
uint64_t nvkms_params_size
)
@@ -199,7 +199,7 @@
struct drm_framebuffer *nvidia_drm_framebuffer_create
(
struct drm_device *dev,
- struct drm_file *file, struct drm_mode_fb_cmd2 *cmd
+ struct drm_file *file, const struct drm_mode_fb_cmd2 *cmd
)
{
return internal_framebuffer_create(dev, file, cmd, 0, 0);
--- a/kernel/nvidia-drm/nvidia-drm-fb.h 2016-05-17 19:36:45.210422962 +0700
+++ b/kernel/nvidia-drm/nvidia-drm-fb.h 2016-05-17 19:36:48.517069977 +0700
@@ -45,7 +45,7 @@
struct drm_framebuffer *nvidia_drm_framebuffer_create
(
struct drm_device *dev,
- struct drm_file *file, struct drm_mode_fb_cmd2 *cmd
+ struct drm_file *file, const struct drm_mode_fb_cmd2 *cmd
);
int nvidia_drm_add_nvkms_fb(
--- a/kernel/nvidia-drm/nvidia-drm-linux.c 2016-05-17 19:36:45.210422962 +0700
+++ b/kernel/nvidia-drm/nvidia-drm-linux.c 2016-05-17 19:42:18.677163127 +0700
@@ -121,7 +121,7 @@
down_read(&mm->mmap_sem);
- pages_pinned = get_user_pages(current, mm,
+ pages_pinned = get_user_pages_remote(current, mm,
address, pages_count, write, force,
user_pages, NULL);
up_read(&mm->mmap_sem);

View File

@ -0,0 +1,25 @@
From: Benjamin ROBIN <dev@benjarobin.fr>
Date: Sun, 12 May 2024 17:45:43 +0200
Subject: [PATCH 2/3] Fix conftest to use a short wchar_t
Fix build error about ``const efi_char16_t *v = L"SecureBoot"``
when including include/linux/efi.h
---
conftest.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conftest.sh b/conftest.sh
--- a/conftest.sh
+++ b/conftest.sh
@@ -101,7 +101,7 @@ test_header_presence() {
build_cflags() {
BASE_CFLAGS="-O2 -D__KERNEL__ \
-DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \
--nostdinc -isystem $ISYSTEM \
+-nostdinc -isystem $ISYSTEM -fshort-wchar \
-Wno-implicit-function-declaration -Wno-strict-prototypes \
-Wno-incompatible-pointer-types"
if [ "$OUTPUT" != "$SOURCES" ]; then
---
2.45.0

View File

@ -0,0 +1,30 @@
From: Benjamin ROBIN <dev@benjarobin.fr>
Date: Sun, 12 May 2024 17:54:18 +0200
Subject: [PATCH 3/3] Fix conftest to use nv_drm_gem_vmap() which has the
secondary map argument
See https://forums.developer.nvidia.com/t/nvidia-modules-build-failure-with-upcoming-gcc-14-and-recent-kernels-due-to-misfiring-conftest-sh-test-heads-up/279072
---
conftest.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/conftest.sh b/conftest.sh
--- a/conftest.sh
+++ b/conftest.sh
@@ -4593,8 +4593,13 @@ compile_test() {
#
CODE="
#include <drm/drm_gem.h>
+ #if defined(NV_LINUX_IOSYS_MAP_H_PRESENT)
+ typedef struct iosys_map nv_sysio_map_t;
+ #else
+ typedef struct dma_buf_map nv_sysio_map_t;
+ #endif
int conftest_drm_gem_object_vmap_has_map_arg(
- struct drm_gem_object *obj, struct dma_buf_map *map) {
+ struct drm_gem_object *obj, nv_sysio_map_t *map) {
return obj->funcs->vmap(obj, map);
}"
---
2.45.0

View File

@ -0,0 +1,27 @@
From: Benjamin ROBIN <dev@benjarobin.fr>
Date: Sun, 12 May 2024 17:06:20 +0200
Subject: [PATCH 1/3] Fix conftest to ignore implicit-function-declaration and
strict-prototypes warnings
conftest rely on the fact that a missing prototype should build, but an invalid
call to a function (missing function parameters) the build fail.
---
conftest.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/conftest.sh b/conftest.sh
--- a/conftest.sh
+++ b/conftest.sh
@@ -101,7 +101,9 @@ test_header_presence() {
build_cflags() {
BASE_CFLAGS="-O2 -D__KERNEL__ \
-DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \
--nostdinc -isystem $ISYSTEM"
+-nostdinc -isystem $ISYSTEM \
+-Wno-implicit-function-declaration -Wno-strict-prototypes \
+-Wno-incompatible-pointer-types"
if [ "$OUTPUT" != "$SOURCES" ]; then
OUTPUT_CFLAGS="-I$OUTPUT/include2 -I$OUTPUT/include"
---
2.45.0

View File

@ -0,0 +1,61 @@
diff -ruNb a/kernel/conftest.sh b/kernel/conftest.sh
--- a/conftest.sh 2024-07-19 04:36:26.183701185 -0500
+++ b/conftest.sh 2024-07-19 04:36:26.230366381 -0500
@@ -4464,20 +4464,22 @@
compile_check_conftest "$CODE" "NV_DRM_GEM_OBJECT_VMAP_HAS_MAP_ARG" "" "types"
;;
- unsafe_follow_pfn)
+ follow_pfn)
#
- # Determine if unsafe_follow_pfn() is present.
+ # Determine if follow_pfn() is present.
#
- # unsafe_follow_pfn() was added by commit 69bacee7f9ad
- # ("mm: Add unsafe_follow_pfn") in v5.13-rc1.
+ # follow_pfn() was added by commit 3b6748e2dd69
+ # ("mm: introduce follow_pfn()") in v2.6.31-rc1, and removed
+ # by commit 233eb0bf3b94 ("mm: remove follow_pfn")
+ # from linux-next 233eb0bf3b94.
#
CODE="
#include <linux/mm.h>
- void conftest_unsafe_follow_pfn(void) {
- unsafe_follow_pfn();
+ void conftest_follow_pfn(void) {
+ follow_pfn();
}"
- compile_check_conftest "$CODE" "NV_UNSAFE_FOLLOW_PFN_PRESENT" "" "functions"
+ compile_check_conftest "$CODE" "NV_FOLLOW_PFN_PRESENT" "" "functions"
;;
drm_plane_atomic_check_has_atomic_state_arg)
diff -ruNb a/kernel/nvidia/nvidia.Kbuild b/kernel/nvidia/nvidia.Kbuild
--- a/nvidia/nvidia.Kbuild 2022-10-12 04:29:57.000000000 -0500
+++ b/nvidia/nvidia.Kbuild 2024-07-19 05:17:39.148448922 -0500
@@ -164,7 +164,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += cc
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iterate_fd
NV_CONFTEST_FUNCTION_COMPILE_TESTS += seq_read_iter
NV_CONFTEST_FUNCTION_COMPILE_TESTS += sg_page_iter_page
-NV_CONFTEST_FUNCTION_COMPILE_TESTS += unsafe_follow_pfn
+NV_CONFTEST_FUNCTION_COMPILE_TESTS += follow_pfn
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_gem_object_get
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_gem_object_put_unlocked
NV_CONFTEST_FUNCTION_COMPILE_TESTS += set_close_on_exec
diff -ruNb a/kernel/nvidia/os-mlock.c b/kernel/nvidia/os-mlock.c
--- a/nvidia/os-mlock.c 2022-10-12 04:30:26.000000000 -0500
+++ b/nvidia/os-mlock.c 2024-07-19 04:36:26.230366381 -0500
@@ -18,10 +18,10 @@
unsigned long address,
unsigned long *pfn)
{
-#if defined(NV_UNSAFE_FOLLOW_PFN_PRESENT)
- return unsafe_follow_pfn(vma, address, pfn);
-#else
+#if defined(NV_FOLLOW_PFN_PRESENT)
return follow_pfn(vma, address, pfn);
+#else
+ return -1;
#endif
}

View File

@ -0,0 +1,111 @@
From 839b964bd5be20275a4d1add020e68e407380adb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= <joanbrugueram@gmail.com>
Date: Sat, 17 Aug 2024 14:26:04 +0000
Subject: [PATCH] Tentative fix for NVIDIA 470.256.02 driver for Linux 6.12-rc1
Note that the fix requires enabling DRM kernel mode setting
(add the `nvidia-drm.modeset=1` parameter to the kernel command line).
(Thanks xtexChooser for the memory management fixes!)
---
nvidia-drm/nvidia-drm-drv.c | 47 +++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/nvidia-drm/nvidia-drm-drv.c b/nvidia-drm/nvidia-drm-drv.c
index f350134..d6233a5 100644
--- a/nvidia-drm/nvidia-drm-drv.c
+++ b/nvidia-drm/nvidia-drm-drv.c
@@ -84,6 +84,11 @@
#include <drm/drm_atomic_helper.h>
#endif
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
+#include <drm/drm_client.h>
+#endif
+
static struct nv_drm_device *dev_list = NULL;
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
@@ -168,7 +173,12 @@ static const struct drm_mode_config_funcs nv_mode_config_funcs = {
.atomic_check = nv_drm_atomic_check,
.atomic_commit = nv_drm_atomic_commit,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
+ // Rel. commit. "drm: Remove struct drm_mode_config_funcs.output_poll_changed" (Thomas Zimmermann, 12 Aug 2024)
+ // Replace this callback with a DRM client's hotplug callback.
+ // This is required for e.g. /sys/class/drm/card*/modes to work.
.output_poll_changed = nv_drm_output_poll_changed,
+#endif
};
static void nv_drm_event_callback(const struct NvKmsKapiEvent *event)
@@ -739,6 +749,10 @@ static const struct file_operations nv_drm_fops = {
.read = drm_read,
.llseek = noop_llseek,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
+ // Rel. commit. "fs: move FMODE_UNSIGNED_OFFSET to fop_flags" (Christian Brauner, 9 Aug 2024)
+ .fop_flags = FOP_UNSIGNED_OFFSET,
+#endif
};
static const struct drm_ioctl_desc nv_drm_ioctls[] = {
@@ -906,7 +920,18 @@ static void nv_drm_update_drm_driver_features(void)
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
+static int hotplug_helper_client_hotplug(struct drm_client_dev *client)
+{
+ nv_drm_output_poll_changed(client->dev);
+ return 0;
+}
+static const struct drm_client_funcs nv_hotplug_helper_client_funcs = {
+ .owner = THIS_MODULE,
+ .hotplug = hotplug_helper_client_hotplug,
+};
+#endif
/*
* Helper function for allocate/register DRM device for given NVIDIA GPU ID.
@@ -962,6 +987,20 @@ static void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
goto failed_drm_register;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
+ /* Register a DRM client for receiving hotplug events */
+ struct drm_client_dev *client = kzalloc(sizeof(*client), GFP_KERNEL);
+ if (client == NULL || drm_client_init(dev, client,
+ "nv-hotplug-helper", &nv_hotplug_helper_client_funcs)) {
+ printk(KERN_WARNING "Failed to initialize the nv-hotplug-helper DRM client"
+ " (ensure DRM kernel mode setting is enabled via nvidia-drm.modeset=1).\n");
+ goto failed_drm_client_init;
+ }
+
+ drm_client_register(client);
+ pr_info("Registered the nv-hotplug-helper DRM client.\n");
+#endif
+
/* Add NVIDIA-DRM device into list */
nv_dev->next = dev_list;
@@ -969,6 +1008,14 @@ static void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
return; /* Success */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0)
+failed_drm_client_init:
+
+ kfree(client);
+ drm_dev_unregister(dev);
+
+#endif
+
failed_drm_register:
nv_drm_dev_free(dev);
--
2.47.0

View File

@ -0,0 +1,58 @@
From 9f91b171f680648647580c163bbc9cc1641e3920 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= <joanbrugueram@gmail.com>
Date: Sat, 16 Nov 2024 22:45:21 +0000
Subject: [PATCH] Tentative fix for NVIDIA 470.256.02 driver for Linux 6.13-rc1
---
nvidia-modeset/nvidia-modeset.Kbuild | 8 +++++---
nvidia/nvidia.Kbuild | 8 +++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/nvidia-modeset/nvidia-modeset.Kbuild b/nvidia-modeset/nvidia-modeset.Kbuild
index a7d84e0..d417c28 100644
--- a/nvidia-modeset/nvidia-modeset.Kbuild
+++ b/nvidia-modeset/nvidia-modeset.Kbuild
@@ -40,13 +40,15 @@ NV_KERNEL_MODULE_TARGETS += $(NVIDIA_MODESET_KO)
NVIDIA_MODESET_BINARY_OBJECT := $(src)/nvidia-modeset/nv-modeset-kernel.o_binary
NVIDIA_MODESET_BINARY_OBJECT_O := nvidia-modeset/nv-modeset-kernel.o
-quiet_cmd_symlink = SYMLINK $@
-cmd_symlink = ln -sf $< $@
+# Rel. commit 80f289101690 "kbuild: change working directory to external module directory with M=" (Masahiro Yamada, 10 Nov 2024)
+# Ensure `$<` is absolute, since the link target is resolved relative to its path, not from where `ln` is run from.
+quiet_cmd_symlinkabs = SYMLINK $@
+ cmd_symlinkabs = ln -sf $(abspath $<) $@
targets += $(NVIDIA_MODESET_BINARY_OBJECT_O)
$(obj)/$(NVIDIA_MODESET_BINARY_OBJECT_O): $(NVIDIA_MODESET_BINARY_OBJECT) FORCE
- $(call if_changed,symlink)
+ $(call if_changed,symlinkabs)
nvidia-modeset-y += $(NVIDIA_MODESET_BINARY_OBJECT_O)
diff --git a/nvidia/nvidia.Kbuild b/nvidia/nvidia.Kbuild
index 31a6f92..62689f6 100644
--- a/nvidia/nvidia.Kbuild
+++ b/nvidia/nvidia.Kbuild
@@ -40,13 +40,15 @@ NVIDIA_KO = nvidia/nvidia.ko
NVIDIA_BINARY_OBJECT := $(src)/nvidia/nv-kernel.o_binary
NVIDIA_BINARY_OBJECT_O := nvidia/nv-kernel.o
-quiet_cmd_symlink = SYMLINK $@
- cmd_symlink = ln -sf $< $@
+# Rel. commit 80f289101690 "kbuild: change working directory to external module directory with M=" (Masahiro Yamada, 10 Nov 2024)
+# Ensure `$<` is absolute, since the link target is resolved relative to its path, not from where `ln` is run from.
+quiet_cmd_symlinkabs = SYMLINK $@
+ cmd_symlinkabs = ln -sf $(abspath $<) $@
targets += $(NVIDIA_BINARY_OBJECT_O)
$(obj)/$(NVIDIA_BINARY_OBJECT_O): $(NVIDIA_BINARY_OBJECT) FORCE
- $(call if_changed,symlink)
+ $(call if_changed,symlinkabs)
nvidia-y += $(NVIDIA_BINARY_OBJECT_O)
--
2.47.0

17
nvidia-fallback.service Normal file
View File

@ -0,0 +1,17 @@
[Unit]
Description=Fallback to nouveau as nvidia did not load
After=akmods.service
Before=display-manager.service
ConditionKernelCommandLine=rd.driver.blacklist=nouveau
ConditionPathExists=!/sys/module/nvidia
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/sbin/modprobe nouveau
ExecStartPost=-/bin/plymouth message --text="NVIDIA kernel module missing. Falling back to nouveau"
[Install]
WantedBy=graphical.target

6
nvidia_470-sddm.conf Normal file
View File

@ -0,0 +1,6 @@
[General]
DisplayServer=x11
Session=plasmax11
[Autologin]
Session=plasmmax11

View File

@ -1,9 +1,9 @@
%define nvidia_current_ver %version
%define nvidia_current_libver %version
Name: nvidia_470
Version: 470.199.02
Version: 470.256.02
Epoch: 1
Release: 1mamba
Release: 4mamba
Summary: NVIDIA proprietary accelerated drivers for the Linux Kernel
Group: System/Kernel and Hardware
Vendor: openmamba
@ -13,38 +13,37 @@ URL: https://www.nvidia.com/en-us/drivers/unix/
Source0: http://us.download.nvidia.com/XFree86/Linux-x86_64/%{nvidia_current_ver}/NVIDIA-Linux-x86_64-%{nvidia_current_ver}.run
Source1: nvidia.sysusers
Source2: nvidia-drm-outputclass.conf
Patch0: nvidia-331.20-x86-conftest.patch
Patch1: nvidia-367.35-kernel-4.6.patch
Patch2: nvidia_470-470.161.03-kernel-6.4.patch
Patch3: nvidia_470-470.161.03-ignore_cc_mismatch.patch
Source3: nvidia-fallback.service
Source4: nvidia_470-sddm.conf
Patch0: nvidia_470-470.161.03-kernel-6.4.patch
Patch1: nvidia_470-470.161.03-ignore_cc_mismatch.patch
Patch2: nvidia-470-470.256.02-conftest-to-ignore-implicit-function-declaration.patch
Patch3: nvidia-470-470.256.02-Fix-conftest-to-use-a-short-wchar_t..patch
Patch4: nvidia-470-470.256.02-Fix-conftest-to-use-nv_drm_gem_vmap-which-has-the-se.patch
Patch5: nvidia-470-470.256.02-kernel-6.10.patch
Patch6: nvidia-470-470.256.02-kernel-6.12.patch
Patch7: nvidia-470-470.256.02-kernel-6.13.patch
License: no OSI Approved
ExclusiveArch: x86_64
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libX11-devel
BuildRequires: libXext-devel
BuildRequires: libat-spi2-core-devel
BuildRequires: libcairo-devel
BuildRequires: libegl-wayland-devel
BuildRequires: libgcc
BuildRequires: libgdk-pixbuf-devel
BuildRequires: libglib-devel
BuildRequires: libglvnd-devel
BuildRequires: libgtk3-devel
BuildRequires: libpango-devel
BuildRequires: libwayland-devel
## AUTOBUILDREQ-END
ExclusiveArch: x86_64
%description
nvidia proprietary accelerated drivers for the Linux Kernel.
These packages contains parts that are not (fully) released under GPL license.
These modules are packaged apart from the main kernel modules because they are not fully released as GPL. This means that some modules might have been built from binary objects distributed by the hardware manufacturer. By loading this modules you will "taint" the kernel, which means that your running system won't be 100% GPL.
%package -n xorg-drv-video-%{name}
Group: System/Kernel and Hardware
Summary: NVIDIA Accelerated Libraries for Xorg
Requires: xorg-server >= 1.1.0
Requires(post):kernelheaders
Requires(post):dkms
Provides: xorg-drv-video-nvidia_470
Obsoletes: xorg-drv-video-nvidia_470 <= 1:470.199.02-1mamba
Obsoletes: nvidia-470 <= 1:470.256.02-3mamba
Provides: Xorg-nvidia
Provides: xorgdrvvideo
Provides: kernelnvidia
@ -54,29 +53,33 @@ Conflicts: xorg-drv-video-nvidia_390
Conflicts: libGL-nvidia_304-X11
Conflicts: libGL-nvidia_340-X11
Conflicts: libGL-nvidia_390-X11
Provides: libGL-%{name}-X11
Provides: libGL-nvidia_470-X11
Provides: libGL-nvidia-470-X11
Conflicts: xorg-ext-libglx-nvidia_304
Conflicts: xorg-ext-libglx-nvidia_340
Conflicts: xorg-ext-libglx-nvidia_390
Conflicts: xorg-apps-nvidia_304
Conflicts: xorg-apps-nvidia_340
Conflicts: xorg-apps-nvidia_390
Conflicts: nvidia
%description -n xorg-drv-video-%{name}
%description
The NVIDIA Accelerated Linux Driver Set brings both accelerated 2D functionality and high performance OpenGL support to Linux x86 with theuse of NVIDIA graphics processing units (GPUs).
These drivers provide optimized hardware acceleration of OpenGL applications via a direct-rendering X Server and support nearly all NVIDIA graphics chips.
TwinView, TV-Out and flat panel displays are also supported.
This package contains the Xorg libraries, DKMS kernel driver and all the NVIDIA libraries.
%package -n xorg-drv-video-%{name}-doc
Group: Documentation
Summary: HTML documentation for NVIDIA Accelerated Libraries for Xorg
%package doc
Group: Documentation
Summary: HTML documentation for NVIDIA Accelerated Libraries for Xorg
Conflicts: xorg-drv-video-nvidia_304-doc
Conflicts: xorg-drv-video-nvidia_340-doc
Conflicts: xorg-drv-video-nvidia_390-doc
Obsoletes: xorg-drv-video-nvidia_450-doc <= 1:460.39
Obsoletes: xorg-drv-video-nvidia_470-doc <= 1:470.199.02-1mamba
Obsoletes: nvidia-470-doc <= 1:470.256.02-3mamba
%description -n xorg-drv-video-%{name}-doc
%description doc
The NVIDIA Accelerated Linux Driver Set brings both accelerated 2D functionality and high performance OpenGL support to Linux x86 with theuse of NVIDIA graphics processing units (GPUs).
These drivers provide optimized hardware acceleration of OpenGL applications via a direct-rendering X Server and support nearly all NVIDIA graphics chips.
TwinView, TV-Out and flat panel displays are also supported.
@ -85,6 +88,8 @@ This package contains the HTML documentation.
# Turn off strip'ng of binaries
%global __strip /bin/true
%define debug_package %{nil}
%prep
%setup -q -c -n %{name}-%{version} -T
@ -101,12 +106,15 @@ sed -i "s|__UTILS_PATH__|%{_bindir}|;s|__PIXMAP_PATH__|%{_datadir}/pixmaps|" \
current/nvidia-settings.desktop
cd current
#%patch0 -p1
#%patch1 -p1
cd kernel
%patch 2 -p1 -b .kernel-6.4
%patch 2 -p1 -b .conftest-to-ignore-implicit-function-declaration
%patch 3 -p1 -b .Fix-conftest-to-use-a-short-wchar_t.
%patch 4 -p1 -b .Fix-conftest-to-use-nv_drm_gem_vmap-which-has-the-se
%patch 5 -p1 -b .kernel-4.10
%patch 6 -p1 -b .kernel-6.12
%patch 7 -p1 -b .kernel-6.13
cd ..
%patch 3 -p1
%patch 1 -p1
tar xf nvidia-persistenced-init.tar.bz2
cd ..
@ -121,11 +129,11 @@ pushd current
# X driver
install -D -m755 nvidia_drv.so %{buildroot}%{_libdir}/xorg/modules/drivers/nvidia_drv.so
## Wayland/GBM
#install -D -m755 libnvidia-egl-gbm.so.1* -t %{buildroot}%{_libdir}/
#install -D -m644 15_nvidia_gbm.json %{buildroot}%{_datadir}/egl/egl_external_platform.d/15_nvidia_gbm.json
#mkdir -p %{buildroot}%{_libdir}/gbm
#ln -sr ../libnvidia-allocator.so.%{version} %{buildroot}%{_libdir}/gbm/nvidia-drm_gbm.so
# Wayland/GBM
install -D -m755 libnvidia-egl-wayland.so.1* -t %{buildroot}%{_libdir}/
install -D -m644 10_nvidia_wayland.json %{buildroot}%{_datadir}/egl/egl_external_platform.d/10_nvidia_wayland.json
mkdir -p %{buildroot}%{_libdir}/gbm
ln -s ../libnvidia-allocator.so.%{version} %{buildroot}%{_libdir}/gbm/nvidia-drm_gbm.so
# firmware
install -D -m644 -t %{buildroot}%{_prefix}/lib/firmware/nvidia/%{version}/ firmware/*.bin
@ -156,7 +164,7 @@ install -D -m755 libnvidia-compiler.so.%{version} %{buildroot}%{_libdir}/libnvid
install -D -m755 libnvidia-opencl.so.%{version} %{buildroot}%{_libdir}/libnvidia-opencl.so.%{version}
# misc
#install -D -m755 libnvidia-ifr.so.%{version} %{buildroot}%{_libdir}/libnvidia-ifr.so.%{version}
install -D -m755 libnvidia-ifr.so.%{version} %{buildroot}%{_libdir}/libnvidia-ifr.so.%{version}
install -D -m755 libnvidia-fbc.so.%{version} %{buildroot}%{_libdir}/libnvidia-fbc.so.%{version}
install -D -m755 libnvidia-encode.so.%{version} %{buildroot}%{_libdir}/libnvidia-encode.so.%{version}
install -D -m755 libnvidia-cfg.so.%{version} %{buildroot}%{_libdir}/libnvidia-cfg.so.%{version}
@ -168,9 +176,6 @@ install -D -m755 libnvidia-vulkan-producer.so.%{version} %{buildroot}%{_libdir}/
ln -s libnvidia-vulkan-producer.so.%{version} %{buildroot}%{_libdir}/libnvidia-vulkan-producer.so.1
ln -s libnvidia-vulkan-producer.so.%{version} %{buildroot}%{_libdir}/libnvidia-vulkan-producer.so
#install -D -m755 libnvidia-ngx.so.%{version} %{buildroot}%{_libdir}/libnvidia-ngx.so.%{version}
#install -D -m755 libnvidia-glvkspirv.so.%{version} %{buildroot}%{_libdir}/libnvidia-glvkspirv.so.%{version}
# Vulkan ICD
install -D -m644 nvidia_icd.json %{buildroot}%{_datadir}/vulkan/icd.d/nvidia_icd.json
install -D -m644 nvidia_layers.json %{buildroot}%{_datadir}/vulkan/implicit_layer.d/nvidia_layers.json
@ -274,14 +279,22 @@ install -Dm644 %{SOURCE1} %{buildroot}%{_sysusersdir}/nvidia.conf
install -d -m0755 %{buildroot}%{_modprobedir}
cat > %{buildroot}%{_modprobedir}/nvidia.conf << _EOF
blacklist nouveau
options nvidia_drm modeset=1
options nvidia_drm modeset=1 fbdev=1
_EOF
install -d -m0755 %{buildroot}%{_modulesloaddir}
cat > %{buildroot}%{_modulesloaddir}/nvidia.conf << __EOF
nvidia-uvm
__EOF
install -d -m0755 %{buildroot}%{_sysconfdir}/dracut.conf.d
cat > %{buildroot}%{_sysconfdir}/dracut.conf.d/20-nvidia.conf << __EOF
add_drivers+=" nvidia nvidia_drm nvidia_modeset nvidia_uvm "
add_drivers+=" nvidia nvidia_drm nvidia_modeset "
__EOF
# fallback service which loads nouveau driver if nvidia was not loaded
install -D -m0644 %{SOURCE3} %{buildroot}%{_unitdir}/nvidia-fallback.service
# dkms
install -d -m0755 %{buildroot}%{_prefix}/src/%{name}-%{version}
cp -a kernel/* %{buildroot}%{_prefix}/src/%{name}-%{version}/
@ -309,6 +322,8 @@ DEST_MODULE_LOCATION[4]=/kernel/drivers/video
AUTOINSTALL=yes
_EOF
install -D -m0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sddm.conf.d/nvidia_470.conf
%check
cd current/kernel
#for d in /lib/modules/4.*/build; do
@ -327,25 +342,22 @@ cd current/kernel
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post -n xorg-drv-video-%{name}
/sbin/ldconfig
:
%preun -n xorg-drv-video-%{name}
%preun
# erase
dkms remove -q -m nvidia -v %{version} --all
if [ $1 -eq 0 ]; then
/sbin/ldconfig
fi
:
%posttrans -n xorg-drv-video-%{name}
%posttrans
# new install
if [ $1 -ge 1 ]; then
# clean any legacy alternatives symlink
find /lib/modules/*/kernel/drivers/video/ -name nvidia.ko -type l -exec rm -f {} \;
dkms add -q -m %{name} -v %{version}
dkms install -q -m %{name} -v %{version}
# dkms: add and build module for any installed kernel found
ls /boot/vmlinuz-*| while read line; do
k=${line/*vmlinuz-}
dkms add -q -m %{name} -v %{version} -k ${k}
dkms install -q -m %{name} -v %{version} -k ${k}
done
fi
/sbin/depmod -a -F /boot/System.map-%{kernel_ver}%{?KERNEL_TARGET} \
@ -357,22 +369,24 @@ INITRAMFS=/boot/initramfs-${KVER}.img
[ -e /usr/sbin/mkinitrd ] && /usr/sbin/mkinitrd ${INITRAMFS} ${KVER} -f -H -q
:
%files -n xorg-drv-video-%{name}
%files
%defattr(-,root,root)
%{_sysconfdir}/dracut.conf.d/20-nvidia.conf
%{_sysconfdir}/OpenCL/vendors/nvidia.icd
%{_sysconfdir}/sddm.conf.d/nvidia_470.conf
%dir %{_prefix}/src/%{name}-%{version}
%{_prefix}/src/%{name}-%{version}/*
%{_prefix}/lib/firmware/nvidia/%{version}/*.bin
%{_bindir}/nvidia-*
%{_modprobedir}/nvidia.conf
%{_systemd_util_dir}/system-sleep/nvidia
%{_unitdir}/nvidia-fallback.service
%{_unitdir}/nvidia-hibernate.service
%{_unitdir}/nvidia-persistenced.service
%{_unitdir}/nvidia-suspend.service
%{_unitdir}/nvidia-resume.service
%{_sysusersdir}/nvidia.conf
#%{_datadir}/dbus-1/system.d/nvidia-dbus.conf
%{_modulesloaddir}/nvidia.conf
%{_libdir}/libEGL_nvidia.so.*
%{_libdir}/libGLESv1_CM_nvidia.so.*
%{_libdir}/libGLESv2_nvidia.so.*
@ -388,12 +402,12 @@ INITRAMFS=/boot/initramfs-${KVER}.img
%{_libdir}/nvidia/xorg/libglxserver_nvidia.so.*
%{_libdir}/nvidia/wine/_nvngx.dll
%{_libdir}/nvidia/wine/nvngx.dll
#%{_libdir}/gbm/nvidia-drm_gbm.so
%{_libdir}/gbm/nvidia-drm_gbm.so
%{_libdir}/vdpau/libvdpau_nvidia.so.*
%{_libdir}/xorg/modules/drivers/nvidia_drv.so
%{_datadir}/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf
%{_datadir}/applications/nvidia-settings.desktop
#%{_datadir}/egl/egl_external_platform.d/15_nvidia_gbm.json
%{_datadir}/egl/egl_external_platform.d/10_nvidia_wayland.json
%{_datadir}/glvnd/egl_vendor.d/10_nvidia.json
%{_datadir}/nvidia/nvidia-application-profiles-%{version}-key-documentation
%{_datadir}/nvidia/nvidia-application-profiles-%{version}-rc
@ -403,11 +417,25 @@ INITRAMFS=/boot/initramfs-${KVER}.img
%{_mandir}/man1/nvidia-*.1*
%doc current/LICENSE
%files -n xorg-drv-video-%{name}-doc
%files doc
%defattr(-,root,root)
%doc current/{NVIDIA_Changelog,README.txt} current/html
%changelog
* Sat Feb 22 2025 Silvan Calarco <silvan.calarco@mambasoft.it> 470.256.02-4mamba
- source renamed from nvidia-470 to nvidia_470 to workaround internal management issues
- add sddm configuration to ensure sddm itself and plasma session use X11
- run dkms add and install for any found kernel version
* Fri Feb 21 2025 Silvan Calarco <silvan.calarco@mambasoft.it> 470.256.02-3mamba
- added patches up to kernel 6.13
* Thu Feb 06 2025 Silvan Calarco <silvan.calarco@mambasoft.it> 470.256.02-2mamba
- sync some fixes and installed files with nvidia current driver
* Sun Feb 02 2025 Silvan Calarco <silvan.calarco@mambasoft.it> 470.256.02-1mamba
- update to 470.256.02
* Thu Jul 27 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 470.199.02-1mamba
- update to 470.199.02