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!

From → computer, fedora, kernel, linux

Leave a Comment

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.