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

Click the ' Download ' button

4. Press the ' Download ' button

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 Download nvidia.sh
Code: Select all
#!/bin/bash
# Build of Nvidia video driver, cleaning and compressing to xzm module for Porteus
# You can use this script for both architectures i586 or x86_64
# Version 2019-07-30
# Written by Blaze <admin at ublaze.ru>
# Modified by fulalas
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Root check
if [ `whoami` != "root" ]; then
echo -e "\e[1m\e[31mOnly root can run this.\e[0m"
exit 1
fi
# Creating installer variable and folder
MODULES_FOLDER=$(readlink -f /mnt/live/porteus/modules)
INSTALL_TEMP_FOLDER=/tmp/nvidia-$$
mkdir $INSTALL_TEMP_FOLDER
# Checking and extracting blacklist.xzm
if [ -f blacklist.xzm ]; then
xzm2dir blacklist.xzm $INSTALL_TEMP_FOLDER &>/dev/null
elif [ -f "$PORTDIR/optional/blacklist.xzm" ]; then
xzm2dir "$PORTDIR/optional/blacklist.xzm" $INSTALL_TEMP_FOLDER &>/dev/null
elif [ -f "$PORTDIR/base/blacklist.xzm" ]; then
xzm2dir "$PORTDIR/base/blacklist.xzm" $INSTALL_TEMP_FOLDER &>/dev/null
else
echo -e "\e[1m\e[31mblacklist.xzm couldn't be found.\e[0m"
rm -rf $INSTALL_TEMP_FOLDER
exit 1
fi
# Selective compression and extraction of memory changes
sync; echo 3 > /proc/sys/vm/drop_caches
echo -e '\n\033[1m\e[32m[*]\e[0m\033[1m Compression of memory changes to /tmp/nvidia.tar.gz...\033[0m'
tar czf /tmp/nvidia.tar.gz --exclude={"*/.*","*/.wh.*",".cache","dev","home","mnt","opt","root","run","tmp","var","etc/bootcmd.cfg","etc/ld.so.cache","etc/fstab","etc/random-seed","etc/cups","etc/udev","etc/profile.d","etc/porteus","etc/X11/xorg.conf.nvidia-xconfig-original","lib/firmware","lib/modules/*porteus/modules.*","usr/man","usr/src","usr/bin/gnome-keyring-daemon","usr/lib/gio","usr/lib/gtk-2.0","usr/lib/gtk-3.0","usr/lib/libXvMCgallium.so.1","usr/lib/libbrscandec2.so.1","usr/lib/libgsm.so.1","usr/lib/libudev.so.1","usr/lib/libunrar.so.5","usr/lib64/gio","usr/lib64/gtk-2.0","usr/lib64/gtk-3.0","usr/lib64/libXvMCgallium.so.1","usr/lib64/libbrscandec2.so.1","usr/lib64/libgsm.so.1","usr/lib64/libudev.so.1","usr/lib64/libunrar.so.5","usr/local","usr/share/glib-2.0","usr/share/mime","usr/share/pixmaps","usr/share/applications/mimeinfo.cache","usr/local/share/applications/mimeinfo.cache","usr/share/doc/NVIDIA_GLX-1.0/html","usr/share/doc/NVIDIA_GLX-1.0/sample","usr/share/doc/NVIDIA_GLX-1.0/LICENSE","usr/share/doc/NVIDIA_GLX-1.0/NVIDIA_Changelog","usr/share/doc/NVIDIA_GLX-1.0/README.txt"} -C /mnt/live/memory changes
echo -e "\n\033[1m\e[32m[*]\e[0m\033[1m Extraction of memory changes from /tmp/nvidia.tar.gz to $INSTALL_TEMP_FOLDER...\033[0m"
tar xf /tmp/nvidia.tar.gz --strip 1 -C $INSTALL_TEMP_FOLDER
# Сleaning driver
echo -e "\n\033[1m\e[32m[*]\e[0m\033[1m Cleaning of driver directory...\033[0m"
rm -rf $INSTALL_TEMP_FOLDER/{.cache,dev,home,mnt,opt,root,run,tmp,var}
find $INSTALL_TEMP_FOLDER -type f -maxdepth 1 -delete
find $INSTALL_TEMP_FOLDER -type l -maxdepth 1 -delete
find $INSTALL_TEMP_FOLDER/etc/ -type f -maxdepth 1 -delete
find $INSTALL_TEMP_FOLDER/etc/ -type d ! -iname 'modprobe.d' ! -iname 'OpenCL' ! -iname 'vulkan' ! -iname 'X11' ! -iname 'etc' -maxdepth 1 -exec rm -rf '{}' '+'
rm -f $INSTALL_TEMP_FOLDER/etc/X11/xorg.conf.nvidia-xconfig-original
rm -rf $INSTALL_TEMP_FOLDER/lib/firmware
rm -f $INSTALL_TEMP_FOLDER/lib/modules/*porteus/modules.*
rm -rf $INSTALL_TEMP_FOLDER/usr/{man,src}
rm -f $INSTALL_TEMP_FOLDER/usr/bin/gnome-keyring-daemon
rm -rf $INSTALL_TEMP_FOLDER/usr/lib/{gio,gtk-2.0,gtk-3.0}
rm -f $INSTALL_TEMP_FOLDER/usr/lib/{libXvMCgallium.so.1,libbrscandec2.so.1,libgsm.so.1,libudev.so.1,libunrar.so.5}
rm -rf $INSTALL_TEMP_FOLDER/usr/lib64/{gio,gtk-2.0,gtk-3.0}
rm -f $INSTALL_TEMP_FOLDER/usr/lib64/{libXvMCgallium.so.1,libbrscandec2.so.1,libgsm.so.1,libudev.so.1,libunrar.so.5}
rm -rf $INSTALL_TEMP_FOLDER/usr/local
rm -rf $INSTALL_TEMP_FOLDER/usr/share/{glib-2.0,mime,pixmaps}
rm -f $INSTALL_TEMP_FOLDER/usr/{,local/}share/applications/mimeinfo.cache
rm -rf $INSTALL_TEMP_FOLDER/usr/share/doc/NVIDIA_GLX-1.0/{html,sample,LICENSE,NVIDIA_Changelog,README.txt}
# Adding vdpau hardware video decode rule
if [ -f /etc/profile.d/vdpau.sh ]; then
mkdir -p $INSTALL_TEMP_FOLDER/etc/profile.d
cp -a /etc/profile.d/vdpau.sh $INSTALL_TEMP_FOLDER/etc/profile.d
sed -i 's|#export VDPAU_DRIVER="nvidia"|export VDPAU_DRIVER="nvidia"|' $INSTALL_TEMP_FOLDER/etc/profile.d/vdpau.sh
sed -i 's|export VDPAU_DRIVER="va_gl"|#export VDPAU_DRIVER="va_gl"|' $INSTALL_TEMP_FOLDER/etc/profile.d/vdpau.sh
else
echo -e "\n\e[1m\e[31mvdpau.sh couldn't be found. Hardware video decode won't work properly.\e[0m"
fi
# Getting driver version
case $(arch) in
i486) LIBDIR="/usr/lib"
;;
x86_64) LIBDIR="/usr/lib64"
;;
*) LIBDIRSUFFIX="/usr/lib"
;;
esac
DRIVER_FILE=$(find $LIBDIR/libEGL_nvidia.so* \! -type l)
DRIVER_VERSION=${DRIVER_FILE: -6}
# Creating final module
MODULE_FILENAME=08-nvidia-$DRIVER_VERSION-k.$(uname -r)-$(cat /etc/porteus-version | cut -d '-' -f2)-$(arch).xzm
dir2xzm $INSTALL_TEMP_FOLDER/ /tmp/$MODULE_FILENAME 2>/dev/null
mv /tmp/$MODULE_FILENAME $MODULES_FOLDER
# Removing temporary files
rm -f /tmp/nvidia.tar.gz
rm -f /tmp/nvidia.xzm
rm -rf $INSTALL_TEMP_FOLDER
# Reboot
echo -e "\n\e[1m\e[32m[DONE]\e[0m \e[1mYou can find your Nvidia driver module in \e[96m$MODULES_FOLDER\e[0m"
echo -e "\e[1m>>> Now you can reboot Porteus via \e[92mreboot\e[0m \e[1mcommand <<<\e[0m\n"
/etc/modprobe.d/nvidia-installer-disable-nouveau.conf
Code: Select all
# generated by nvidia-installer
blacklist nouveau
options nouveau modeset=0
7. Restart Porteus in ' Text mode '

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

9. Copy NVIDIA-Linux-x86-340.96.run (current version at the time of this writing, or a differnt version needed for your card), nvidia.sh to the /tmp directory.
For convenience, you can use the Midnight Commander. Enter the commandNote. Nvidia driver and nvidia.sh can to be located not only at /tmp.
If your PC has a small amount of memory (RAM) - recommendation to put these stuff on the Linux partition (e.g. ext2, ext3, ext4, etc...), for example /mnt/partition-of-your-hard-drive
Warning! This file system are must to support Unix / Linux File Permissions.
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 vdpau.sh
- copy these files from the left column to the right column with an open /tmp directory and press F10
Code: Select all
mc /mnt/path/to/nvidia-files /tmp

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
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.

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

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?
- if you want to play Windows games via Wine or Steam, you will need to answer 'Yes'.
Note. If you answered 'Yes', then you need to install Wine and 0050-compat32-multilib-lite-x86_64 (if you have a 64-bit operating system)
link for x86 | link for x86_64 - if you don't want to play Windows games via Wine or Steam, you will need to disagree and choose 'No'.
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.

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.

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.
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
Other examples of module names:
- nVidia-340.96-porteus-v3.2rc2-i586.xzm
- nVidia-340.96-porteus-v3.2rc2-x86_64.xzm
Note. If need you can remove blacklist.xzm from /porteus/base/ or move it to another place.
Code: Select all
reboot
Screenshots :

