Sunday, November 27, 2011

Tutorial: Configure, Compile & Install the Zen Kernel in Fedora 16

"The Zen Kernel is a the result of a collaborative effort of kernel hackers to provide the best Linux kernel possible for every day systems. We include code that is not included in the mainline kernel in an attempt to create an all-around better kernel for desktops (although it can be compiled otherwise). This is done by including new features, supporting latest hardware, and including various code and optimizations to better suit desktops. Zen is a 100% community oriented project so, as a result, everybody can contribute to the project.
     Zen is almost always more up to date than your distribution's default kernel. Zen is split up into two trees, these are stable (zen-stable.git) and unstable (zen.git). The stable tree follows Linux releases while the unstable tree follows the Linux git tree (linux-2.6.git)."

http://zen-kernel.org/


#Kernel packages for Fedora 16:

sudo yum install -y patch wget gcc ncurses-devel git git-core

#How to clone the Zen-Stable git repository:

git clone --depth 1 git://zen-kernel.org/kernel/zen-stable.git

#Symbolically link "zen-stable" with "linux":

ln -s zen-stable linux

#Prepare your kernel source for configuration and compilation:


cd linux
make clean && make mrproper

#As a starting point copy your current kernel configuration into your zen-stable directory:

cd /boot
ls
cp config-xxxxxxxx /home/yourusername/kernel/zen-stable/

#Rename the above configuration file that is now in your zen-stable directory to ".config" no quotes.

#Run a make oldconfig to compare your current configuration to your new source and select any new changes you would like.

make oldconfig

#Run a make menuconfig to use a graphical user interface for further configuration if you so choose.


make menuconfig

#If you would like to give your kernel a custom name open the "Makefile" in your zen-stable directory and edit the fourth line from the top entitled "Extraversion" keep in mind you cannot use capitalization or spaces and there is a character limit so keep it as short as possible.

#Now it's time to compile your kernel:


make -j5 

(the "-j5" flag optimizes my kernel compilation to run on all of my cpu cores the general rule of thumb is to add "1" to the number of cores you have in my case I have four so I will use "make -j5".)

#After compilation we need to install the kernel to do so type the following:

sudo make modules_install install

#Finally we must edit our grub file to boot from the new kernel.  In Fedora this is located in /boot/grub2/grub.cfg regardless of distribution your grub file should be located somewhere in the "/boot" directory.  To edit the file type the following:

sudo gedit /boot/grub2/grub.cfg

change the "set default" to "0"

(Make sure that your new custom kernel if the first entry in the list of kernels installed on your system.)

Save the file and close.  Now reboot your system into your new Zen kernel and enjoy!

#To update your zen-stable kernel source do the following:

cd zen-stable
make clean && make mrproper
git pull origin master
make clean && make mrproper

(A few things to keep in mind if you gave your previous kernel a custom name make sure to delete it from the "Extraversion" line of your "Makefile".  Also if you would like to keep your current configuration hit "CTRL + H" on your keyboard to show any hidden files then copy ".config" and save it anywhere you would like.  Make sure to rename it to something other than ".config" or the file will stay hidden wherever you save it.)

12 comments:

  1. Thanks for the info. How about OpenSUSE?

    ReplyDelete
  2. This method will work in openSUSE however I'm not sure what packages you would have to install openSUSE's documentation is usually pretty good I'm sure it's detailed somewhere on their website.

    ReplyDelete
  3. Cool, that's what I figured. Thought you may know off the top of your head :-)

    ReplyDelete
  4. I got this after trying to install on Ubuntu:


    sh /home/sgtguthrie/zen-stable/arch/x86/boot/install.sh 3.1.4-zen+ arch/x86/boot/bzImage \
    System.map "/boot"

    *** Missing file: arch/x86/boot/bzImage
    *** You need to run "make" before "make install".

    make[1]: *** [install] Error 1
    make: *** [install] Error 2
    sgtguthrie@Ubuntu-HP:~/zen-stable$

    Any ideas?

    ReplyDelete
  5. For Ubuntu you can use the Liquorix kernel PPA (Zen Kernel for Debian Sid from which Ubuntu is based)

    Use these instructions http://www.webupd8.org/2011/03/how-to-install-liquorix-kernel-in.html

    Just remove the 2.6 from the commands, and even that's not necessary :) Super easy!

    ReplyDelete
  6. I got a error when trying to install the kernel ---
    grubby fatal error: unable to find a suitable template---

    everything compiled correctly and everything was smooth up till that point

    any pointers? :)

    ReplyDelete
  7. @Adam80460 you most likely edited the grub file wrong when trying to set your new kernel as the default kernel to boot from.

    ReplyDelete
  8. I Actually got the error at the very end of the "sudo make modules_install install" part of the install. But thanks for your response :)

    ReplyDelete
  9. Hey! Lou! I need help man.
    I'm getting this ERROR:
    Failed to start LSB: starts and stops login iscsi daemon
    Failed to start LSB: starts and stops login and scaming os iscsi devices

    ReplyDelete
  10. how to remove or replace old kernel ?

    ReplyDelete
  11. thx, your post was very helpfull for me!

    but i'm hv on question - how can i delete old zen kernel then i builded new one after git pull?

    ReplyDelete
  12. btw, did you issued with vmware kernel modules?

    ReplyDelete