Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:
 
 

Generating a custom 2.4 kernel for nForce-based motherboards

by Andre Costa (Contributing Writer)

nForce-based mobos are not fully supported by the Linux kernel, and special (proprietary) drivers are needed in order for features such as sound and networking to work. This document describes how to download the necessary files, build a custom kernel and configure and activate these features.

NOTES:
  • even though kernel compilation on RPM-based systems can be done from SRPM, I will cover here the process of generating custom kernels from kernel-source RPMs
  • this procedure is related to kernel 2.4 only. Even though procedures for kernel 2.6 might be similar, it is a whole different animal, and you're on your own if you want to try it.

Getting the files

RPMs can be downloaded and installed from a handful of places, and in many different ways (apt-get, yum, up2date etc.). I will assume you already know how to get and install RPMs with any of the mentioned methods.

kernel sources
kernel-source Fedora RPMs are named like:
kernel-source-x.x.xx-y-zzzz.nptl
where x.x.xx is the kernel version (eg. 2.4.22), y is the package version (usually 1) and zzzz corresponds to RH internal version number for this specific release (eg. 2149)

nForce drivers
nForce drivers must be downloaded directly from NVIDIA. Make sure you download the SRPM (usually at the bottom of the file list, on the "Alternative Installation" section). As of this writing the latest version was NVIDIA_nforce-1.0-0261.src.rpm

Compiling a custom kernel

The newly installed kernel sources are stored at /usr/src, under the name linux-x.x.xx-y-zzzz.nptl (where numbers are the same explained above). A symbolic link named linux-x.x is created on the same dir, pointing to the real source dir.

First thing you must do on the linux-x.x directory is:

make mrproper

NOTE: I just can't emphasize this enough. Not doing this is a common oversight, and will inevitably lead to strange problems, such as modules failing to compile. I wasted a lot of time tackling kernel compilation errors simply because I missed this step.

Then, kernel configuration goes with 'make menuconfig' or 'make xconfig', depending on your personal taste. I assume you know what you're doing, details about kernel configuration are beyond the scope of this document.

NOTE: make sure you enable RAM disk support on the Block devices section. If you don't do this, your kernel will fail to mount partitions referenced by labels on GRUB/LILO. If this happens, your custom kernel simply won't boot, because the root partition is itself referenced by a label.

After configuring the kernel to suit your needs, compilation/installation is usually handled by

make dep bzImage modules modules_install install

YMMV, do it whatever way you're used to. Just make sure you either do the final install step as described above or manually configure your boot loader to be aware ofyour new kernel.

Compiling nForce drivers

Before tackling nForce drivers configuration, the new kernel must be loaded. Time for a reboot. As you already guessed, you won't have networking nor sound with the new kernel yet. Hold on, we're almost there. Before booting, it doesn't hurt to check LILO/GRUB's configuration, just in case. 'make install' usually does a pretty decent job, and at least with GRUB the new kernel is configued as a new entry and your current (working) kernel is kept as the default (BTW: make sure you actually choose your new kernel on the boot loader prompt when you reboot).

After boot, you new kernel should be up and running, and hopefully the only complaint during boot was the failure to start networking services. Time to fix this.

NOTE: Remember that this depends directly on how you configured your kernel. If you screwed up during the configuration, lots of other things could go wrong during boot. Again, we'll deal only with network/audio drivers here.

Before we build the binary RPM from SRPM, make sure you follow the instructions here to properly configure your environment. Remember: compiling RPMs as root is a BadThing.

Assuming your environment is properly configured, all you have to do is:

rpmbuild --rebuild --clean [nForce-SRPM-file]

(no brackets)

This will generate a binary RPM file somewhere depending on your configuration. Look for:

Wrote: [path]/[rpm-file-name]

on rpmbuild's output, near the end. This will give you the absolute path to your RPM. You can check what's in there with:

rpm -qpl [path]/[rpm-file-name]

Here on my system it ouputs:

$ rpm -qpl NVIDIA_nforce-1.0-0261.athlon.rpm
/lib/modules/2.4.22-1.2149.nptlcustom/kernel/drivers/net/nvnet.o
/lib/modules/2.4.22-1.2149.nptlcustom/kernel/drivers/sound/nvaudio.o
/usr/share/doc/NVIDIA_nforce-1.0
/usr/share/doc/NVIDIA_nforce-1.0/GNULicense.txt
/usr/share/doc/NVIDIA_nforce-1.0/NVLicense.txt
/usr/share/doc/NVIDIA_nforce-1.0/ReleaseNotes.html
/usr/src/nvidia/nvgart/README
/usr/src/nvidia/nvgart/linux-2.4.20-agpgart.diff

Notice it shows you where it will be installing the kernel modules. The path should reflect the kernel version of your new kernel (check it with 'uname -r'). Now, all you have to do is install the new RPM with:

rpm -ivh [path]/[rpm-file-name]

NOTE: if you already had installed nForce drivers for the previous kernel, the above command will fail because rpm will complain you're asking it to override an installed package. There are two ways to deal with it:

  1. remove the previous nForce RPM with 'rpm -ev NVIDIA_nforce' before installing the new one
  2. install the new RPM over the existing one with 'rpm -ivh --replacepkgs [path]/[rpm-file-name]'

Installation scripts provided by NVIDIA (executed automatically by rpm) already add these to /etc/modules.conf:

alias eth0 nvnet
alias usb-interface usb-ohci
alias sound-slot-1 nvaudio
alias sound-slot-0 nvaudio

You should be now ready for networking. Try it out with (as root):

service network start

This would activate networking (nvnet module will be loaded automatically). Check it with:

# service network status
Configured devices:
lo eth0
Currently active devices:
lo eth0

Similarly, sound should be enabled. Try playing some MP3/Ogg file and hopefully you will hear it on your speakers (nvaudio module should be loaded automatically).

Troubleshooting

system lags horribly when network is active
Although the default settings should be adequate for most configurations, this can happen to some mobos such as the ASUS A7N 266VM. Usually this happens because of the default optimization mode of the nvnet module (check NVIDIA README file). Setting optimization mode to 1 (CPU optimization) might help here. You can also control other parameters such as speed and duplex; read the README and remember 'modinfo nvnet' is your friend.

audio doesn't work always (eg. Flash)
nvaudio module is based on the OSS i810 driver, but I've had a much better experience with ALSA intel8x0 driver on my ASUS A7NX Deluxe, YMMV. Installing and configuring ALSA is beyond the scope of this document. Using ALSA has the additional benefit of allowing sound mixing, check this other tutorial.