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

Post tutorials, HOWTO's and other useful resources here.
User avatar
Ed_P
Contributor
Contributor
Posts: 8369
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Porteus Kernel Builder

Post#121 by Ed_P » 15 Dec 2022, 05:56

Rava wrote:
15 Dec 2022, 01:19
you need the blacklist module activated
What module? How should I blacklist it?
Ed

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

Porteus Kernel Builder

Post#122 by Ed_P » 15 Dec 2022, 21:16

Rava wrote:
15 Dec 2022, 01:19
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.
Apparently not.

Code: Select all

        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (340.108)




 
  WARNING: You do not appear to have an NVIDIA GPU supported by the 340.108    
           NVIDIA Linux graphics driver installed in this system.  For further 
           details, please see the appendix SUPPORTED NVIDIA GRAPHICS CHIPS in 
           the README available on the Linux driver download page at           
           www.nvidia.com.

                                       OK  









  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 

Added in 2 minutes 43 seconds:
My system is all Intel based.

Code: Select all

guest@porteus:~$ su
Password: 
root@porteus:/home/guest# lspci
00:00.0 Host bridge: Intel Corporation Device 9a14 (rev 01)
00:02.0 VGA compatible controller: Intel Corporation Device 9a49 (rev 01)
00:04.0 Signal processing controller: Intel Corporation Device 9a03 (rev 01)
00:07.0 PCI bridge: Intel Corporation Device 9a23 (rev 01)
00:0a.0 Signal processing controller: Intel Corporation Device 9a0d (rev 01)
00:0d.0 USB controller: Intel Corporation Device 9a13 (rev 01)
00:0d.2 USB controller: Intel Corporation Device 9a1b (rev 01)
00:12.0 Serial controller: Intel Corporation Device a0fc (rev 20)
00:14.0 USB controller: Intel Corporation Device a0ed (rev 20)
00:14.2 RAM memory: Intel Corporation Device a0ef (rev 20)
00:14.3 Network controller: Intel Corporation Device a0f0 (rev 20)
00:15.0 Serial bus controller [0c80]: Intel Corporation Device a0e8 (rev 20)
00:15.1 Serial bus controller [0c80]: Intel Corporation Device a0e9 (rev 20)
00:16.0 Communication controller: Intel Corporation Device a0e0 (rev 20)
00:1c.0 PCI bridge: Intel Corporation Device a0bc (rev 20)
00:1f.0 ISA bridge: Intel Corporation Device a082 (rev 20)
00:1f.3 Multimedia audio controller: Intel Corporation Device a0c8 (rev 20)
00:1f.4 SMBus: Intel Corporation Device a0a3 (rev 20)
00:1f.5 Serial bus controller [0c80]: Intel Corporation Device a0a4 (rev 20)
2b:00.0 Non-Volatile memory controller: Sandisk Corp Device 501a
root@porteus:/home/guest# 
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#123 by Rava » 16 Dec 2022, 02:53

Ed_P wrote:
15 Dec 2022, 21:19
Apparently not.
What do you mean by "Apparently not."

I and beny wrote above that you need an NVidia GPU / NV card for the driver compilation *.run to work.
Via a quick search I only found a quote by yours truly - in another thread but quoted in here (on page 115)
Rava wrote:
13 Dec 2022, 03:48
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 […]
(highlighting by me)

I not wrote that what I listed is all you need, it is only about all the modules you need.
The driver compilation script to also demand an NVidia hardware to compile an NVidia driver is not that unreasonable.

But like beny wrote, you can extract the *.run and make changes to it yourself. Maybe there are tutorials out there explaining how you can circumvent the driver from blocking the compilation on a NVidia-GPU missing machine.

Mastering the tweaking of the NV *.run to do your bidding would be a challenge and thus a nice Christmas present to yourself. *nudge nudge* :D
Last edited by Rava on 16 Dec 2022, 02:56, edited 1 time in total.
Cheers!
Yours Rava

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

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

Post#124 by rych » 16 Dec 2022, 13:11

I think I've collected all the files I'm going to need.
Firstly, we use the stock
Blaze wrote:
15 Dec 2022, 18:27
05-devel.xzm from Porteus 5.0 release
Secondly, the crippled_sources that came with your kernel.

Thirdly, an Nvidia driver builder from https://www.nvidia.com/Download/index.aspx

Finally, the blacklist.xzm and nvidia.sh from the first post in this thread

Code: Select all

# ls -l
Apr 22  2022 05-devel.xzm
Nov  5 21:01 06-crippled_sources-6.0.7-64bit.xzm
Dec 15 18:37 NVIDIA-Linux-x86_64-525.60.11.run
Dec 17 01:59 blacklist.xzm
Dec 17 01:59 nvidia.sh

