ZenKernel

OBSOLETE, NEW WEBSITE

This document is currently obsolete, the new one can be found on the new Zen kernel home page at: http://zen-kernel.org/tutorials/distribution-specific-installation/debian-ubuntu-installation

Latest Wiki update 10/21/2009

Latest News

1/3/2009 Made some better and friendlier documentation

1/2/2009 I personally updated this wiki this time (zen dev), so it's actually going to be correct. I have fixed and erased several absolutely stupid steps, explanations, and comments.

1/2/2009 Don't do stupid things like the previous person who has edited this wiki suggested in the note right below this one. If you have a problem, report it on zen-sources.org or #zen-sources on freenode.

12/17/2008 The very latest ZEN git revision is 2.6.28-rc8-zen1 (Note: It still fails to compile! Use last working 2.6.28-rc6-zen1 instead)

12/17/2008 The ZEN-kernel Homepage has been relaunched. You'll find an Ubuntu section in the forum.

Warning

  • THIS KERNEL IS NOT SUPPORTED BY UBUNTU (do not take zen-specific problems to the ubuntu community)

  • If you have never compiled a custom kernel before, do not start with this kernel. Please first learn how to do it on mainstream linux kernels, or the official ubuntu kernel. All the additional options, etc. can confuse new users so it is not reccomended.
  • Zen Developers offer support (see "Introduction" for developer list), but preferably for kernel related things, NOT distribution related things (use the zen forums for distribution related questions)
  • Using a custom kernel is not for everybody, there is nothing wrong with you if you choose to keep the default ubuntu kernel updates (well, maybe something wrong with you but i'm not quite sure what :P)

Introduction

Zen-Sources is a collaborative effort of kernel hackers and enthusiasts to provide the best Linux kernel possible. We include code that is not yet found in the mainline kernel in an attempt to support the latest hardware, new features, security fixes, optimizations, etc. We are generally more up to date than your distribution's default kernel. If there is something you would like included in a future Zen kernel just ask and we will try to include it. Zen-Sources is NOT a "patchset" like many of you are used to. Zen-Sources is a Linux kernel. We do all of our development in a git repository, and most of the code we include gets pulled from other git repositories. Since we rarely interact with patches these days, we are not going to go out of our way to provide "broken-out patches". The only patch you will get from us is a monolithic patch applied on top of some vanilla kernel base; we prefer you to use git and "git checkout" the latest stable tag. If you need a "broken-out patch" use gitweb or 'git diff'.

This kernel is maintained through a live git repository, along with other items related to the project, see gitweb. Patches from tagged releases in the git tree can be found on the website.

The zen developer list can be found at http://zen-sources.org/content/developer-list

Features

Full Feature List: http://zen-sources.org/content/kernel-code-included-zen-kernels

For changelogs just look at git shortlogs, for documentation, visit the website (above link), and look at select .txt files in the kernel source directory.

Installing Zen

You can compile your kernel in one supported way:

Compiling and Installing from Source (the SUPPORTED way)

"- This is the only supported way by zen developers to compile your kernel - Using an automated script, or using pre-built .deb packages is NOT supported and highly NOT reccomended"

If you wish to have a custom kernel, the best way is to build it manually yourself.

Let's go for it - step by step.

Compile time depends on one of two things: 1) The size of your configuration: If you are using the default ubuntu configuration with all those extra modules, expect a very long compile time. If you start from scratch and make a real "custom" configuration then the compile time will be cut anywhere from 50-90%, typically closer to 90%. 2) Your processor speed. A quad core xeon versus a celeron 477, obviously the compile time will be dramatically reduced on the xeon.

'Kernel speed (not system speed) depends on one of two things: 1) The settings you choose in your kernel (such as preemption, i/o scheduler/can be set at runtime, hz setting or dynticks, etc, etc). So if using a ubuntu configuration and changing nothing, you might as well not even use zen because you will see minimal gain over a ubuntu kernel if you don't utilize any of the features it provides. 2) How much un-necessaries you have in your kernel. If you have modules that is one thing, but the more stuff you load/build-in to your kernel the slower your boot be.

1. Prepare your environment:

Open a terminal first.

Hint: To skip typing "sudo" all the time, you can type once

sudo -s

You'll see the root prompt popping up. From here no more preceding "sudo"s needed during your terminal session!

Install minimum build-environment packages first:

sudo apt-get install fakeroot kernel-package build-essential libncurses5-dev git-core

2. Download the sources

1-2-2008 LATEST KERNEL: v2.6.28-zen2

Clone the git tree by issuing the following commands from a terminal:

cd /usr/src
sudo git clone git://git.zen-sources.org/zen/zen.git linux-2.6-zen
ln -s linux-2.6-zen linux
cd linux

