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

Post tutorials, HOWTO's and other useful resources here.
i3slkiller
Black ninja
Black ninja
Posts: 55
Joined: 03 Feb 2020, 18:51
Distribution: Porteus XFCE v5.0rc2 x86_64
Location: Poland

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

Post#151 by i3slkiller » 30 Apr 2024, 05:13

Rava wrote:
30 Apr 2024, 00:13
How do I tell the .SlackBuild what version to use?

Code: Select all

VERSION=340.108 ./download.sh
VERSION=340.108 ./08-nvidia.PorteusBuild
or

Code: Select all

VERSION=340.108 bash download.sh
VERSION=340.108 bash 08-nvidia.PorteusBuild
BTW in porteusbuild script, you can also specify where temporary files will be saved (TMP=/path/to/tmp, should be empty folder, on disk with sufficient free space and unix permissions, will be created if not exist) and where module will be saved (OUTPUT=/path/to/output, old module with the same name will be replaced).

User avatar
Rava
Contributor
Contributor
Posts: 5424
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#152 by Rava » 30 Apr 2024, 08:06

i3slkiller wrote:
30 Apr 2024, 05:13

Code: Select all

VERSION=340.108 ./download.sh
VERSION=340.108 ./08-nvidia.PorteusBuild
BTW in porteusbuild script, you can also specify where temporary files will be saved (TMP=/path/to/tmp, should be empty folder, on disk with sufficient free space and unix permissions, will be created if not exist) and where module will be saved (OUTPUT=/path/to/output, old module with the same name will be replaced).
I guess, VERSION=340.108 ./download.sh can be downloaded in any Porteus, so it must not be the one set up for compiling the driver?
Does ./download.sh also support the TMP= variant or can the driver source code and the patches only be downloaded to /tmp ?
Cheers!
Yours Rava

i3slkiller
Black ninja
Black ninja
Posts: 55
Joined: 03 Feb 2020, 18:51
Distribution: Porteus XFCE v5.0rc2 x86_64
Location: Poland

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

Post#153 by i3slkiller » 30 Apr 2024, 10:13

