First of all, find the proper driver for your device. I used nVidia’s driver download page to get the right version: 96.43.20. My card is an nVidia GeForce4 MX 420, and it is not supported on higher version number drivers that support more modern video cards.
Download the driver tarball with your web brower or wget and unarchive it.
cd /root
tar -xzf NVIDIA-FreeBSD-x86-96.43.20
cd /root/NVIDIA-FreeBSD-x86-96.43.20
vi doc/README
As you can see in the documentation, you just need to do a ‘make install’. Before doing so, however, comment out lines 25 through 36 as this check will prevent you from being able to build the driver. (I don’t know why this check was in here…perhaps on more modern drivers this is not necessary)
/*
#if __FreeBSD_version >= 800000
#error This driver does not support FreeBSD 8.x/-CURRENT!
#endif
#if __FreeBSD_version >= 700000 && __FreeBSD_version < 700055 #error This driver does not support FreeBSD 7.x/-CURRENT! #endif #if __FreeBSD_version >= 600000 && __FreeBSD_version < 600034
#error This driver does not support FreeBSD 6.x/-CURRENT!
#endif
#if __FreeBSD_version < 503000
#error This driver requires FreeBSD 5.3 or later!
#endif
*/
Build and install the driver:
make install
If the driver builds with no errors, the driver kernel module should be installed in /boot/modules. To test the driver and make sure that everything works,
I used the nvidia-xconfig tool to create a basic xorg.conf file. The tool automatically detected my video card and setup the correct information in the Device section.
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "NV17 [GeForce4 MX 420]"
BusID "PCI:1:0:0"
EndSection
The tool also added additional required modules by the driver.
Section "Module"
Load "dbe"
Load "dri"
Load "dri2"
Load "extmod"
Load "glx"
Load "record"
EndSection
I then had to customize the monitor settings. I have a wide-screen monitor that I like to run at 1920×1200. I tried explicitly setting this in the Modes subsection of the Screen section, but was unable to get the setting to work (though 1024×768 worked with no problems). Apparently, X is smart enough these days to figure out the max resolution on its own, so I simply commented out the Modes subsection.
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
# Modes "1920x1200" "1024x768" "800x600" "640x480"
EndSubSection
EndSection
I setup the Monitor section with more descriptive names as well as putting in the exact horizontal sync rate and vertical refresh rate from the instruction manual for my Samsung display.
Section "Monitor"
Identifier "Monitor0"
VendorName "Samsung"
ModelName "Syncmaster P2250"
HorizSync 30.0 - 81.0
VertRefresh 56.0 - 60.0
Option "DPMS"
EndSection
To test the configuration, use the -config option on the X program, passing it the customized X configuration.
X -config /root/xorg.nvidia.conf
Once satisfied with the settings, I copied the config file to /etc/X11/xorg.conf and tried to start X Windows.
cp /root/xorg.nvidia.conf /etc/X11/xorg.conf
startx # ugly tvm should start
Finally, with the driver working, it can be added to load automatically during boot, allowing the use of graphical log-in programs such as XDM. To load the driver during the boot stage, add the following to /boot/loader.conf:
nvidia_load="YES"
Next I shall look at configuring XDM so that I don’t have to always manually start X.