"Some people find it better to put the kernel source in the /home directory, i disagree with this method and would reccomend /usr/src, but ultimately it doesn't matter as long as the symlink in /usr/src/linux is correct"

Once the ZEN-Sources are cloned it is recommended to checkout the latest tag. All the tags can be viewed by the following command:

cc linux # git tag
v2.6.27
v2.6.27-rc9
v2.6.27-rc9-zen1
v2.6.27-zen1
v2.6.27-zen2
v2.6.27-zen2-hotfix1
v2.6.27-zen3
v2.6.27-zen3-hotfix1
v2.6.27-zen4
v2.6.27.1
v2.6.27.2
v2.6.28
v2.6.28-rc1
v2.6.28-rc1-zen0
v2.6.28-rc2
v2.6.28-rc3
v2.6.28-rc3-zen1
v2.6.28-rc4
v2.6.28-rc4-zen1
v2.6.28-rc5
v2.6.28-rc6
v2.6.28-rc7
v2.6.28-rc8
v2.6.28-rc9
v2.6.28-rc9-zen1
v2.6.28-zen1
v2.6.28-zen2

I will explain this the best i can: 1) All zen releases are marked with -zen 2) All revisions of that released are marked with X, in -zenX (the higher the number, the newer the release) 3) All releases marked with -rc#-zenX are based on pre-releases of the linux kernel.

We are going to checkout the latest tag at the time of writing: "I will explain the command after the following code"

sudo git checkout v2.6.28-zen2

* checkout v2.6.28-zen2: command to checkout the tag v2.6.28-zen2

New tag? Or just want to use the latest git

sudo git checkout master # Switch back to main "master" branch
sudo git branch -D stable # delete the local branch "stable"
sudo git pull # Update the zen kernel, then either use latest or checkout another tag all over again

Remove old kernel deb-packages, if they are existing under /usr/src.

cd /usr/src
sudo rm linux*deb

NOTE ATI users: Checkout the ATI section now. Make sure that the listed patch is applied! If not - apply changes now.

The cloning process can take about 30-45 minutes (depending on internet connection), so be patient.

3. Configure the kernel

Configuring a kernel is a one shot deal. The first time you do it, it will take awhile and perhaps some trial and error. However, creating a custom kernel configuration is a BIG advantage. Not only will you get dramatically less compile time. Also a smaller, lighter, and ultimately faster kernel. Also, once you get a working configuration you can use it over and over. This is a one-time deal is what i'm trying to get across.

I am of course willing to aid anybody in the process of this if it is your first time making a custom configuration, just contact me in #zen-sources or zen-sources.org.

The key to a custom kernel is to get a configuration as small as possible. The less options you don't need or use the better. (You can of course make things you use, but not all the time a module and then just load them where applicable). I reccomend making things you use EVERY boot as built in, or <*>, things such as file system, drivers, etc. There's no point in making them modules and then re-loading them every boot. The reason a distribution does this is for compatibility, which is no reason for you to do it!

STARTING FROM SCRATCH

make allnoconfig
make menuconfig|xconfig|gconfig # Of course there are multiple options for configuring your kernel, i personally use menuconfig

Now, the first time you do this it may take awhile. And you may boot up the first time to find a kernel PANIC! DO NOT panic in this situation, the most common reason for this is just a missed option.

!!! allnoconfig means ALLNOCONFIG, you need to configure EVERYTHING, even essential system options. Go through each option carefully, and make sure to enable some i/o schedulers in Block ---> or else you will be using no-op by default, when you probably want CFQ

The first few menus are very essential, i would not make mistakes here!!! Do these right the first time, menus like "General Setup" and "Processor Type and Features". Stuff like drivers are just a matter of "oops, i missed that one - and then re-compile"

Typically, if you know your system, you won't have any problems finding the right drivers in the kernel. You can always get help with commands like lspci or dmesg to see devices

Using the ubuntu configuration Compile time will take LONGER with this configuration, but if you gave up on the custom config or you just don't want the uber maximus systemz then you can still configure some nice additional options to the default bland ubuntu config :P

sudo cp /boot/config-`uname -r` .config
sudo make menuconfig

NOTE

Configure Zen specific parameters

There is no documentation about the "best" ZEN parameter setup yet. The issue has been brought up in the Gentoo forum recently once more. Until now (12/2008) there wasn't any feedback on the subject.

Anyhow Ingo Molnar did mention some time ago that manipulating the scheduler parameter is such a tricky exercise, that he'd rather leave it. He wouldn't see any advantage by doing it. That means - according to him - you do not need to adjust any of these parameters.

The good thing though we've got the ZEN-tunables, so we're able to play with them in the kconfig menu. The problem is to prove that you really improved the situation. It's gonna be a pretty subjective exercise, depending on hundreds of parameters. If you measure too much, sometimes even with debug options turned on, the taken measurements, won't tell you the truth either.