The xzms we're going to copy to porteus/base and reboot into a fresh (no changes) Text mode:
APPEND 3
Or, I'd use
APPEND 3 login=root from=LABEL:Porteus5 fsck
Is this all correct so far?

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#125 by Rava » 16 Dec 2022, 13:24

rych wrote:
16 Dec 2022, 13:11
Is this all correct?
Indeed it is, you need the kernel loaded you want to compile the driver for (the correct vmlinuz with its corresponding 000-kernal and its 05-devel.xzm).

And like written above, you need to boot into mode 3 (text mode, virtual terminal) and not start X prior the compilation of the driver.

When you see the text login:

Code: Select all

 Welcome to Porteus                                                        v5.0
===============================================================================

 The system is up and running now.

 Login as root with password toor or as guest with password guest.
 If you're new to Porteus, visit http://www.porteus.org/ for more info.

 After you login, try the following commands:

 mc ....... to start Midnight Commander (edit/copy/move/create/delete files)
 init 4 ... to run Xwindow system

 Other commands you may find useful:

 activate ..... to insert (install) Porteus module into the system on the fly
 deactivate ... to remove (uninstall) Porteus module from the root filesystem
 pns-tool ..... to setup internet connection

 When finished, use "poweroff" or "reboot" command and wait until it completes
===============================================================================

porteus login:
log into Porteus as root, either use the cd command to move where your NVIDIA-Linux-x86_64-525.60.11.run is, or use mc to navigate and start NVIDIA-Linux-x86_64-525.60.11.run.

When NVIDIA-Linux-*.run is not executable then do a

Code: Select all

chmod a+x NVIDIA-Linux-*.run
and then start it.

Manually starting it would be via

Code: Select all

./NVIDIA-Linux-x86_64-525.60.11.run
when you are in the folder where it sits, or you can also use its complete path like so:

Code: Select all

/mnt/your-partition/your-folder/NVIDIA-Linux-x86_64-525.60.11.run
or double click on it when using mc.

Then follow the instructions of the compiler, it will tell you if the driver compilation succeeds or fails.

When it was successful, use Blaze's script to create the module.

I recommend naming the module with both the driver version and also with the kernel version since that driver will only work for the very same kernel it was compiled under.

My suggestion - colour red for the kernel and green for the NV driver version - the colours are only for highlighting the two versions :
010-nvidia-340.108-k.5.4.30-porteus-v5.0-x86_64_rava.xzm
:)
Cheers!
Yours Rava

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

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

Post#126 by rych » 16 Dec 2022, 13:27

Rava wrote:
16 Dec 2022, 13:24
corresponding 000-kernal and its 05-devel.xzm
There is no new corresponding 05-devel.xzm: it stays the same, see @Blaze's clarification. No new 05-devel.xzm came with the 6.0.7 kernel for example.

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#127 by Rava » 16 Dec 2022, 13:36

rych wrote:
16 Dec 2022, 13:27
There is no new corresponding 05-devel.xzm: it stays the same, see @Blaze's clarification. No new 05-devel.xzm came with the 6.0.7 kernel for example.
Then it stays the same, but a user could choose a different experimental / unstable kernel and then there could be a new or different 05-devel.xzm.
Cheers!
Yours Rava

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

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

Post#128 by beny » 16 Dec 2022, 16:53

the devel and kernel are not related,the devel software have the gcc and make and other software that are the engine for the build of eveything not just kernel,you can see it via sbopkg if you are a packager or via source code with ./bootstrap.sh or ./configure, and make,but i can go wrong.

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#129 by Rava » 16 Dec 2022, 23:57

beny wrote:
16 Dec 2022, 16:53
the devel software have the gcc
Indeed, but to create a working NV module you need to have the exact same gcc than the one used for compiling the kernel.
While in most instances a slight difference might not matter, when it comes to the NV GPU kernel drivers, it does matter.
Cheers!
Yours Rava

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

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

Post#130 by beny » 17 Dec 2022, 00:02

hi Rava yes this is the nvidia build rules,but you have done the module or you have the changes on

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#131 by Rava » 17 Dec 2022, 00:16

beny wrote:
17 Dec 2022, 00:02
hi Rava yes this is the nvidia build rules,but you have done the module or you have the changes on
The modules I created in the past all worked, and i always used the gcc matching version - meaning the exact same gcc version than the one used for the kernel.
One time there was a slight difference in the version and that NV driver module would fail to work.
Cheers!
Yours Rava

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

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

Post#132 by rych » 19 Dec 2022, 12:29

rych wrote:
16 Dec 2022, 13:27
There is no new corresponding 05-devel.xzm
beny wrote:
16 Dec 2022, 16:53
the devel and kernel are not related,the devel software have the gcc
Rava wrote:
17 Dec 2022, 00:16
the exact same gcc version than the one used for the kernel
I got the following error from running ./NVIDIA-Linux-x86_64-525.60.11.run:
-> Installing NVIDIA driver version 525.60.11.
-> Performing CC sanity check with CC="/usr/bin/cc".
-> Performing CC check.
ERROR: The CC sanity check failed:

