Review your favorite Linux distribution.
Go Back > Blogs > ~sHyLoCk~
User Name


Rating: 4 votes, 4.00 average.

[howto] Compile 2.6.31 Kernel in Slackware 13.0

Posted 09-16-2009 at 08:18 AM by ~sHyLoCk~
Updated 09-19-2009 at 10:03 AM by ~sHyLoCk~

This is the way I did it, and hopefully should work for you as well.

Open terminal and login as root [or if you'd prefer, use sudo in every step.]

 # cd /usr/src

    # wget ‘′

    # tar xvfj linux-2.6.31.tar.bz2
After it’s extracted remove the previous symlink.

 # rm -rf linux

    # ln -s /usr/src/linux-2.6.31 /usr/src/linux
Now your linux directory points to your newly extracted kernel tree source. If you want you can configure using your personal config, or I have uploaded my config which I will use in this guide. So you may skip next step of wgetting it.

# cd /usr/src/linux && wget ‘’

    # make menuconfig
Now scroll all the way down and select load kernel configuration and press enter to select the .config.
    # make
This will take a while, meanwhile open another tab and configure lilo.

 # nano /etc/lilo.conf
Scroll all the way down and copy the existing linux entry. Just change the part which says /boot/vmlinuz to /boot/bzImage and then add another line just below it called initrd. Here’s my entry:

image = /boot/bzImage
    initrd = /boot/initrd.gz
    root= /dev/hda4
    label = Linux
Remember to replace /dev/hda4 with your own root partition. Yes yes, I know we haven’t created an initrd image yet. Patience! Just save and exit for now.

Now that make is over run:

# make modules_install

    # cp arch/i386/boot/bzImage /boot/bzImage

    # cp /boot/

    # rm /boot/

    # ln -s /boot/ /boot/
You may copy over the config file to /boot but I see now use for that and hence I skipped it. Hey as long as it works, eh?

Anyways, now for the next step, you are own your own since it depends on what partition type you are using. I use ext4 throughout and have no separate partition for /boot and hence this is how I generated my initrd image. Please refer to /boot/README.initrd file for details!

 # mkinitrd -c -k 2.6.31-pdg -m ext4 -f ext4 -r /dev/hda4

    # cd /etc/rc.d

    # rm rc.modules

    # cp rc.modules- rc.modules-2.6.31-pdg

    # ln -s /etc/rc.d/rc.modules-2.6.31-pdg /etc/rc.d/rc.modules

    # lilo
If you get a warning about LBA32 just add “lba32″ in your lilo.conf and re-run lilo. And now reboot into your new kernel!

Good Luck
Posted in Slackware
Views 4213 Comments 2
« Prev     Main     Next »
Total Comments 2


  1. Old Comment

    question about removing and re-linking /etc/rc.modules

    Very good tutorial. Two questions though:
    1. At the end you recommend doing:
     # cd /etc/rc.d
        # rm rc.modules
        # cp rc.modules- rc.modules-2.6.31-pdg
        # ln -s /etc/rc.d/rc.modules-2.6.31-pdg /etc/rc.d/rc.modules
    Is this necessary? I assume this is done to assure that the modules for the new kernel are loaded instead of the modules for the default 2.6.29-smp kernel. The reason I ask about this is because Alien Bob's guide does not mention doing this:[]=compile&s[]=kernel

    2. Also, is the process the same if you are compiling a kernel on 64 bit Slackware?
    Posted 10-16-2009 at 07:24 AM by tommcd tommcd is offline
  2. Old Comment
    I just created a new symlink for the new kernel modules, that's step is not really necessary as I'm using the older rc.modules itself.

    I compiled a 32bit kernel, so for a 64bit kernel, you must use your own config, you can use one from the existing kernel .config in your /usr/src/linux directory. The rest of the process is same, just instead of copying the bzImage from i386, you should do it from x86.
    cp arch/x86/boot/bzImage /boot/bzImage

    Atleast that's what I know since I don't really use a 64bit system, even though I have a core2 cpu, I like 32bit.
    Hope this helps you.
    Posted 10-23-2009 at 09:37 PM by ~sHyLoCk~ ~sHyLoCk~ is offline


All times are GMT -5. The time now is 07:20 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration