A few months, I blogged about the pains I had with my nVidia FX 5200 graphics card, Debian and current kernels.
I have solved the issue in the mean time and would like to document what I did. This has been updated to reflect driver 173.14.20 from July 2009.
Currently, the package nvidia-graphics-drivers has its version 173.14.09 in Testing and Unstable; and 177.82 in Experimental. There is also a package nvidia-graphics-drivers-legacy from 2006 in stable.
177.82 does build with recent kernels, but doesn't support my old FX card. 173.14.09 supports my FX card, but doesn't build with recent kernels. I didn't try the legacy stuff because of its old age.
The actual solution was easy: The current "legacy beta" driver that can be downloaded from the nVidia ftp server has 173.14.20, which happens to build with a recent kernel and supports my FX card, as kju pointed out in a comment to my original blog entry. I then took the 173.14.09 diff from Debian unstable, put it over the pkg0.run and pkg2.run archives from nvidia (i386 and amd64), modified debian/upstream_info and built. This first failed because some Debian patches didn't apply correctly, but since the file name patches/xen.patch suggested that it was only needed for xen systems, I dared to remove it. Leaving the patches/ directory empty made the build system topple, so I touched an empty file into patches and the build went fine.
Out of the resulting nvidia-kernel-source, I was able to compile kernel modules against 2.6.30, and am now back in business even with a recent kernel.