The C compiler '/usr/bin/cc' does not appear to be able to
create object files. Please make sure you have
your Linux distribution's libc development package
installed and that '/usr/bin/cc' is a valid C compiler
name.
/usr/bin/cc is indeed present as provided by the activated 05-devel.xzm. I use the one came with the Porteus 5.0 Kernel 5.18.8 even though I'm using a newer kernel 6.0.7 with the notes: for kernel 6.0.7 compiler used 11.2.0-x86_64, glibc-2.33 replaced with glibc-2.35

I've found another (?) version of 05-devel.xzm from the kernel building thread that has a slightly different size than the stock one and came with this note:
Blaze wrote:
02 Jul 2022, 08:25
Note 1: Compiler that was used.
for kernel 5.18.8: 11.2.0-x86_64
A new :url: x86_64 05-devel.xzm (GCC version 11.2.0)
I have tried that one, with exactly same error. The /usr/bin/cc --version gives me 11.2.0 alright. There is something else that Nvidia installer doesn't like about our compiler. There is an earlier error/warning:
bin/ldconfig: Can't open cache file /etc/ld.so.cache: No such file or directory
... but I doubt it's relevant.

rych
Warlord
Warlord
Posts: 622
Joined: 04 Jan 2014, 04:27
Distribution: Porteus 5.0 x64 OpenBox
Location: NZ
Contact:

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

Post#133 by rych » 19 Dec 2022, 13:20

An interesting thread on compatibility of NVidia drivers with 6.0 kernels: https://forums.developer.nvidia.com/t/4 ... l/229735/4
Basically, I might have to apply a patch. But anyway, I'm not even getting to that stage, at the moment my porteus doesn't pass NVidia's "CC sanity check"

User avatar
Blaze
DEV Team
DEV Team
Posts: 3885
Joined: 28 Dec 2010, 11:31
Distribution: ⟰ Porteus current ☯ all DEs ☯
Location: ☭ Russian Federation, Lipetsk region, Dankov
Contact:

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

Post#134 by Blaze » 19 Dec 2022, 17:11

rych wrote:
19 Dec 2022, 12:29
glibc-2.33 replaced with glibc-2.35
Seems issue in this.

Open terminal and try to fix it via:

Code: Select all

su
toor
removepkg gcc glibc
getpkg gcc glibc
# save to /tmp
installpkg /tmp/{gcc-*.txz,glibc-*.txz}
Linux 6.6.11-porteus #1 SMP PREEMPT_DYNAMIC Sun Jan 14 12:07:37 MSK 2024 x86_64 Intel(R) Xeon(R) CPU E3-1270 v6 @ 3.80GHz GenuineIntel GNU/Linux
MS-7A12 » [AMD/ATI] Navi 23 [Radeon RX 6600] [1002:73ff] (rev c7) » Vengeance LPX 16GB DDR4 K2 3200MHz C16

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#135 by Rava » 19 Dec 2022, 23:05

Blaze wrote:
19 Dec 2022, 17:11
removepkg gcc glibc
I think this will deinstall in the running system the GLIBC?

Since all C programs rely on the GLIBC that command will most probably break your system.
You can, however, extract the module where GLIBC sits (=001-core.xzm) and do a

Code: Select all

ROOT=/path/to/extracted/001-core/ removepkg glibc
on the folder where you extracted it, and also do a

Code: Select all

ROOT=/path/to/extracted/001-core/  installpkg glibc
into the very folder.
(I needed this:

Code: Select all

ROOT=/path/to/extracted/001-core/ installpkg glibc-2.35-x86_64-2.txz
when glibc-2.35-x86_64-2.txz was in the current $PWD)
I tried it with pimping Upgrading Port x86-64 4.0 001-core to GLIBC 2.35 4.0 to the same GLIBC as Porteus 5.0 has - mainly to see if newer programs that will never work using the GLIBC of 4.0 like the most recent palemoon will then run under the pimped up Porteus 4.0 - and it did work. Please see my thread how I did it and do the same steps. Like: extracting 001-core (possible to a ext[234] partition folder since extracted that one is quite large and could be too large for your /tmp folder on your aufs filesystem / partition in RAM) and the ROOT=/path/to/extracted/001-core/ installpkg glibc and ROOT=/path/to/extracted/001-core/ installpkg glibc.

Then make a pimped 001-core-GLIBC-V-whatever-version.xzm out of that folder, best create a new porteus/base setup, replace the original 001-core.xzm with your 001-core-GLIBC-V-whatever-version.xzm and boot up in mode 3 (virtual text mode) using the kernel you want to compile the NV driver for.

HTH.
Cheers!
Yours Rava

Post Reply