There are no more presets in zen, since none of the tunables are proven. You can still do it the manually, and of course boost privileged tasks.

Zen-Tune -->
[ ] Set custom scheduler targeted preemption latency (NEW)
[ ] Set custom scheduler minimal targeted preemption granularity (NEW)
[ ] Set custom scheduler wakeup granularity for SCHED_OTHER tasks (NEW)
[ ] Set default percentage RAM filled with mapped pages (NEW)
[ ] Set default dirty ratio (NEW)                                                                                                    [*] Boost privileged tasks
 (-10) Re-nice value for privileged tasks

Please report back your preferred configuration. If you're able to measure your results please let us know how you've done it.

4. Build the kernel

This will take you about 45 minutes. (There are people making it within less then 10 minutes with a stripped down configuration)

sudo make-kpkg clean # only if you've compiled in this tree before

# X in CONCURRENCY_LEVEL is the number of processors you have, or cores your processor has
sudo INSTALL_MOD_STRIP=1 CONCURRENCY_LEVEL=X fakeroot make-kpkg --initrd kernel_image kernel_headers --revision=rev1.zen1

5. Install the kernel

In /usr/src you'll find the kernel and kernel-headers .deb packages

cd /usr/src
sudo dpkg -i linux-image*.deb
sudo dpkg -i linux-headers*.deb

IMPORTANT: ATI graphic card users, please have a look at below ATI section before you reboot!!!

6. Update ZEN-Sources

There are continuous changes going on on the ZEN-kernel source tree.

Updating your sources once in a while might be good idea, as explained above.

7. Removing ZEN-Sources

Removal of the ZEN kernel packages will work via Synaptic quite easily or as shown below.

dpkg -l | grep zen[1,2,3]
sudo apt-get remove <dpkg -l printed package-names>
sudo rm -rf /usr/src/linux-2.6-zen /usr/src/linux

Weird Kernel Name Problem

We have a LOT of people complain about this. Simply disable this:

CONFIG_LOCALVERSION_AUTO

This can be found in the kconfig at:

General Setup -->
  [ ] Automatically append version information to the version string

Grub2 Bootloader

If you use the Grub2 bootloader instead of the default grub, you need to do a couple of extra steps: (thanks RavanH!)

Edit (as root) your /etc/default/grub file BEFORE installing the kernel, and find the line startdpkg -l | grep zen1ing with GRUB_CMDLINE_LINUX= (probably the last line). Add just before the closing quote resume=/dev/[Insert Swap Location here] so it will automatically be added each time you install a kernel. If you do this after the kernel is installed, be sure to run the command update-grub in terminal (as root) to make the change propagate to the kernel boot list.

Wireless

Intel Pro/ ipw3945

Homepage

1. The binary microcode image, available here.

2. The binary user space regulatory daemon, available here.

3. The ieee80211 subsystem version 1.1.11 or newer.

4. Wireless Extensions (v17) and Tools (v28)

5. For WPA you need a WPA supplicant compatible with the latest versions of the wireless extensions (v18 and newer). See the how to.

Broadcom bcm43xx

1.After enabling the driver in the kernel config and building the kernel, get the firmware and the appropriate firmware cutter here: http://linuxwireless.org/en/users/Drivers/b43#firmwareinstallation

Blacklist bcm43xx: (If you are still using 2.6.22 you shouldn't do this as it won't conflict with 2.6.24 and b43)

echo 'blacklist bcm43xx' | sudo tee -a /etc/modprobe.d/blacklist

2. WLAN Interface naming. Fix wlan0_rename, wmaster0_rename, etc... I had to do this to get my wireless NIC to function correctly. (wlan0 doesn't work. It'll still end up wlan0_rename) Should be a temp fix as I'd assume the kernel devs will address this bug (already on launchpad)

Replace instances of <driver> with your wireless driver. (b43, iwl3945, madwifi, etc)

1. Alter the the NICs persistent interface name: Code:

sudo vim /etc/udev/rules.d/70-persistent-net.rules

2. Now remove any interfaces already listed with your WLAN NIC's MAC address.

