Creating Nvidia Driver SFS
This article assumes you're running Fatdog64, but it would also work (with some changes) for 64-bit Puppy Linux too. The variations are also given.
Pre-requisites
- You must have devx.sfs and kernel-source.sfs loaded.
- Find the version of Nvidia card installed in your system
You can do this by opening terminal and running
lspci
, or you can launch "System Information" from Control Panel (or just launchhardinfo
) and then viewing Devices / PCI Devices section. - Once you find out your Nvidia card type, visit this website
http://www.nvidia.com/Download/index.aspx to download the
correct driver for it.
For the rest of this example I'm going to use Nvidia driver 340.104 as an example. It's actual filename is
NVIDIA-Linux-x86_64-340.104.run
, and I will refer to this as the Nvidia tarball for the rest of the steps.Please understand to replace references to this with your own tarball name.
- Some drivers and some kernel versions require patches. Usually
older kernels don't need it because the driver already has the
support; but if you're running the latest and greatest kernel,
Nvidia may not have caught up.
For example, at the time of writing, kernel 4.14 is the "bleeding edge". Nvidia driver 340.104 don't support anything newer than 4.12 yet.
If you want to run it on 4.13 or 4.14 kernels, you need patches, for example, from here: https://devtalk.nvidia.com/default/topic/1025051/fully-working-patches-2-of-them-for-nvidia-driver-340-104-compiler-installer-file-and-linux-kernels-4-13-amp-4-14/?offset=1
- The steps assumes that you have at least 2GB in your /tmp. If you have anything less, the installation still work but you need to use either rw-sandbox.sh or do it in another Linux filesystem that has enough free space.
Note 1: The following steps will work for either creating the SFS or direct installation. If you are doing direct installation, just skip the parts that mention "sandbox".
Note 2: The steps below is for Fatdog64 700 onwards.
If you're on Puppy Linux, please note the additional steps meant for Puppy. For Fatdog, you can do this while running in RAM (first boot) but for Puppy, you need to create a savefile first because sandbox does not work when Puppy doesn't have a savefile.
For older Fatdogs, use the Puppy Linux instructions (except the part about deleting /tmp).
Steps
- Open terminal (call this as terminal #1), and from this terminal, launch sandbox by running
sandbox.sh
- (Puppy Linux only) Because of a bug, you need to delete /tmp and
re-create it. Run the command
rm -f /tmp; mkdir /tmp
- Create the blacklist file to stop nouveau from being loaded:
echo "blacklist nouveau" > /etc/modprobe.d/nouveau.conf
- (Puppy Linux only) In Puppy Linux you need to install the
32-bit library in /usr/lib32 because /usr/lib is a symlink to /usr/lib64.
So, if you plan to install 32-bit library (most probably yes if you plan to use Wine to run 3D games), you need to install it to /usr/lib32 and also include /usr/lib32 to the system library search path.
echo /usr/lib32 >> /etc/ld.so.conf
- Copy the Nvidia driver tarball (and any patches) to the sandbox:
cp /path/to/NVIDIA-Linux-x86_64-340.104.run /mnt/sb/fakeroot/tmp
- Then extract the driver:
cd /tmp sh NVIDIA-Linux-x86_64-340.104.run -x
- Then install the OpenGL library.
cd NVIDIA* ./nvidia-installer -a -ui=none --no-nouveau-check --no-x-check --no-kernel-module
For Puppy Linux, run the following instead of the above:
cd NVIDIA* ./nvidia-installer -a -ui=none --no-nouveau-check --no-x-check --no-kernel-module --compat32-libdir=lib32
Note the addition of
compat32-libdir
parameter to tell the installer to install 32-bit libraries to/usr/lib32
instead of the default/usr/lib
. - You will be asked two questions during the process above.
Do you want to install 32-bit compatibility library?
Answer: As needed (either yes or no). Most probably yes if you want to use the driver with Wine to play games.
Do you want to run nvidia-xconfig?
Answer: NO. If you answer yes, it will create configuration not compatible with modern Xorg.
- Patch the kernel if necessary. The actual instruction variess with the patch,
but usually it looks like something like this:
patch -Np1 -i /tmp/patch-filename.patch
- Once you've patch the kernel, build and install it.
Note: If your model have the support for video acceleration, you will have the
uvm
module. If not, then skip that part.cd kernel make module make module-install cd uvm make module make module-install
- (Fatdog only) Depending on your video driver, you may need to
force Xorg to use nvidia driver. Some machines need it, some
don't, so it's just best to do it.
For Puppy Linux, you will need to set this one up manually later after you boot (actual step not included because I'm not sure where the Xorg config file is stored for Puppy Linux).
cat > /etc/X11/xorg.conf.d/20-gpudriver.conf << EOF Section "Device" Identifier "Device0" Driver "nvidia" #Choose the driver used for this monitor EndSection EOF
- (Fatdog only - optional) You may want to include nvidia-settings
in Control Panel for easy access. If you don't do this you can still
run
nvidia-settings
manually later on.cat > /etc/control-panel-applets.dir/nvidia << "EOF" # insert nvidia control to desktop front=${TAB2_DESKTOP%%|*} back=${TAB2_DESKTOP#*|} TAB2_DESKTOP="${front}|nvidia-settings ${back}" EOF
- You're done. If you don't use sandbox, you just need to do this:
depmod -a
If you use sandbox, don't do this, and read on.
- Open another terminal (terminal #2). If you're doing this in the
Linux console, then switch to another virtual terminal.
- In this terminal #2, type
cd /tmp sb2dir.sh nvidia rox nvidia
This will copy the contents of your sandbox to /tmp/nvidia, and ROX-Filer will open it. From here, you can delete some unnecessary files.
Here are the files you can delete:
etc/ld.so.cache
var
root
tmp
(Puppy Linux only)- Make an SFS out of that cleaned-up directory.
dir2sfs nvidia
Older Fatdogs may not have dir2sfs, use mksquashfs directly:
mksquashfs nvidia nvidia.sfs
For Puppy Linux with dir2sfs support, use
dir2sfs
as above. Otherwise usedir2pet
, and follow the usual prompts when creating a PET package.dir2pet nvidia
- Copy the resulting SFS or PET package to somewhere safe.
Then exit and close terminal #2.
Then exit and close terminal #1.
- To use the SFS, load it and configure it so that it is loaded
automatically at boot (using System SFS Loader for Fatdog, and
similar tool on Puppy).
After the SFS is loaded, run
depmod -a
Then reboot.
When done, close ROX-Filer window. Note: If you're running this from Linux console, obviously you can't use Rox. Do the equivalent thing to clean up the files.