About kernel compiling - some advice..

  • porisija
Posted: Fri, 04/04/2008 - 21:21
Though 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 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 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).

angelsguitar, you can

  • leal.parente
  • 09/23/08
  • Sat, 12/27/2008 - 02:15
angelsguitar, you can compie teh current 64studo rt kernel, bur after it you have compile the madwifi driver and your intel graphics, because this kernel does have this drivers. But compile this driver is easilly, you can use m-a (module assistant): http://www.punknix.com/?q=node/110

I'm kind of trying to revive

  • angelsguitar
  • 12/22/07
  • Tue, 12/02/2008 - 20:38
I'm kind of a noob on kernel compilation, but I have a question: Is it posible to compile the current 64studio rt kernel with the latest intel graphics and madwifi drivers? I'm asking because I have a new laptop in which I installed 64studio, but neither the intel graphics card nor the atheros wifi card were detected. This would be actually my first try at kernel compilation, but I really need to get my laptop working properly. Any advice would be greatly appreciated.


  • alidh
  • 11/29/07
  • Sat, 11/22/2008 - 11:32
Thanks for your reply! And if I want to build my own kernel, should I also compile ALSA? Is Alsa compiled against the 64studio kernel for example?

Recent kernels

  • Quentin Harley
  • 05/24/07
  • Sat, 11/22/2008 - 07:50
If it was possible to build a kernel as powerful and reliable as the current 64 Studio kernel using a more recent vanilla source, It would have been done. The problem is that recent kernels are much improved as general kernels, but proves to be problematic to pach for RT use, as performance and reliability suffers greatly. We tested a 2.6.22 kernel, but it proved problematic. Later tries were even worse... We have to wait for those problems to be sorted out first by our linux kernel hackers

Is it need to 'compile ALSA

  • alidh
  • 11/29/07
  • Fri, 11/21/2008 - 22:15
Is it need to 'compile ALSA to go with the new kernel'? I read some other howto's but no one was talking about this step...

Is this how the guys of

  • alidh
  • 11/29/07
  • Tue, 10/14/2008 - 09:28
Is this how the guys of 64studio make their kernel? I like to know cause the 64studio realtime kernel is amazing good! If we know how to build one, people can build more recent and good 64studio alike rt-kernels if they want...

Sorry for a late reply..

  • porisija
  • 09/29/07
  • Mon, 08/18/2008 - 18:45
Did you pass the option "--with-cards=echo3g" to "./configure"? I noticed my text was missing a clear definition of that option, I'm terribly sorry. You will propably have to repeat your driver compilation/installation process. Unless you have erased your alsa sources directories, you can do this by typing the command "./configure --with-sequencer=yes --with-oss=yes --with-cards=echo3g && make && make install" (as root) in the alsa driver source directory. I think doing just this will fix the problem. The designation "multimedia" is a generic term that describes the realtime patched kernel. The name is passed to the command "make-kpkg" with the option "--append-to-version=name". The rt7 refers to the version of the realtime patch. Apparently the kernel compilation went fine..? Cheers!

Hi! I followed your

  • tuukka.j
  • 05/28/07
  • Sun, 06/29/2008 - 14:31
Hi! I followed your walkthrough for updating the kernel, but I must have messed something up, because when I type 'alsaconf' it says that no supported pci-cards found (asks to probe for ISA-cards). My soundcard is Echo Gina 3G, which is fully supported by alsa. Any idea what have I f*cked up, and how should I proceed in fixing this? Also, IIRC the kernel before this new one didn't say rt after 2.6.xx.xx but multimedia (2.6.2x.xx-multimedia) so is that a different patchset than the one with rt7 after the kernel version number? And how does it differ? Thanks in advance for the comments!