Rava wrote:
30 Apr 2024, 08:06
VERSION=340.108 ./download.sh can be downloaded in any Porteus
Yes, but only in 64-bit, what I have to fix (by the way, I didn't think earlier that someone may want to use this script to download files for platform other than the one on which was executed).

Rava wrote:
30 Apr 2024, 08:06
Does ./download.sh also support the TMP= variant or can the driver source code and the patches only be downloaded to /tmp ?

No, the files needed to create module (in this case driver installer) will be saved in the current working directory (CWD). In general, I was thinking about making possible to save downloaded files wherever, but I was too lazy to do it.

Rava wrote:
30 Apr 2024, 08:06
TMP= variant

That refers to 08-nvidia.PorteusBuild script:
i3slkiller wrote:
30 Apr 2024, 05:13
in porteusbuild script, you can also specify where temporary files will be saved (TMP=/path/to/tmp [...]

Regarding this script, it assumes that in CWD there are files required to build module.


EDIT: I just added SRC variable where you can type where downloadable items used to build module will be saved (download.sh) and where the build script expect them (08-nvidia.PorteusBuild) [default value is current working dir regardless of from where these scripts are started].

Code: Select all

SRC=where/to/download/items ./path/to/download.sh
SRC=where/to/download/items ./path/to/08-nvidia.PorteusBuild

User avatar
Rava
Contributor
Contributor
Posts: 5424
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#154 by Rava » 02 May 2024, 03:34

i3slkiller wrote:
30 Apr 2024, 10:13
I just added SRC variable where you can type where downloadable items used to build module will be saved (download.sh) and where the build script expect them (08-nvidia.PorteusBuild) [default value is current working dir regardless of from where these scripts are started].
So we have SRC for the path for downloading and using the downloaded source
VERSION=340.108 ./download.sh for changing the used driver version

So that would be then

Code: Select all

VERSION=340.108 SRC=where/to/download/items ./path/to/download.sh # downloading
VERSION=340.108 SRC=where/to/download/items ./path/to/08-nvidia.PorteusBuild # driver compiling and module creation
Is there also a way to tell 08-nvidia.PorteusBuild where to compile and store the finished module?

Added in 40 minutes 5 seconds:
Also would the scripts also work with Porteux?
Cheers!
Yours Rava

i3slkiller
Black ninja
Black ninja
Posts: 55
Joined: 03 Feb 2020, 18:51
Distribution: Porteus XFCE v5.0rc2 x86_64
Location: Poland

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

Post#155 by i3slkiller » 02 May 2024, 06:08

Rava wrote:
02 May 2024, 04:14
Is there also a way to tell 08-nvidia.PorteusBuild where to compile
i3slkiller wrote:
30 Apr 2024, 05:13
you can also specify where temporary files will be saved (TMP=/path/to/tmp, should be empty folder, on disk with sufficient free space and unix permissions, will be created if not exist)
Rava wrote:
02 May 2024, 04:14
and store the finished module?
i3slkiller wrote:
30 Apr 2024, 05:13
and where module will be saved (OUTPUT=/path/to/output, old module with the same name will be replaced).

Code: Select all

TMP=/path/to/tmp OUTPUT=/path/to/output VERSION=340.108 SRC=where/to/download/items ./path/to/08-nvidia.PorteusBuild
Order of these variables does not matter.

Rava wrote:
02 May 2024, 04:14
Also would the scripts also work with Porteux?
download.sh script will work even in Debian.
08-nvidia.PorteusBuild possibly will work in Porteux, but with caveats:
- this script normally won't start if not executed in Porteus, you have to set BYPASS_DISTRO_CHECK=yes to bypass this
- this script expects that devel module will be named 05-devel.xzm (not 05-devel-blablaba.xzm)
- this script expects that crippled sources module will be named 06-crippled_sources-X.Y.Z-64bit.xzm

EDIT: I realized that this script also copies vdpau.(c)sh from 002-xorg module, so in Porteux this script may fail here. You have to replace 002-xorg to 002-gui* in this line:

Code: Select all

cp -a "/mnt/live/memory/images/002-xorg.xzm/etc/profile.d"/vdpau.{,c}sh "$PKG/etc/profile.d"
to this

Code: Select all

cp -a /mnt/live/memory/images/002-gui*.xzm/etc/profile.d/vdpau.{,c}sh "$PKG/etc/profile.d"
EDIT2: I see that also syntax of dir2xzm command differs on Porteux, so I decided that will make separate script for that distro.
In Porteux try this script https://gitlab.com/i3slkiller/porteusbu ... type=heads

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

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

Post#156 by ncmprhnsbl » 03 May 2024, 00:13

confirming 08-nvidia for 470* produced by this script works with my hardware, with some caveats:
nouveau must be blacklisted before starting ie. eg. via a blacklist.xzm mentioned elsewhere in this topic. (if upgrading an existing 08-nvidia this shouldn't be a problem?)
the nvidia-settings initially failed for me, because of a blank xorg.conf > solution: run nvidia-xconfig, logout/login (then i de/recompressed the module including /etc/X11/xorg.conf) ...probly no way around this.
line 309: cp -a "/mnt/live/memory/changes/usr/share/man/man1"/nvidia-* "$PKG/usr/man/man1" failed for me, should be:
"/mnt/live/memory/changes/usr/man/man1"/nvidia-*
i just commented the whole section since i didn't need the man pages.
the other thing for me would be options for: no 32bit multilib, wine support, locales, man, doc ..
an idea might be a config file outlining all the options ie. version, tmp, and the above that is sourced by the scripts.
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

User avatar
Rava
Contributor
Contributor
Posts: 5424
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#157 by Rava » 03 May 2024, 03:23

ncmprhnsbl wrote:
03 May 2024, 00:13
nouveau must be blacklisted before starting ie. eg. via a blacklist.xzm mentioned elsewhere in this topic. (if upgrading an existing 08-nvidia this shouldn't be a problem?)
I think the blacklisting of nouveau should be part of the created 08-nvidia module.
ncmprhnsbl wrote:
03 May 2024, 00:13
the nvidia-settings initially failed for me, because of a blank xorg.conf > solution: run nvidia-xconfig, logout/login (then i de/recompressed the module including /etc/X11/xorg.conf) ...probly no way around this.
Doesn't the NV compiler run settings for creating xorg.conf ?
At least I recall: you start your PC in text only mode (mode 3) log in as root, do not start X, compile the driver (I presume the 08-nvidia.PorteusBuild will run the NVIDIA driver compiling script after of added needed patches to the driver.) and it always created a working xorg.conf.
ncmprhnsbl wrote:
03 May 2024, 00:13
line 309: cp -a "/mnt/live/memory/changes/usr/share/man/man1"/nvidia-* "$PKG/usr/man/man1" failed for me, should be:
"/mnt/live/memory/changes/usr/man/man1"/nvidia-*
Thanks for the heads up. I do want my man pages.
ncmprhnsbl wrote:
03 May 2024, 00:13
the other thing for me would be options for: no 32bit multilib, wine support, locales, man, doc ..
an idea might be a config file outlining all the options ie. version, tmp, and the above that is sourced by the scripts.
I also want no 32bit multilib, no wine support, no locales, no doc.
Cheers!
Yours Rava

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

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

Post#158 by ncmprhnsbl » 03 May 2024, 04:00

Rava wrote:
03 May 2024, 03:23
I think the blacklisting of nouveau should be part of the created 08-nvidia module.
yes, it is.
but in order to compile the nvidia kernel module, nouveau must not be loaded. which has to happen in the booting process before the script is run.
a quick websearch indicates that it may be enough to use kernel parameter nouveau.modeset=0 appended to the boot line.. although this might only apply to text mode.. have to check this..
EDIT: a slightly better websearch returned this kernel parameter: blacklist_module=nouveau which upon testing definitely does work to block nouveau loading. so just hit tab at the boot screen and add that.
a lot less clunky than the old blacklist.xzm module.

here's a diff of my quick edits to disable 32bit and exclude man,docs...
the main bit being the build config: --no-install-compat32-libs

another thought: putting [ -e /some/file ] && cp -a /some/file /to/the/pkg might stop the script borking when that file isn't there
or better a proper if [] else "hey $file ain't there" message..
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

i3slkiller
Black ninja
Black ninja
Posts: 55
Joined: 03 Feb 2020, 18:51
Distribution: Porteus XFCE v5.0rc2 x86_64
Location: Poland

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

Post#159 by i3slkiller » 03 May 2024, 07:42

ncmprhnsbl wrote:
03 May 2024, 00:13
nouveau must be blacklisted before starting
Rather not. I specially forced loading nouveau module on boot (cliexec=modprobe~nouveau) and nvidia-installer invoked by 08-nvidia.PorteusBuild didn't complained about it.
ncmprhnsbl wrote:
03 May 2024, 00:13
(if upgrading an existing 08-nvidia this shouldn't be a problem?)
Do I understand correctly that you are executing this script on system with 08-nvidia module loaded? :%) This module shouldn't be loaded when building new 08-nvidia xzm.
ncmprhnsbl wrote:
03 May 2024, 00:13
the nvidia-settings initially failed for me, because of a blank xorg.conf
Has nvidia-settings ever worked on "08-nvidia-470.199.02-k.6.5.5-porteus-v5.01-x86_64.xzm" module? Because I see that there is no /etc/X11/xorg.conf file inside. The same about "08-nvidia-535.113.01-k.6.5.5-porteus-v5.01-x86_64.xzm".
In "08-nvidia-550.67-k.6.8.4-porteux-x86_64.xzm" this file have this content:

Code: Select all

Section "ServerFlags"
    Option         "IgnoreABI" "1" 
EndSection
ncmprhnsbl wrote:
03 May 2024, 00:13
line 309: cp -a "/mnt/live/memory/changes/usr/share/man/man1"/nvidia-* "$PKG/usr/man/man1" failed for me, should be:
It's strange, it works for me.
ncmprhnsbl wrote:
03 May 2024, 00:13
the other thing for me would be options for: no 32bit multilib, wine support, locales, man, doc ..
I will consider it.

ncmprhnsbl wrote:
03 May 2024, 04:00
in order to compile the nvidia kernel module, nouveau must not be loaded
Does this don't apply for kernel module loading only (which I try to avoid when building porteus module)?


Basically, I write this script so that it doesn't matter if module is building when X11 is running or not.

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

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

Post#160 by ncmprhnsbl » 03 May 2024, 07:55

i3slkiller wrote:
03 May 2024, 07:42
Rather not. I specially forced loading nouveau module on boot and nvidia-installer invoked by 08-nvidia.PorteusBuild didn't complained about it.
interesting, cause it very much did complain and quit on me :)
i3slkiller wrote:
03 May 2024, 07:42
Do I understand correctly that you are executing this script on system with 08-nvidia module loaded?
i did try it once, but the failure was to do with the man path that time..
i3slkiller wrote:
03 May 2024, 07:42
It's strange, it works for me.
which is doubly strange :) no idea why..
i3slkiller wrote:
03 May 2024, 07:42
Basically, I write this script so that it doesn't matter if module is building when X11 is running or not.
which is the case with my last test, just with nouveau blocked, using framebuffer or vesa or something i believe..
i3slkiller wrote:
03 May 2024, 07:42
Has nvidia-settings ever worked on "08-nvidia-470.199.02-k.6.5.5-porteus-v5.01-x86_64.xzm" module? Because I see that there is no /etc/X11/xorg.conf file inside. The same about "08-nvidia-535.113.01-k.6.5.5-porteus-v5.01-x86_64.xzm".
yeah, these have the same issue, i purposely left it out because i figured that the xorg.conf would be specific to my hardware and that wouldn't be good.
i3slkiller wrote:
03 May 2024, 07:42
In "08-nvidia-550.67-k.6.8.4-porteux-x86_64.xzm" this file have this content:
that might be a sensible generic solution.
in any case i don't think any thing hardware specific can be done for this in the script because it doesn't load the kernel module so i expect nvidia-xconfig won't run?
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

i3slkiller
Black ninja
Black ninja
Posts: 55
Joined: 03 Feb 2020, 18:51
Distribution: Porteus XFCE v5.0rc2 x86_64
Location: Poland

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

Post#161 by i3slkiller » 03 May 2024, 08:04

ncmprhnsbl wrote:
03 May 2024, 07:55
which is doubly strange :) no idea why..
Are you sure that you are executing the same script as me (from at least 9d2c4d16 commit)?

Code: Select all

$ sha256sum 08-nvidia.PorteusBuild 
692a8532c33a2058fd3f52f3891eb8ba4e8a088408835eecf079553c37b2b88c  08-nvidia.PorteusBuild

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

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

Post#162 by ncmprhnsbl » 03 May 2024, 08:54

i3slkiller wrote:
03 May 2024, 08:04
Are you sure that you are executing the same script as me (from at least 9d2c4d16 commit)?
hmm, well no, the 7bad4ffc5508862ed80b0a6057a6eea6211b1bf0 commit, but i don't see any changes relevant to this issue..
i am using updated 001 and 002 modules(unreleased), but it seems a bit of stretch that anything in that would cause nvidia-installer to install it's man files to /usr/man ?? time will tell i suppose, when i release them.
i wouldn't sweat it, if nobody else can reproduce it, it's my problem :)
it's the nature of these scripts, be it Porteusbuild SlackBuild or PKGBUILD, the user should read them and adjust where necessary/desired.
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

Post Reply