Skip to content

Compiling kernel 3 vanilla 4 fedora

September 10, 2011

Hi all!
Today i’ve decided to share with you how to compile a vanilla kernel for use with your fedora box.
I’ll be showing you how to do it for a x86_64 system but it should be similar for i386.

  1. Start by getting your kernel tar here: kernel.org site.
  2. As root issue the following:
    cd /usr/src/kernels
  3. Issue the following to install some dependencies:
    yum install gcc ncurses ncurses-devel kernel-devel -y
  4. After that copy your downloaded kernel there to by issuing:
    cp /<FOLDER_WHERE_YOUR_DOWNLOADED_KERNEL_IS>/linux-<VERSION>.tar.bz2 .
  5. Untar the kernel:
    tar -xvjf linux-<VERSION>.tar.bz2
  6. Change the kernel name to make it more appropriate:
    mv linux-<VERSION> <VERSION>.1-95.$fedoraver.$arch

    Ex:

    mv linux-3.0.4 3.0.4.1-95.fc14.x86_64
    cd <VERSION>.1-95.$fedoraver.$arch
  7. After moving into the kernel folder edit the Makefile as bellow:
    VERSION = 3
    PATCHLEVEL = 0
    SUBLEVEL = 4
    EXTRAVERSION = .1-95.fc14.x86_64
    NAME = Sneaky Weasel

    Save the file.

  8. To complete run:
    make oldconfig
  9. As soon as you start being asked with changes against the new kernel, do an enter everytime. By doing this you will apply the defaults for all items without interfering with the settings.

  10. Editing the kernel options is not mandatory. If you want to compile right after the oldconfig, there’s no problem, jump that part and move straight for the makes. Here you edit accordingly with your box settings.
    make menuconfig

    After finishing save your changes and continue as described bellow:

    make bzImage && make modules && make modules_install

    This will take a while you may go for a coffee break. 😉

  11. After everything finishes, you do the following simple tasks:
    cp arch/x86_64/boot/bzImage /boot/vmlinuz-3.0.4.1-95.fc14.x86_64
    cp System.map /boot/System.map-3.0.4.1-95.fc14.x86_64
    cp .config /boot/config-3.0.4.1-95.fc14.x86_64
  12. Now you generate the image:
    cd /boot
    mkinitrd initramfs-3.0.4.1-95.fc14.x86_64.img 3.0.4.1-95.fc14.x86_64
  13. Now edit grub settings file to boot the new kernel. Just copy the current kernel entry and make the changes to the version numbers setting yours and you are done.
    cd grub
    vi menu.lst

    Here you can see an example:

    title Fedora (3.0.4.1-95.fc14.x86_64)
            root (hd0,5)
            kernel /vmlinuz-3.0.4.1-95.fc14.x86_64 ro root=/dev/mapper/vg_dell-lv_root rd_LVM_LV=vg_dell/lv_root rd_LVM_LV=vg_dell/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=pt-latin1 rhgb quiet intel_iommu=off
            initrd /initramfs-3.0.4.1-95.fc14.x86_64.img
  14. Save the file, recheck to see if you missed something and reboot.
    Enjoy the advantages of your new kernel.
    Good luck!
Advertisements

From → computer, fedora, kernel, linux

5 Comments
  1. Simon permalink

    Thanks for sharing. I’ve done this for Debian in the past, but your Fedora steps seem easier (no .deb packages to create).
    Keep it up!

  2. Christophe MEYER permalink

    Simple and it works well.
    Tested today with 2.6.33-5.
    To complete step 7, note that certain old kernel versions (ex 2.6.33-5), when compiled from a recent one (ex 2.6.43) and with a recent gcc (ex 4.6) needs some source code editing. This is also the step to apply patchs if you want.
    Thank you.

  3. Hmm is anyone else experiencing problems with the images on this blog loading?

    I’m trying to figure out if its a problem on my end or if it’s the blog.
    Any feed-back would be greatly appreciated.

  4. When someone writes an article he/she retains the image of a user in his/her
    brain that how a user can understand it. So that’s why this paragraph is perfect. Thanks!

  5. It’s actually a cool and useful piece of info. I’m glad that you simply
    shared this helpful information with us. Please stay us up to date like this.

    Thank you for sharing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: