[HOWTO] make a xzm module driver for NVIDIA video card

Post tutorials, HOWTO's and other useful resources here.
User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

[HOWTO] make a xzm module driver for NVIDIA video card

Post#106 by Rava » 13 Dec 2022, 03:48

rych wrote:
13 Dec 2022, 02:20
Must the nvidia driver be built on the machine that actually has the target nvidia GPU?!
Not sure.
You need the blacklist for disabling the generic driver. You need the kernel booted you want the driver compiled for, and you need the 005-devel and crippled-kernel-sources modules as well all activated for the very same kernel.

Because of the need for the blacklisting of the generic driver I presume it would not work trying to compile the driver on a different machine.
When I recall correct while compiling the driver checks the available GPU hardware - but I could be mistaken on that. After all I made my last driver on 2020-04-09 (YYYY-MM-DD) - that's approx 2 1/2 years ago. :roll:
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Porteus Kernel Builder

Post#107 by Rava » 13 Dec 2022, 03:52

rych wrote:
13 Dec 2022, 02:19
I have a question: must the nvidia driver be built on the machine that actually has the target nvidia GPU?! I understand the compiling system has to have the same kernel version it's meant for, but if it doesn't actually have to have the GPU, then in principle it could be a part of the "Porteus Kernel Builder" :)
Like I wrote in the other thread:
Rava wrote:
13 Dec 2022, 03:48
rych wrote:
13 Dec 2022, 02:20
Must the nvidia driver be built on the machine that actually has the target nvidia GPU?!
Not sure.
You need the blacklist for disabling the generic driver. You need the kernel booted you want the driver compiled for, and you need the 005-devel and crippled-kernel-sources modules as well all activated for the very same kernel.

Because of the need for the blacklisting of the generic driver I presume it would not work trying to compile the driver on a different machine.
When I recall correct while compiling the driver checks the available GPU hardware - but I could be mistaken on that. After all I made my last driver on 2020-04-09 (YYYY-MM-DD) - that's approx 2 1/2 years ago. :roll:
(the eyes rolling is not towards you but towards the long time since I compiled an NV driver.)
Cheers!
Yours Rava

fulalas
DEV Team
DEV Team
Posts: 2050
Joined: 26 Oct 2016, 15:34
Distribution: Porteus
Location: Brazil

[HOWTO] make a xzm module driver for NVIDIA video card

Post#108 by fulalas » 13 Dec 2022, 05:12

rych wrote:
13 Dec 2022, 02:20
Must the nvidia driver be built on the machine that actually has the target nvidia GPU?!
I believe so, yes. At least I couldn't find another way. AFAIR, the driver installer detects which video card you have before proceeding. But once you have the module it should work with all Nvidia video cards that this driver supports, not just yours.

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

[HOWTO] make a xzm module driver for NVIDIA video card

Post#109 by Rava » 13 Dec 2022, 05:41

fulalas wrote:
13 Dec 2022, 05:12
once you have the module it should work with all Nvidia video cards that this driver supports, not just yours.
It should, but always only with the very same kernel you compiled it under.

Therefore I recommend a NV driver module you share having two version number in its name, like mine do.

To demonstrate I use quote (no colours when using [ code ]) and colour red for the kernel and green for the NV driver version:
010-nvidia-340.108-k.5.4.30-porteus-v5.0-x86_64_rava.xzm
Cheers!
Yours Rava

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3936
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

[HOWTO] make a xzm module driver for NVIDIA video card

Post#110 by ncmprhnsbl » 13 Dec 2022, 06:17

rych wrote:
13 Dec 2022, 02:20
Must the nvidia driver be built on the machine that actually has the target nvidia GPU?!
i have once compiled the 515* driver(now it's up to 525) on a machine with a 470* driver card and while the installer told me that the resulting driver wouldn't work with my card, it completed successfully ..
though i couldn't test it myself, i was told it worked for someone who had a newer card..
now, what would happen with a completely different ie. amd or intel card idk.. the installer may just nope out of it.
at the very least, as Rava says, an appropriate blacklist in /etc/modprobe.d would be needed.
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

beny
Full of knowledge
Full of knowledge
Posts: 2097
Joined: 02 Jan 2011, 11:33
Location: italy

Porteus Kernel Builder

Post#111 by beny » 13 Dec 2022, 22:21

hi Rava i have found something very interesting and i...well the script have build a patched nvidia driver for the 340.108 version with the new kernel and xorg too,you have to check if is ok i have used the porteus stock kernel but i think you can use also the 6.0 version
https://www.mediafire.com/file/jvn6gzsm ... 0.run/file

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Porteus Kernel Builder

Post#112 by Rava » 13 Dec 2022, 23:22

beny wrote:
13 Dec 2022, 22:21
hi Rava i have found something very interesting and i...well the script have build a patched nvidia driver for the 340.108 version with the new kernel and xorg too,you have to check if is ok i have used the porteus stock kernel but i think you can use also the 6.0 version
https://www.mediafire.com/file/jvn6gzsm ... 0.run/file
Currently downloading it, but once more mediafire.com is abysmal slow. (average 17 KB/s and --.-KB/s - approx download time 10 minutes 20 minutes 40 minutes 98 minutes :( )
Do you have its md5sum?
Cheers!
Yours Rava

beny
Full of knowledge
Full of knowledge
Posts: 2097
Joined: 02 Jan 2011, 11:33
Location: italy

Porteus Kernel Builder

Post#113 by beny » 13 Dec 2022, 23:28

d3dc02eafae5d88c67e80e86d16ff51d

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Porteus Kernel Builder

Post#114 by Rava » 13 Dec 2022, 23:32

beny wrote:
13 Dec 2022, 23:28
d3dc02eafae5d88c67e80e86d16ff51d
Thanks. Hopefully the download will finish in my lifetime.
I had to stop wget via Ctrl+C several times already since it kept saying -- KB/s and restart it via wget -c URL

Added in 54 seconds:
e.g.:

Code: Select all

Length: 101933419 (97M), 74031467 (71M) remaining [text/x-shellscript]
Saving to: ‘NVIDIA-Linux-x86_64-340.108-patched-kernel-6.0.run’

IA-Linux-x86_64-340  32%[+++++>              ]  31.78M  --.-KB/s    eta 41m 50s
:wall:

Added in 2 minutes 5 seconds:
Hopefully the md5sum will match after all the Ctrl+C and wget -c. :crazy:
Mediafire really sucks.

Added in 23 minutes 57 seconds:
Yay, the md5sum matches. Lucky me. :)
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Porteus Kernel Builder

Post#115 by Rava » 14 Dec 2022, 05:04

Now that I successfully (judged by matching md5sum) downloaded the file NVIDIA-Linux-x86_64-340.108-patched-kernel-6.0.run

are there recent but not experimental / rc / unstable recent kernels (e.g. the standard kernel for x86-64 Porteus 5.0) available as vmlinuz & 005-devel and crippled-kernel-sources but with all the flags enabled to use nftables - as discussed here: Nf_tables modules not found. ?
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8368
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Porteus Kernel Builder

Post#116 by Ed_P » 14 Dec 2022, 06:15

beny wrote:
13 Dec 2022, 22:21
the script have build a patched nvidia driver for the 340.108 version with the new kernel and xorg too,you have to check if is ok
A 1000+ line bash script whose main command is echo!! :o

How does one execute this .run file?? :%)
Ed

raja
Shogun
Shogun
Posts: 434
Joined: 02 May 2017, 09:51
Distribution: v3.2.2-32 and Porteus-Artix-64
Location: Chennai,India

Porteus Kernel Builder

Post#117 by raja » 14 Dec 2022, 08:29

make the file executable...chmod +x ;

double click.
Linux Kernel-4.4.272 -32 bit; Linux Kernel-5.4.185 - 64 bit

beny
Full of knowledge
Full of knowledge
Posts: 2097
Joined: 02 Jan 2011, 11:33
Location: italy

Porteus Kernel Builder

Post#118 by beny » 14 Dec 2022, 10:28

well you have to boot in init 3 and as root sh your software.run or if you have extract the run ./nvidia-installer,i suppose that only Rava have the trouble with nvidia and the kernel version and also xorg version,i have patched a version with gentoo patch but no luck so i have found this one that work,if the user want to see the core of this .run can use --extract-only.

User avatar
Ed_P
Contributor
Contributor
Posts: 8368
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Porteus Kernel Builder

Post#119 by Ed_P » 14 Dec 2022, 21:44

Thank you guys. :) I will have to check it out later.
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Porteus Kernel Builder

Post#120 by Rava » 15 Dec 2022, 01:19

beny wrote:
14 Dec 2022, 10:28
well you have to boot in init 3 and as root sh your software.run or if you have extract the run ./nvidia-installer,i suppose that only Rava have the trouble with nvidia and the kernel version and also xorg version,i have patched a version with gentoo patch but no luck so i have found this one that work,if the user want to see the core of this .run can use --extract-only.
Is there somewhere a driver version V340.108 available for a newer kernel?
Where the vmlinuz and the 000-kernel and the matching 05-devel are all available?


Anyhow, you need the blacklist module activated, you need the correct matching 05-devel for the kernel you are loading activated, you also need the crippled-kernel-sources module activated.
And like beny wrote, you need to boot into mode 3 (text mode) and log into the system as root. Also no starting of X at all during the creation or prior the creation of the NV kernel module. At All.
And then you need to create a module out of what the NV *.run put into your system.
Even when you use a changes cheatcode you do not want any new changes that occurred during that boot unrelated to the NV driver be part of the NV driver but only the NV driver stuff. And that includes also a blacklist for the generic X driver.

Blaze created a script but that keeps some individual stuff in it that gets created during my boot. So in the end I always create my NV driver module manually by only copying what is needed and nothing else.

As you might have guessed by now: Creating a functioning NV driver is not that trivial. :D

Maybe a listing of what is in my nV driver is helpful to anyone attempting creating one themselves:

Code: Select all

root@porteus:/mnt/live/memory/images/010-nvidia-340.108-k.5.4.30-porteus-v5.0-x86_64_rava.xzm# find .
.
./etc
./etc/OpenCL
./etc/OpenCL/vendors
./etc/OpenCL/vendors/nvidia.icd
./etc/X11
./etc/X11/xorg.conf
./etc/modprobe.d
./etc/modprobe.d/nvidia-installer-disable-nouveau.conf
./etc/profile.d
./etc/profile.d/vdpau.sh
./lib
./lib/modules
./lib/modules/5.4.30-porteus
./lib/modules/5.4.30-porteus/kernel
./lib/modules/5.4.30-porteus/kernel/drivers
./lib/modules/5.4.30-porteus/kernel/drivers/video
./lib/modules/5.4.30-porteus/kernel/drivers/video/nvidia.ko
./usr
./usr/bin
./usr/bin/nvidia-bug-report.sh
./usr/bin/nvidia-cuda-mps-control
./usr/bin/nvidia-cuda-mps-server
./usr/bin/nvidia-debugdump
./usr/bin/nvidia-installer
./usr/bin/nvidia-modprobe
./usr/bin/nvidia-persistenced
./usr/bin/nvidia-settings
./usr/bin/nvidia-smiAt All.
./usr/bin/nvidia-uninstall
./usr/bin/nvidia-xconfig
./usr/lib64
./usr/lib64/libEGL.so
./usr/lib64/libEGL.so.1
./usr/lib64/libEGL.so.340.108
./usr/lib64/libGL.la
./usr/lib64/libGL.so
./usr/lib64/libGL.so.1
./usr/lib64/libGL.so.340.108
./usr/lib64/libGLESv1_CM.so
./usr/lib64/libGLESv1_CM.so.1
./usr/lib64/libGLESv1_CM.so.340.108
./usr/lib64/libGLESv2.so
./usr/lib64/libGLESv2.so.2
./usr/lib64/libGLESv2.so.340.108
./usr/lib64/libXvMCgallium.so
./usr/lib64/libcuda.so
./usr/lib64/libcuda.so.1
./usr/lib64/libcuda.so.340.108
./usr/lib64/libnvcuvid.so
./usr/lib64/libnvcuvid.so.1
./usr/lib64/libnvcuvid.so.340.108
./usr/lib64/libnvidia-cfg.so
./usr/lib64/libnvidia-cfg.so.1
./usr/lib64/libnvidia-cfg.so.340.108
./usr/lib64/libnvidia-compiler.so.340.108
./usr/lib64/libnvidia-eglcore.so.340.108
./usr/lib64/libnvidia-encode.so
./usr/lib64/libnvidia-encode.so.1
./usr/lib64/libnvidia-encode.so.340.108
./usr/lib64/libnvidia-fbc.so
./usr/lib64/libnvidia-fbc.so.1
./usr/lib64/libnvidia-fbc.so.340.108
./usr/lib64/libnvidia-glcore.so.340.108
./usr/lib64/libnvidia-glsi.so.340.108
./usr/lib64/libnvidia-ifr.so
./usr/lib64/libnvidia-ifr.so.1
./usr/lib64/libnvidia-ifr.so.340.108
./usr/lib64/libnvidia-ml.so
./usr/lib64/libnvidia-ml.so.1
./usr/lib64/libnvidia-ml.so.340.108
./usr/lib64/libnvidia-opencl.so.1
./usr/lib64/libnvidia-opencl.so.340.108
./usr/lib64/libnvidia-tls.so.340.108
./usr/lib64/libvdpau_nvidia.so
./usr/lib64/tls
./usr/lib64/tls/libnvidia-tls.so.340.108
./usr/lib64/vdpau
./usr/lib64/vdpau/libvdpau_nvidia.so.1
./usr/lib64/vdpau/libvdpau_nvidia.so.340.108
./usr/lib64/xorg
./usr/lib64/xorg/modules
./usr/lib64/xorg/modules/drivers
./usr/lib64/xorg/modules/drivers/nvidia_drv.so
./usr/lib64/xorg/modules/extensions
./usr/lib64/xorg/modules/extensions/libglx.so
./usr/lib64/xorg/modules/extensions/libglx.so.340.108
./usr/lib64/xorg/modules/libnvidia-wfb.so.1
./usr/lib64/xorg/modules/libnvidia-wfb.so.340.108
./usr/share
./usr/share/applications
./usr/share/applications/nvidia-settings.desktop
./usr/share/doc
./usr/share/doc/NVIDIA_GLX-1.0
./usr/share/doc/NVIDIA_GLX-1.0/nvidia-settings.png
./usr/share/nvidia
./usr/share/nvidia/monitoring.conf
./usr/share/nvidia/nvidia-application-profiles-340.108-key-documentation
./usr/share/nvidia/nvidia-application-profiles-340.108-rc
./usr/share/nvidia/pci.ids
Some of these are symlinks. :)

HTH.
Cheers!
Yours Rava

Post Reply