3. Add the following and then save and exit: (Replace 00:00:00:00:00:00 with your WLAN NIC's MAC address.)

# PCI device 0x14e4:0x4311 (<driver>)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:00:00:00:00", NAME="eth1"

4. Now create an alias for eth1 and your driver, in my case b43: (b43, iwl3955, madwifi, etc...) echo 'alias eth1 <driver>' | sudo tee /etc/modprobe.d/<driver>

5. Reboot

nVidia Drivers

Simply get the latest nVidia driver. Sometimes, a patch may be required, for example 2.6.28 kernels and 177.XX nVidia drivers need patched. It is highly suggested that you use the nVidia beta drivers 180.08 or 180.16 if that doesn't work.

ATI Drivers

15/11/2008 In the past installing the ATI driver was a big problem. It was pretty difficult to get the fglrx driver compiled and installed on a ZEN kernel. With 8.10. Ubuntu is running a DKMS autoinstaller during boot, which installs automatically the fglrx driver on whatever kernel.

The GIT sources >= 2.6.28-zen* shouldn't make any problems any longer either. After reboot fglrx should be up'n running.

IMPORTANT: If you compile and install a kernel with the same id more than once, you should manually remove all zen-kernel related files and directories under /var/lib/dkms/fglrx and subdirs to force the dkms autoinstaller to reinstall fglrx again.

It is still a good idea to swap "fglrx" to "vesa" in /etc/X11/xorg.conf before you reboot. If something went wrong you can at least properly login to X11.

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.orig
sudo gedit /etc/X11/xorg.conf

When logged in again, just type "lsmod | grep fglrx" . If the module is there, everyhing went ok. Change back vesa to fglrx within your xorg.conf and reboot again.

If you still encounter a problem, please verify if below patch is still applied to the sources!

/usr/src/linux/kernel/rcupreempt.c

--- a/rcupreempt.c    2008-11-24 17:30:05.000000000 +0100
+++ b/rcupreempt.c    2008-11-24 17:30:16.000000000 +0100
@@ -296,7 +296,7 @@
         local_irq_restore(flags);
     }
 }
-EXPORT_SYMBOL_GPL(__rcu_read_lock);
+EXPORT_SYMBOL(__rcu_read_lock);

 void __rcu_read_unlock(void)
 {
@@ -366,7 +366,7 @@
         local_irq_restore(flags);
     }
 }
-EXPORT_SYMBOL_GPL(__rcu_read_unlock);
+EXPORT_SYMBOL(__rcu_read_unlock);

 /*
  * If a global counter flip has occurred since the last time that we

Common Issues

It is a good idea to change your display driver before booting if you use an ATI or nVidia card. Do this via a configuration dialog, or edit /etc/X11/xorg.conf. Change the section that deals with your display device, under the Driver section. Replace the Driver line's entry where either "fglrx" or "nvidia" is listed with "vesa" (or nv if you are an nvidia user).

You must use version Ndiswrapper 1.50 or higher, in order for it to compile. - For the Intel Wireless kernel modules to work, you need to get the firmware from the following page: http://intellinuxwireless.org/

Try installing build-essential and rebooting if something does not work, provided it is a software issue: sudo apt-get install build-essential

Benchmark and measurements

The issue is also under discussion. How do we measure the performance of a particular ZEN-Kernel setting. We are working on it!

Let start the easy way.

1. preempt-test

  • preempt-test is a small utility to show that preemption is working properly. The tool starts 98 threads (parent-child), each with a different thread priority. It'll tell you the wake-up latencies from thread to thread. As a reference on a TP T60P 2,16 dual core machine at full speed the result is min=6us max=29us avg=8 You can download the sources here:

    http://rt.wiki.kernel.org/index.php/Preemption_Test Follow the "Debian" instructions for getting it up'n running.

2. This page might be a good starting point http://kernel-perf.sourceforge.net/about_tests

Support, Information, and Downloads

The right place to get support, information, and downloads:

Official Zen Sources Site

Other useless places that you should get support, information, and downloads at your OWN RISK: You are not likely to get valid help from any of these places, and beware of all downloads not on zen-sources.org

UN-Official Thread in Ubuntu Forums

UN-Official Gentoo Thread (Development Thread)

UN-Official Zen Packages and Source Releases (Thanks to Matt Parnell)

Matt Parnell's UN-Official Zen Page (Builder of the Prebuilt Packages)

A note from a zen developer

I fixed this wiki, not only were there flaws in the steps, but it taught about a flawed mentality that is not supported by me or any one of the other zen-sources developers.

  • Do NOT use prebuilt zen kernels on your ubuntu
  • Do NOT use a script to build your zen kernel
  • Do NOT complain about a problem anywhere where I can't see it, report it to us at the website, IRC, or as a last resort by E-Mail
  • Do NOT do dumb things like chmod /usr or /usr/src to '775' for make-kpkg, the correct solution is "fakeroot", if you were a victim of these incorrect steps then complain to someone else because i didn't write them.
  • Some questions will be criticized, but ask them anyway. I apologize in advance if I make fun of one of your questions. (I only get scared when people ask things like 'what does make do?')
  • The gentoo forums is NOT where zen development takes place, as previously referenced in this wiki. I've made several of the latest zen releases including 2.6.28-zen1 rebase and re-make (first rebase after site came back up), and i've never visited the gentoo forums for development, 99% of the time on IRC
  • If you do not want to clone git, then the latest patches are available on the website


CategoryKernel

ZenKernel (last edited 2009-10-21 02:41:46 by cheater1034)