Hi everyone,
I developed and published a set of unofficial community compatibility patches for the source-available kernel interface of NVIDIA’s legacy 340.108 driver.
The patches get the driver building and reloading cleanly on Linux 6.17. They were tested on a 2011 GeForce 315M (GT218).
This work builds on top of dkosmari/nvidia-340.108-updated, which already provides compatibility patches for Linux 6.0 and newer.
On kernel 6.17, the driver initially failed to build because of several kernel API and build-system changes:
nv-dma.c: error: no previous prototype
nv-drm.c: fatal error: drm/drm_legacy.h: No such file or directory
nv.c: error: implicit declaration of function 'del_timer_sync'
make: No rule to make target 'nv-kernel.o'
After fixing these compilation problems, I encountered a separate runtime issue. The module loaded successfully once, but unloading and loading it again—or rebooting with it installed—caused initialization to fail:
proc_dir_entry 'driver/nvidia' already registered
NVRM: failed to register procfs!
NVRM: No NVIDIA graphics adapter probed!
I traced this to the driver’s procfs teardown path. A stale /proc/driver/nvidia entry could remain after unloading, while the next module initialization did not handle the existing entry.
The repository contains seven focused patches:
- Restores the removed Kbuild
%_shippedhandling required bynv-kernel.o - Disables the obsolete legacy DRM/AGP registration path
- Updates
del_timer_sync()totimer_delete_sync() - Fixes missing prototypes and declarations without disabling
-Werror - Fixes the stale procfs entry during module reload
- Corrects a mismatched internal function declaration
- Fixes empty debug macros that trigger
-Wempty-body
With all seven patches applied, the driver builds with its original, unmodified -Werror settings and survives repeated rmmod/modprobe cycles and clean reboots.
Tested configuration:
Distribution: Linux Mint 22.3 (Ubuntu 24.04 base)
Kernel: 6.17.0-22-generic
GPU: GeForce 315M / GT218
PCI ID: 10de:0a7a
Driver: NVIDIA 340.108
Important Xorg limitation:
The binary-only GLX components included with 340.108 are incompatible with current Xorg releases. I documented a stable Xfce workaround that disables GLX and resolves the conflicting client-side libGL.so.1, but this configuration does not provide GL/3D acceleration.
The kernel module, nvidia-smi, persistence mode, and CUDA Driver API remain usable for headless or compute-oriented setups.
Repository, installer, patches, and debugging notes:
Questions, feedback, and technical discussion are welcome. If you encounter a specific problem, feel free to reply here or open an issue on GitHub.
The proprietary NVIDIA binaries are neither modified nor redistributed by this repository. The installer downloads the original driver directly from NVIDIA.
This is an unofficial community project and is not affiliated with or supported by NVIDIA.
Terminal output showing Linux kernel 6.17.0-22, NVIDIA driver 340.108, and a GeForce 315M detected successfully.
