Page 1 of 3

How to create a Nvidia driver xzm module

Posted: 18 Nov 2016, 04:51
by fulalas
This is the script for those who want to create their own Nvidia xzm module from Nvidia driver setup.

Warning: at the moment it works only for x64 systems.

1- First you should copy and paste the script below and save it as nvidia-driver.sh in any persistent folder. But make sure this path is NOT inside a FAT partition, but a partition that supports symlinks, as NTFS, for example.

2- Then you should download the appropriate Nvidia driver for your card on Nvidia's webiste. Refer to this topic as a guide.

3- Download blacklist.xzm, devel.xzm and crippled_sources.xzm ( http://dl.porteus.org/x86_64/Porteus-v3.2.2/kernel/ ) to your usb stick/porteus/base.

4- If you already have a Nvidia driver xzm module running, remove it or change file location and reboot in order to make a clean installation.

5- Reboot, enter in Text Mode and login as root.

6- Find the driver path and call: sh driver.run
(where 'driver' is the name of the file)

7- Accept the terms and press Enter. After a while it'll ask for generating libs for 32 bits applications. You probably don't want to do that, so choose 'no'. After a few seconds a new question will appear asking something about nvidia-xconfig so you should choose 'yes'. Wait a little bit and then hit Enter to exit.

8- Now find the script path of the first step of this tutorial and execute it: sh nvidia-driver.sh. You have to be patience as it'll create a module with all changes made after the boot, then it'll extract everything, make a clean-up and a few tricks and finally it'll create the new xzm module.

9- After the script finishes you should copy the new module (by default nvidia-cleaned-driver.xzm) to your usb stick/porteus/modules and reboot in Graphics Mode. Also, you don't need to load the modules from step 3 anymore.

10- Once inside the GUI, run nvidia-settings and make sure that there's no error message. Now you can run glxgears and pray for those 3 colored gears to appear.

11- If everything went fine so far, here comes the last and most scary step: still inside the GUI go to a terminal as root and run ldconfig. Now repeat step 10. If there's no error at all, you're finally good to go. :good:

Code: Select all

echo Saving changes after Nvidia driver setup. This may take some time...
save-changes nvidia-driver.xzm
rm -r nvidia-driver &>/dev/null
rm -r nvidia-cleaned-driver &>/dev/null
/opt/porteus-scripts/context-menu/extract-module ./nvidia-driver.xzm &>/dev/null
mv nvidia-driver/ nvidia-cleaned-driver/
cd nvidia-cleaned-driver

echo Main folder cleaning...
rm -fr dev
rm -fr home
rm -fr mnt
rm -fr root
rm -fr tmp
rm -fr var

echo Etc folder cleaning...
rm -f etc/* &>/dev/null
rm -fr etc/gtk-2.0
rm -fr etc/lvm
rm -fr etc/profile.d
rm -fr etc/rc.d
rm -fr etc/udev

echo Lib folder cleaning...
rm -f lib/modules/4.*/* &>/dev/null

echo Usr folder cleaning...
rm -fr usr/src
rm -fr usr/local
rm -fr usr/man
rm -fr usr/share/doc
rm -fr usr/share/mime
rm -fr usr/share/applications/mimeinfo.cache

rm -fr usr/lib64/gio
rm -fr usr/lib64/gtk-2.0
rm -fr usr/lib64/gtk-3.0
rm -fr usr/lib64/gio

rm -f usr/lib64/libEGL.so
rm -f usr/lib64/libEGL.so.1
rm -f usr/lib64/libGL.so
rm -f usr/lib64/libGL.so.1

rm -f usr/lib64/libGLESv1_CM.so
rm -f usr/lib64/libGLESv1_CM.so.1

rm -f usr/lib64/libGLESv2.so
rm -f usr/lib64/libGLESv2.so.2

rm -f usr/lib64/libudev.so.1
rm -f usr/lib64/libunrar.so.5
rm -f usr/lib64/libXvMCgallium.so.1

# this is a trick to avoid ldconfig reseting libGL.so.1 symlink to libGL.so.1.2.0 that comes with Porteus on some configurations
echo Fixing libGL symlinks...
cd usr/lib64/
if [ -f "libGL.so.1.0.0" ]
then
	cp libGL.so.1.0.0 libGL.so.1.2.0
	cp -s libGL.so.1.2.0 libGL.so
	cp -s libGL.so.1.2.0 libGL.so.1
	
	cp libGLESv1_CM_nvidia.so.3* libGLESv1_CM.so.1.1.0
	cp -s libGLESv1_CM_nvidia.so.3* libGLESv1_CM.so
	cp -s libGLESv1_CM_nvidia.so.3* libGLESv1_CM.so.1

	cp libGLESv2_nvidia.so.3* libGLESv2.so.2.0.0
	cp -s libGLESv2_nvidia.so.3* libGLESv2.so
	cp -s libGLESv2_nvidia.so.3* libGLESv2.so.2
else
	cp -s libGL.so.3* libGL.so
	cp -s libGL.so.3* libGL.so.1

	cp -s libGLESv1_CM.so.3* libGLESv1_CM.so
	cp -s libGLESv1_CM.so.3* libGLESv1_CM.so.1

	cp -s libGLESv2.so.3* libGLESv2.so
	cp -s libGLESv2.so.3* libGLESv2.so.2
fi

echo Disabling nouveau...
cd ../..
mkdir etc/modprobe.d
cp /etc/modprobe.d/nvidia-installer-disable-nouveau.conf etc/modprobe.d

echo Creating module...
cd ..
rm nvidia-cleaned-driver.xzm &>/dev/null
dir2xzm nvidia-cleaned-driver nvidia-cleaned-driver.xzm &>/dev/null

echo Removing temp files...
rm -fr nvidia-cleaned-driver
rm -f nvidia-driver.xzm

echo Finished.

Re: How to create a Nvidia driver xzm module

Posted: 19 Nov 2016, 02:03
by Bogomips
Hi fulalas, thought I might share this with you as you seem to like looking into these things, and get your feedback. Maybe you can confirm this from perusal of the script that you referenced.

The situation is that am not able to run KDE on my nachine without nvidia driver, as Nouveau is not able to cope, Since being strapped for memory 879MiB on a slow CPU 880MHz, not able to enjoy the KDE experience as it's either ithe nvidia driver or KDE that can load into ram, but not both. So far been running KDE looped on the ISO, just about bearable.

In an effort to get KDE as well into ram, have taken out Sources and the Nvidia compiler library from driver module. This has reduced driver module size from 34M to 24M. Base and Nvidia Modules now fit into ram, and so far so good, without incident, and am better able to enjoy the KDE experience. :)

Re: How to create a Nvidia driver xzm module

Posted: 19 Nov 2016, 05:42
by fulalas
Thanks, Bogomips! I'm already doing what you're suggesting. Look at the line in the script that removes src folder ;)

But I see that you're using 304.xx driver version which is way lighter than newer drivers that now are around 50mb.

Have you managed to solve the symlink problem on the module you posted earlier in module section of this forum?

Re: How to create a Nvidia driver xzm module

Posted: 19 Nov 2016, 12:18
by Bogomips
fulalas wrote:Have you managed to solve the symlink problem on the module you posted earlier in module section of this forum?
Only use it to run basic KDE stuff, so have not come across a symlink problem, even before on driver modules made for the RCs. Also have had no feedback on those modules. Maybe something in the newer driver versions?

P.S. Also adopt a slightly different procedure. Descend into decompressed nvidia driver and run ./nvidia-installer -zXZ. When finished, savie changes as module and do init 4 to get into GUI and check that all running fine with the new driver. Then reboot to a tried and tested DE, where have been paring it down manually. But recently with different kernels coming along, have made script out of the step by step statements which are aligned on this driver.

Re: How to create a Nvidia driver xzm module

Posted: 21 Nov 2016, 21:23
by fulalas
Bogomips wrote:Only use it to run basic KDE stuff, so have not come across a symlink problem, even before on driver modules made for the RCs. Also have had no feedback on those modules. Maybe something in the newer driver versions?
I think it has something to do with my current configuration and Linux native drivers, as even booting on AF mode I see these two libs: libGL.so.1.0.0 and libGL.so.1.2.0. They don't show on my gf's laptop although it has a Nvidia card.
Bogomips wrote:P.S. Also adopt a slightly different procedure. Descend into decompressed nvidia driver and run ./nvidia-installer -zXZ. When finished, savie changes as module and do init 4 to get into GUI and check that all running fine with the new driver. Then reboot to a tried and tested DE, where have been paring it down manually. But recently with different kernels coming along, have made script out of the step by step statements which are aligned on this driver.
Hmmm... I'm curious. What's the meaning of this '-zXZ' parameter?

Re: How to create a Nvidia driver xzm module

Posted: 21 Nov 2016, 23:34
by Bogomips
fulalas wrote:
Bogomips wrote:Hmmm... I'm curious. What's the meaning of this '-zXZ' parameter?

Code: Select all

sh /Path/to/NVIDIA-Linux-x86_64-367.57.run  -A
:wink:

How to create a Nvidia driver xzm module

Posted: 11 Feb 2017, 09:43
by Evan
<removed>

How to create a Nvidia driver xzm module

Posted: 15 Feb 2017, 14:50
by Evan
<removed>

How to create a Nvidia driver xzm module

Posted: 18 Feb 2017, 10:03
by Evan
<removed>

Re: How to create a Nvidia driver xzm module

Posted: 18 Feb 2017, 13:34
by fulalas
Hmmmm... It seems there is a error with the first command (save-changes). Does your path contain any space character?

How to create a Nvidia driver xzm module

Posted: 18 Feb 2017, 13:42
by Evan
<removed>

Re: How to create a Nvidia driver xzm module

Posted: 18 Feb 2017, 21:47
by fulalas
I never used Porteus inside VirtualBox.

But, see, the error is on the first line, so everything beyond will have errors, of course. Did you login as root? You have to. If you did, try to run line by line (by copy and paste).

How to create a Nvidia driver xzm module

Posted: 18 Feb 2017, 23:42
by Evan
<removed>

Re: How to create a Nvidia driver xzm module

Posted: 19 Feb 2017, 00:35
by fulalas
Evan wrote:

Code: Select all

dir2xzm /mnt/live/memory/changes /tmp/nvidia.xzm
A fresh ISO install ,followed your guide step by step , logged in as root text.

When your script failed the above command worked for creating a standard module , so path to /tmp is working.
The first command of the script is:

Code: Select all

save-changes nvidia-driver.xzm
Try this and check the output. Also, notice if you're running inside a path that contains any space character (at the moment Porteus scripts, like 'save-changes' and 'dir2xzm' don't work with spaces).

How to create a Nvidia driver xzm module

Posted: 19 Feb 2017, 02:07
by Evan
<removed>