Page 1 of 3

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

Posted: 23 Dec 2018, 23:51
by Rava
(Article originally posted in Russian by Blaze here Porteus и NVIDIA. Собираем актуальный драйвер для видеокарты )
This article is a joint translation effort by Blaze and Rava.
_____________________________

1. Go to the site http://nvidia.com in section ' Drivers > ALL NVIDIA DRIVERS '
Annotation: when you set the default language to be used for a website to something different than English (US), you might get a different menu. In my case I got redirected to https://www.nvidia.com/de-de/ and the menu entry is called Treiber > Alle Nvidia Treiber. Same might happen to you, you might get the menu and language in French, Spanish, Italian, whatever default language you set in your browser.

2. Manually select your NVIDIA video card, as well as the architecture of the Linux - 32-bit (i586) or 64-bit (x86_64) operating system and click on the ' Search ' button

Image

Click the ' Download ' button

Image

4. Press the ' Download ' button

Image

5. Also download 05-devel.xzm and crippled_sources.xzm (Cave! The below URLs to the 2 files are for Porteus 4.0, when you run any other version of Porteus you need to download different versions of 05-devel.xzm and crippled_sources.xzm) Updated kernel version, including crippled_sources.xzm can be obtained according to the topic - How to update kernel in Porteus:

for the Porteus operating system and 32 Bit architecture :

- 05-devel.xzm (i586)
- crippled_sources.xzm (i586)

or 64 Bit architecture :

- 05-devel.xzm (x86_64)
- crippled_sources.xzm (x86_64)


5.1 blacklist.xzm to block loading nouveau
/etc/modprobe.d/nvidia-installer-disable-nouveau.conf

Code: Select all

# generated by nvidia-installer
blacklist nouveau
options nouveau modeset=0
5.2 nvidia.sh - script to create xzm module nvidia

Code: Select all

#!/bin/bash
# Build of NVIDIA video driver, cleaning and compressing to xzm module for Porteus by Blaze
# You can use this script for both architectures i586 or x86_64

# Root check
if [ `whoami` != "root" ]; then
    echo -e "\n\e[1m\e[31mOnly root can run this.\e[0m\n"
    exit 1
fi

# Check blacklist.xzm in $PORTDIR/base
if [[ -f "$PORTDIR/base/blacklist.xzm" ]]; then
    mkdir /tmp/nvidia
    xzm2dir "$PORTDIR/base/blacklist.xzm" /tmp/nvidia &>/dev/null
else
    echo "$PORTDIR/base/blacklist.xzm" does not exist
    exit 1
fi

