This is for anyone toying with getting the "legacy" NVidia proprietary
drivers (NVIDIA-Linux-x86-1.0-7174-pkg1) to work with newer kernels
such as linux-source-2.6.15 available at www.backports.org.
I had never compiled a kernel before yesterday, having only been a
Debian GNU/Linux user since about May of last year. In the process of
learning about Linux from total ignorance, I finally reached the point
where it was time for me to configure and build my own custom kernel.
I have an older Pentium 3 machine and a newer Pentium 4 machine that
I am using to learn about home networking, so I decided to build my
first kernel for the older box.
I have runlevel 2 configured to disable 'gdm', and I have
'/boot/grub/menu.lst' configured (in the Automagic Kernels zone) to
create an extra GRUB line to boot runlevel 3 for any kernel I install.
I always keep an older, known-to-work kernel in place along with my
current preferred kernel.
I researched the hardware on the P3 box, and took notes on
kernel-related subjects for about the past month: configuration
options, methods for compiling (Debian 'kernel-package' vs.
traditional kernel.org commands), devfs transitions, initial ramdisk
transitions, etc., etc. There is an unbelievable amount of
contradictory information out there!
Most folks just take the config from a stock kernel, maybe make a few
changes, then compile away. I was unhappy with that approach, and
tortured myself for the past few weeks researching from ground zero.
I installed the tools to make a 'yaird'-style initrd, but decided to
create a non-initrd kernel that fits my P3 box like a glove. After
nearly 2 hours of configuring using 'make menuconfig' (I actually
preferred it instead of 'make gconfig'), I tried compiling... and it
worked! (I had mistakenly left a debug feature enabled which started
filling up my logs in /var/log, so I had to do a recompile... which
also succeeded.) Further details upon request....
I decided to try for the NVidia 3D support, even though the
motherboard Vanta card is laughable by today's standards. (It's even
worse without any help from these nonfree drivers, though!!) A few
weeks ago I practiced on my 'Sarge' 2.6.8-2-686 kernel, and the
proprietary installer worked just fine... it does everything for you,
so you just sit there and watch. The hardest thing was making sure I
had the 'kernel-headers' package installed, but that was easy using
tools like 'aptitude'.
I chose the proprietary driver instead of the Debian packages because
I knew that I was going to be compiling a very new linux-source
package, and there is no Debian support for such new kernels. I
expected to have problems with this ancient 1.0.7174 driver, which
continues to age while the kernels continue to evolve. That driver is
the last one NVidia released which supports my crufty old Vanta, so
I'm stuck with it until NVidia release new "legacy" drivers (if ever).
I tried the same NVidia installer with my custom 2.6.15 kernel, but I
got an error message telling me that they weren't compatible. There
have been posts on 'debian-user' about patches, and there are patches
posted at the nvnews.net forums. I had some difficulties, which I
will explain presently, but I believe that either of these patches
would have allowed the old 1.0.7174 driver to work with the new kernel
source:
NVIDIA_kernel-1.0-7174-1386866.diff.txt
NVIDIA_kernel-1.0-8178-1449645.diff.txt
I ended up using the first one, which is a few months old on the
nvnews.net forums. The second one I tried first, yesterday, and it
was also working, but I was confused about the problems I encountered
and ended up uninstalling the 3D drivers (and reinstalling) numerous
times until I solved the problem tonight. The solution is a
workaround, and I am still looking into the Right Way of solving the
problem, but I could actually just leave things the way they are and
just be happy until this old P3 box drops dead.
The big problem was this: the installer compiled the needed kernel
module and placed the binary blobs in the right place, and after I
reconfigured /etc/X11/XF86Config-4 appropriately I was able to start
'gdm' just fine... until I rebooted. I didn't reboot for many hours,
feeling confident that all was well and I could start compiling the
kernel version for the P4 box. The thought occured to me that I
should see if it reboots correctly, and when I tried it 'gdm' couldn't
start and retried a few times (in a very annoying fashion) before it
finally gave up.
I tried everything I could think of but nothing allowed gdm to start,
and was going to recompile tonight hoping that some magical
configuration change would make everthing OK. It was so damned
frustrating! I could start 'gdm' every time I reinstalled the NVidia
module, but it would never work when I rebooted! I thought the gods
were playing a practical joke, or something....
I had to work today, so I was thinking about it on and off whenever I
had a spare moment. Something that the installer was setting up was
being lost at reboot. What was it?
From the past month of research, I realized that the newer kernels
handle the /dev device nodes dynamically: they are no longer "files"
on a disk, but are recreated each time the system reboots, or whenever
a supported device is hotplugged that requires device nodes. This old
NVidia driver could not possibly know how to handle the situation
correctly, so whatever changes it made in /dev were being lost, and
nothing else on my system knew anything about it.
Here is what I know about the problem so far, and how I finally got
something to work:
1) If you use the "--extract-only" option with the NVidia installer,
as you _must_ if you're going to patch it, you will be able to find
the file that modifies '/dev', a script called 'makedevices.sh' in the
'../usr/src/nv' directory below the directory created by
"--extract-only". The important code looks like this:
if [ ! -c /dev/.devfsd ]; then
for i in 0 1 2 3 4 5 6 7; do
node="/dev/nvidia$i"
rm -f $node
mknod $node c 195 $i || error "mknod \"$node\""
chmod 0666 $node || error "chmod \"$node\""
done
node="/dev/nvidiactl"
rm -f $node
mknod $node c 195 255 || error "mknod \"$node\""
chmod 0666 $node || error "chmod \"$node\""
fi
There is code just after this which is supposed to allow 'udev' to
handle the situation properly, and this is what I hope to modify
(tomorrow... it's getting late and I'm getting tired tonight!) to
create the Right Way solution. Essentially, this script creates nodes
in /dev required by the 'nvidia' module; if they're not present when
'nvidia' gets loaded, it dies... preventing X ('gdm', in my case) from
starting.
I Googled, and found a forum somewhere with a suggestion (in 2003) to
modify a file called 'rc.sysinit', adding the lines above with the
'if'/'fi' statements removed. The idea was to manually recreate the
same /dev nodes at each reboot that the NVidia installer creates when
it runs. I thought that was worth a try!
The corresponding file on Debian seems to be '/etc/init.d/rcS', which
is listed in '/etc/inittab' as the script to run to initialize the
system. I tried placing the code from above in there, near the top of
the file, but it didn't work. I don't understand all of the low-level
issues well enough, but I guess it was too early in the boot process
for code like that to run. (Someone else care to educate me on these
matters? I would be most grateful.)
I decided to try placing the code somewhere just before 'gdm' gets
started. This way it's not too soon in the boot process, but the
nodes get created before 'gdm' tries to load the 'nvidia' module.
Instead of trying to modify things in individual '/etc/rc[2-5].d'
directories, I decided to add the code to the 'gdm' script itself:
'/etc/init.d/gdm'.
That worked! Near the top of the 'gdm' script I have placed these lines:
# 060412 Hack to create nvidia nodes in /dev/ to allow a new
# kernel 2.6.15.060411.p3 use NVidia 3D drivers
#
# This code is copied from 'usr/src/nv/makedevice.sh' from the
# NVidia installer source obtained with "--extract-only"
for i in 0 1 2 3 4 5 6 7; do
node="/dev/nvidia$i"
rm -f $node
mknod $node c 195 $i || error "mknod \"$node\""
chmod 0666 $node || error "chmod \"$node\""
done
node="/dev/nvidiactl"
rm -f $node
mknod $node c 195 255 || error "mknod \"$node\""
chmod 0666 $node || error "chmod \"$node\""
Now 'gdm' starts just fine when I reboot, and '/var/log/XFree86.0.log'
shows no errors.
Like I said, tomorrow I'm going to read up on 'udev' and see if I can
do this The Right Way. Maybe someone else can explain it to me in the
meantime? I would be grateful for that, too.
In any case, I hope this scroll may be of some usefulness for folks
out there wanting to use old NVidia drivers with new custom kernels on
Debian.
Dave Witbrodt
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]