Check this topic with also some comments http://64studio.com/node/504Though 64Studio has a very good kernel by default, it is sometimes needed to compile a new kernel from source. Here is my lengthy post, copy and paste - but remember, no warranty.. comments are welcome!
This writing is about my experiences with configuring a kernel for realtime and compiling ALSA to go with the new kernel. The latest source for Linux (aka. kernel - duh..) is available at http://www.linux.org, downloadable as a bzipped (.bz2) tar-file. Also required are the latest sources for ALSA from alsa-project.org, now at version 1.0-16. My distribution is 64Studio, which uses Ingo Molnars realtime patch in the kernel. Molnars patches are available at http://www.kernel.org/pub/linux/kernel/projects/rt. Make sure the number of the patch is the same with the version of kernel source you have downloaded. If the numbers are incompatible, the patch will not work. Using a realtime configured distro as a base makes sense because you can use a reliable kernel configuration from where to start modifying your kernel. Also required are some tools, that can be installed via apt-get. They are ncurses5-devel and kernel-package. The kernel will be compiled "Debian-way" to an installable .deb-package with make-kpkg. Ncurses-devel is required for a menu based version of "make config" - that is, "make menuconfig". Usually kernel source is downloaded and unzipped to the directory /usr/src, but I prefer doing it in my home directory and there in a subdirectory called kernel. ALSA sources will be downloaded and compiled there too, in a directory kernel/alsa. All work from now on will be done in a terminal. After downloading is complete, I bunzip the sources.
cd kernel; tar xjvf linux-(latest-version).tar.bz2
It is customary to create a symbolic link named linux to the kernel source directory.
ln -s linux-(version-number) linux
Then unzip ALSA.
cd alsa; for i in alsa-*.bz2;do tar xjvf $i; done
Change to your kernel source directory.
cd ../linux
Copy your running kernel configuration to new kernel source directory, naming it to ".config".
cp /boot/config-(your running kernel version) .config
Now patch the kernel.
bzcat ../your-molnar-patch-number.bz2 | patch -p1
Now start the configuring and compiling process.
make menuconfig
This is the stage, where you can alter things as you wish regarding your kernel. First of all I changed the setting in "Processor type" to match my processor. My machine is an old 1.2GHz Duron, so the processor architecture changed to "Athlon/Duron". Considering that I am going to compile the latest ALSA source for my new kernel, I remove all alsa driver modules from the kernel, but I make sure alsa and OSS support are present. This is done by moving with arrow keys to the line "Device drivers/Sound" and choosing and unchoosing with the spacebar. So, all said and done, I exit and save the new configuration as prompted. It is time to compile.
make all
This stage takes a lot of time depending on your machine power. Make a cup of your preferable bewerage and perhaps read something - it's not a bad idea anyways.. Check up every now and then whether your terminal has returned to the prompt. If so, you can start making the kernel package.
make-kpkg -initrd kernel_image kernel_headers
Kernel headers are needed to make sure ALSA will compile cleanly - just to be sure. Also those who use display drivers distributed by Nvidia will need kernel headers, because the Nvidia drivers will not move to the new kernel without recompiling and reconfiguring. I recommend configuring your system to use the generic nvidia driver (nv) with
dpkg-reconfigure xserver-xorg
before rebooting. This will make sure you have some type of graphic display after installing and rebooting to the new self compiled kernel. After make-kpkg finishes you have new kernel package in the parent directory linux, aka. /home/username/kernel. The package is recognised by the filename ending with .deb. Now you can install both the kernel and kernel headers as root.
su - (The - option changes path to the /root directory and takes roots path variables into action) dpkg -i /home/username/kernel/new-kernel-version.deb new-kernel-version-headers.deb
Using dpkg is a good idea, because it finds your current GRUB configuration and adds your working kernel to the new bootloader configuration. This way you'll have fallback plan available if something goes wrong. It shouldn't because you merely copied your old (working) kernel configuration to new kernel - for the most part. The new kernel does not need alsa driver modules to boot. Now reboot.
sudo shutdown -r now
At the bootloader I choose single user (root) option as to be sure the kernel will boot. Once the system up and running I change to the alsa source directory, /home/username/kernel/alsa. The first to be compiled are the drivers - so:
cd /home/yourusername/kernel/alsa/alsa-driver-xxx ./configure --with-sequencer=yes --with-oss=yes --with-cards= && make && make install
Then the libraries.
cd ../alsa-lib-xxx ./configure && make && make install
The most important alsa software to install are the drivers, libraries and alsa utilities. Depending on your system you will have to check for other alsa software to install. The directory alsa-tools-xxx contains some soundcard spesific tools such as envy24control for users with envy24-chipset based cards (M-Audio Delta series) or for users with RME cards; hdspmixer, hdspconf.. Configure, compile and install as before. Once all alsa software is installed, configure your alsa system.
alsaconf
After this program has finished give the commands:
/etc/init.d/alsa restart alsactl store
Reboot and start using your new kernel. Users of Nvidias drivers will have to compile and install their drivers once again before rebooting - remember what I said about the kernel headers..? If the new kernel doesn't work you'll always have your default kernel available through the GRUB bootloader, so no harm done.
TIP: To avoid the hassle of rebooting you can use dropping your system to single user mode. This is done by changing to a virtual terminal with ctrl+alt+F1 and issuing the command: init 1. A reboot is necessary only after installing a new kernel. Single user mode in Linux requires root users password, so don't do it unless you know that. Normal running mode in Debian based systems is: init 2 (GDM,X-display, hald etc. will start).
edit: this is the config file of the kernel:
http://pastebin.com/f2731c136