Well, I finally went ahead and rolled a custom kernel on Kubuntu 7.10. I was having performance issues with VMware-Server 1.0.4, and researching pointed at the tickless kernel and SLUB options used in the Ubuntu 2.6.22-14 kernel. I used Sean’s Blog extensively and tried both the easy way and then the harder way. The easy way is just rolling back to the 2.6.20 Ubuntu kernel with the proper files from the Ubuntu archives. This worked, but I wanted more.
The harder way really wasn’t that hard at all. I followed his steps and got the 2.6.22-9 Ubuntu kernel installed fine. Then I decided to try a vanilla kernel from www.kernel.org. Here is a summary of the steps I took on a different computer:
- Download the latest full kernel (126.96.36.199 at the time of this writing).
- sudo -i
- apt-get install build-essential kernel-package (I did not get the linux-source package, because that is what was downloaded in step 1.)
- cd /usr/src
- mv (path/to/)linux-188.8.131.52.tar.bz ./
- tar xvfj linux-184.108.40.206.tar.bz
- rm -f linux (if it exists)
- ln -s linux-220.127.116.11 linux
- cd linux
- cp /boot/config-2.6.22-14-generic .config (this step copies the current running kernel config into place for building the new kernel)
- make menuconfig (you need to have ncurses packages installed for this to work) – I prefer this to make xconfig, for no good reason
- MUST DO – General setup –> change from SLUB to SLAB – Choose SLAB allocator (SLAB).
- MUST DO – Processor type and features –> uncheck Tickless System (Dynamic Ticks). OPTIONAL performance settings I like – select the Processor family (mine is Opteron/Athlon64/Hammer/K8), set Preemption model to Preemptable kernel (Low Latency desktop), set Timer frequency (1000 Hz).
- OPTIONAL – Kernel hacking –> check Use 4Kb for kernel stacks instead of 8Kb. This is a performance setting.
- OPTIONAL – Device Drivers –> Sound –> Advanced Linux Sound Architecture –> PCI Devices –> set Intel HD Audio to M (module) -this was in Sean’s Blog, and I did not get sound working until I set this. YMMV.
- Exit and save the new .config file – I also like to save a copy of this file under a descriptive name somewhere else as a backup (cp .config /home/gutsy-18.104.22.168-slab.config, for example)
make-kpkg clean– refer to man make-kpkg to see what this does
make-kpkg --append-to-version=-with-slab kernel_image --initrd binary(“-with-slab” is descriptive text only, so you can change it if you like, or leave it out entirely) – this step rolls up the old “make, make modules” steps into one, so it could take a while before it is finished, depending on how much horsepower your computer has
- cd .. (go up one directory to where the new files are after compiling is completed)
dpkg -i linux-image-22.214.171.124*.deb linux-headers-126.96.36.199*.deb(installs the kernel and modules)
ln -s /lib/firmware/2.6.22-14-generic /lib/firmware/188.8.131.52-with-slab(to preclude any firmware issues that might pop up)
Now, you might want to sanity check before rebooting, so have a look at /boot/grub/menu.1st. You should see two entries for the new 184.108.40.206 kernel there (one is a recovery entry). The default number to boot should be the non-recovery entry. The count starts with 0, so if you have two kernels installed, you will typically have five entries (last is memtest), so the count runs from 0 to 4. Your new kernel will likely be 2 in such case.
One more useful step before rebooting – you may want to set your video driver to vesa, otherwise you might just get a console login after rebooting instead of KDE, GNOME, etc. Most likely, you will have to reinstall your video driver (NVidia and ATI users), and it’s a heck of a lot easier to troubleshoot if you have console and GUI environments. To do this, just:
- sudo -i
- vi /etc/X11/xorg.conf
- In Section “Device”, add in the line Driver “vesa” and comment out (#) the previous driver line.
- In Section “Modules”, comment out the line that says Load”glx”.
- Write and quit (:wq), and you are set. Remember, this will get you basic, unaccelerated graphics, so you will want to restore your old driver after rebooting to the new kernel.
If you use VMWare, you will also have to reconfigure it to use the new kernel.
Upon verifying that your new kernel is in the grub boot menu and selected as the default, reboot. As long as you have not removed the old kernel, you can always boot back into it if the new kernel fails to boot for some reason (hit ESC when prompted at bootup to select a non-default kernel entry). If all is well, you should see the *buntu boot progress logo come up and shortly be in your chosen window session. I like that this process builds in the boot logo automagically – nice touch.
Have fun with your new vanilla customized kernel!