# Сleaning and compressing to xzm module
echo -e '\n\033[1mCompression of memory changes to the module /tmp/nvidia.xzm\033[0m\n'
dir2xzm /mnt/live/memory/changes /tmp/nvidia.xzm 2>/dev/null
cd /tmp
echo -e '\n\033[1mExtracting changes to /tmp/nvidia\033[0m\n'
xzm2dir nvidia.xzm nvidia 2>/dev/null
rm -rf /tmp/nvidia/{.cache,dev,home,mnt,root,run,tmp,var}
find /tmp/nvidia/ -type f -maxdepth 1 -delete
find /tmp/nvidia/ -type l -maxdepth 1 -delete
find /tmp/nvidia/etc/ -type f -maxdepth 1 -delete
find /tmp/nvidia/etc/ -type d ! -iname 'modprobe.d' ! -iname 'OpenCL' ! -iname 'vulkan' ! -iname 'X11' ! -iname 'etc' -maxdepth 1 -exec rm -rf '{}' '+'
rm -f /tmp/nvidia/etc/X11/xorg.conf.nvidia-xconfig-original
rm -rf /tmp/nvidia/lib/firmware
rm -f /tmp/nvidia/lib/modules/*porteus/modules.*
rm -rf /tmp/nvidia/usr/{man,src}
rm -f /tmp/nvidia/usr/bin/gnome-keyring-daemon
rm -rf /tmp/nvidia/usr/lib/{gio,gtk-2.0,gtk-3.0}
rm -f /tmp/nvidia/usr/lib/{libXvMCgallium.so.1,libbrscandec2.so.1,libgsm.so.1,libudev.so.1,libunrar.so.5}
rm -rf /tmp/nvidia/usr/lib64/{gio,gtk-2.0,gtk-3.0}
rm -f /tmp/nvidia/usr/lib64/{libXvMCgallium.so.1,libbrscandec2.so.1,libgsm.so.1,libudev.so.1,libunrar.so.5}
rm -rf /tmp/nvidia/usr/share/{glib-2.0,mime,pixmaps}
rm -f /tmp/nvidia/usr/{,local/}share/applications/mimeinfo.cache
rm -rf /tmp/nvidia/usr/share/doc/NVIDIA_GLX-1.0/{html,sample,LICENSE,NVIDIA_Changelog,README.txt}
dir2xzm /tmp/nvidia /tmp/08-nvidia-$(ls /tmp/*.run | basename -s .run *.run | cut -d '-' -f4)-k.$(uname -r)-$(cat /etc/porteus-version | cut -d '-' -f2)-$(arch).xzm 2>/dev/null
mv /tmp/08-nvidia-$(ls /tmp/*.run | basename -s .run *.run | cut -d '-' -f4)-k.$(uname -r)-$(cat /etc/porteus-version | cut -d '-' -f2)-$(arch).xzm $MODDIR
echo -e "\n\033[1mRemoving $PORTDIR/base/blacklist.xzm\033[0m\n"
# Removing $PORTDIR/base/blacklist.xzm
rm -f $PORTDIR/base/blacklist.xzm
echo -e "\n\t\e[1m\e[32m[DONE]\e[0m \e[1mYou can find your nvidia xzm module in \e[96m$MODDIR\e[0m"
echo -e "\e[1m\t\t>>> Now you can reboot Porteus via \e[92mreboot\e[0m \e[1mcommand <<<\e[0m\n"
#reboot
6. Copy 05-devel.xzm, crippled_sources.xzm, blacklist.xzm to /porteus/base/

7. Restart Porteus in ' Text mode '
Image

8. Login as root - type in terminal these data from root account by default:

Code: Select all

root
toor
Image

9. Copy NVIDIA-Linux-x86-340.96.run (current version at the time of this writing, or a differnt version needed for your card) and nvidia.sh to the /tmp directory.

For convenience, you can use the Midnight Commander. Enter the command

Code: Select all

mc
  • in the right column of Midnight Commander, open the directory /tmp
  • in the left column of the Midnight Commander, find the files NVIDIA-Linux-x86-340.96.run and nvidia.sh
  • copy these files from the left column to the right column with an open /tmp directory
Or start mc with the known paths e.g. like so (put your actual source folder name in here instead of my example)

Code: Select all

mc /mnt/path/to/nvidia-files /tmp
Image

10. Then enter the commands:

Code: Select all

cd /tmp
chmod +x NVIDIA-Linux-x86-340.96.run 
chmod +x nvidia.sh 
./NVIDIA-NVIDIA-Linux-x86-340.96.run
11. A message will appear.

Code: Select all

Please read the following LICENSE and then select either "Accept" to accept the license and continue with the installation, or select "Do Not Accept" to abort the installation.
Image

After reading, select and confirm the message by clicking ' Accept '. Now the driver will compile.

Image

12. If you compile the driver for the x86_64 architecture, then you will get the message:

Code: Select all

Install NVIDIA's 32-bit compatibility libraries?
Disagree and choose 'No'

13. Confirm the following message

Code: Select all

Please read the following LICENSE and then select either "Accept" to accept the license and continue with the installation, or select "Do Not Accept" to abort the installation.
Image

We answer positively by choosing ' Yes '

14. A message will appear.

Code: Select all

Your X configuration file has been successfully updated. Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86 (version: 340.96) is now comleted.
Image

depending on the architecture it may be

Code: Select all

Your X configuration file has been successfully updated. Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version: 340.96) is now comleted.
Click ' OK '

15. In the terminal, enter the command to build the xzm module, the subsequent cleaning of unnecessary trash and its reassembly.

Code: Select all

./nvidia.sh
The nvidia-390.87-k.4.18.5-porteus-v4.0-x86_64.xzm module (you will have a different module name) will be copied to /mnt/sdXx/porteus/modules (where Xx, the letter and partition number of your Porteus folder)

Other examples of module names:
  • nVidia-340.96-porteus-v3.2rc2-i586.xzm
  • nVidia-340.96-porteus-v3.2rc2-x86_64.xzm
16. After which Porteus will be rebooted.

Code: Select all

# NOTE! For it run this command:
reboot
That's all - download Porteus in the usual ' Graphics mode ' mode and use all the charms of the NVIDIA driver.

Screenshots :
Image

Image

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

Posted: 24 Dec 2018, 01:00
by Ed_P
:victory: Wow!!

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

Posted: 24 Dec 2018, 08:36
by Rava
Ed_P wrote:
24 Dec 2018, 01:00
:victory: Wow!!
Indeed, Blaze did a good work. I just added the info that you need to get the correct versions when downloading 05-devel.xzm and crippled_sources.xzm. (#5 of the list)
So, kudos to him. :celebrate3:

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

Posted: 24 Dec 2018, 17:20
by Blaze
All credits for the English translation to Rava
I just fixed some things..

I updated step 16 (English version too) and in my Russian version I tweak step 5:
5. Also download 05-devel.xzm and crippled_sources.xzm (Note: The links below are for Porteus 4.0, when you run any other version of Porteus, you need to download different versions 05-devel.xzm and crippled_sources.xzm. Updated kernel version, including crippled_sources.xzm can be obtained according to the topic - How to update kernel in Porteus:

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

Posted: 24 Dec 2018, 17:46
by Rava
Blaze wrote:
24 Dec 2018, 17:20
I updated step 16 (English version too) and in my Russian version I tweak step 5:
I was thinking in a more general way when writing the additional text for step 5. But I like your approach adding info about updated kernel.

I added this :
Updated kernel version, including crippled_sources.xzm can be obtained according to the topic - How to update kernel in Porteus:
Now me thinks both the Russian and English version should be quite similar again, right?

(And, at least in my book, that should be like so, sinve the only difference is All credits for the English translation to Rava
I just fixed some things..

a different language, and that should not change the details of any HOWTO, at least change details only superficially.)

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

Posted: 24 Dec 2018, 17:52
by Blaze
Rava wrote:
24 Dec 2018, 17:46

I added this :
Updated kernel version, including crippled_sources.xzm can be obtained according to the topic - How to update kernel in Porteus:
Now me thinks both the Russian and English version should be quite similar again, right?
Right, but this topic How to update kernel in Porteus in Russian too :)

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

Posted: 29 Dec 2018, 14:36
by Rava
Update

I added the following annotation in a smaller font size to #1 to clarify, in case a different language setup from the user's browser setup might throw a user off the track:
Rava wrote:
23 Dec 2018, 23:51
1. Go to the site http://nvidia.com in section ' Drivers > ALL NVIDIA DRIVERS '
Annotation: when you set the default language to be used for a website to something different than English (US), you might get a different menu. In my case I got redirected to https://www.nvidia.com/de-de/ and the menu entry is called Treiber > Alle Nvidia Treiber. Same might happen to you, you might get the menu and language in French, Spanish, Italian, whatever default language you set in your browser.

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

Posted: 10 Jan 2019, 07:34
by Rava
There are some issues to be solved with Blaze's script nvidia.sh

It keeps all recent files and folders unrelated to the nvidia driver files and needed libraries including softlinks, which, in my case, is a lot of softlinks that I use on all of my personalized Porteus versions, e.g. the softlink /x always pointing to the boot media of the current running Porteus system, e.g. to /mnt/sda1 or /mnt/sdb1, and all these files and folders are not deleted in the resulting nvidia driver module.

Also, it keeps the version of the compiled driver wrong. E.g. compiled driver for two kernels, both using the NVIDIA-Linux-x86_64-340.107.run file, and I presume instead of the * in the file name

Code: Select all

nvidia-*-k.4.19.8-porteus-v●●●-x86_64.xzm
nvidia-*-k.4.20.0-porteus-v●●●-x86_64.xzm
it should e.g. be "nvidia-340.107-k.4.20.0-porteus-v●●●-x86_64.xzm" instead.

For now, my lazy butt solution is to xzm2dir the just created module once again and delete all files and folders that are not part of the nvidia driver, kernel module or needed libraries, and then create a new fixed version including the correct driver version number, e.g. resulting in 010-nvidia-340.107-for-k4.20.0-Porteus-v●●●-x86_64_rav.xzm

"●●●" is the correct identified Porteus version, e.g. "4.0" or "3.1".

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

Posted: 10 Jan 2019, 15:45
by Blaze
If you use additional modules, then it is acceptable that their data may be included in the nvidia module.
Can you write the wrong folder(s) and file(s) from additional modules (I need the full correct path to each folders and files)?
Can you share your nvidia xzm module with the trash of additional folders and files.
Thanks.

What's wrong in the name nvidia-390.87-k.4.18.5-porteus-v4.0-x86_64.xzm?

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

Posted: 10 Jan 2019, 15:55
by Rava
Blaze wrote:
10 Jan 2019, 15:45
If you use additional modules, then it is acceptable that their data may be included in the nvidia module.
Can you write the wrong folder(s) and file(s) from additional modules (I need the full correct path to each folders and files)?
Can you share your nvidia xzm module with the trash of additional folders and files.
Thanks.
I PM you a list. When I still got the original modules, I might have deleted these already. But I plan on making one for 4.20.1 so then I can PM you the list.
Blaze wrote:
10 Jan 2019, 15:45
What's wrong in the name nvidia-390.87-k.4.18.5-porteus-v4.0-x86_64.xzm?
Nothing would have been wrong with that name. Seems I was not very precise with my above post. The actual module name would have been
nvidia-*-k.4.18.5-porteus-v4.0-x86_64.xzm


Yes, an actual literal * instead of the nvidia driver version!

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

Posted: 10 Jan 2019, 16:06
by Blaze
Rava wrote:
10 Jan 2019, 15:55
Nothing would have been wrong with that name. Seems I was not very precise with my above post. The actual module name would have been
nvidia-*-k.4.18.5-porteus-v4.0-x86_64.xzm


Yes, an actual literal * instead of the nvidia driver version!
I downloaded NVIDIA-Linux-x86_64-410.93.run and cheked it:

Code: Select all

guest@porteus:/tmp$ ls -l | grep -i nvidia | awk '{print $9}'
NVIDIA-Linux-x86_64-410.93.run
guest@porteus:/tmp$ echo /tmp/nvidia-$(ls /tmp/*.run | basename -s .run *.run | cut -d '-' -f4)-k.$(uname -r)-$(cat /etc/porteus-version | cut -d '-' -f2)-$(arch).xzm
/tmp/nvidia-410.93-k.4.20.0-porteus-v5.0-x86_64.xzm
guest@porteus:/tmp$
:)

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

Posted: 10 Jan 2019, 16:15
by Rava
Well, I not used your code above but used the nvidia.sh

Using the above code indeed creates the correct filename:

Code: Select all

root@porteus:/tmp# ls -l NVIDIA-Linux-x86_64-340.107.run 
-rwxr--r-- 1 root root 70233686 Dec 29 18:50 NVIDIA-Linux-x86_64-340.107.run
root@porteus:/tmp# echo /tmp/nvidia-$(ls /tmp/*.run | basename -s .run *.run | cut -d '-' -f4)-k.$(uname -r)-$(cat /etc/porteus-versiomakesn | cut -d '-' -f2)-$(arch).xzm
/tmp/nvidia-340.107-k.4.20.0-porteus-v●●●-x86_64.xzm
●●● is the correct Porteus version. ;)

But as quoted above, using nvidia.sh as quoted from this thread did not:

Code: Select all

nvidia-*-k.4.19.8-porteus-v●●●-x86_64.xzm
nvidia-*-k.4.20.0-porteus-v●●●-x86_64.xzm

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

Posted: 10 Jan 2019, 16:55
by Ed_P
Rava wrote:
10 Jan 2019, 15:55
Seems I was not very precise with my above post. The actual module name would have been
nvidia-*-k.4.18.5-porteus-v4.0-x86_64.xzm
:%)
Rava wrote:
10 Jan 2019, 07:34
then create a new fixed version including the correct driver version number, e.g. resulting in 010-nvidia-340.107-for-k4.20.0-Porteus-v●●●-x86_64_rav.xzm
brokenman's (?) existing naming convention shown here: http://ponce.cc/porteus/x86_64/current/drivers/

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

Posted: 12 Jan 2019, 05:08
by Rava
^
What is "Hilighting" and why have you put it into someone others quote instead of putting it below the quote like so:
_________________________________________
Mister_Typo wrote:something someother somefurther
(highlighting by me)
_________________________________________

as it should be, since your post looks like that the author of the original quote, in this case yours truly, did wrote "Hilighting mine" in his original post.

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

Posted: 12 Jan 2019, 09:31
by Blaze
Ok. Script was updated.