LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > ~sHyLoCk~
User Name
Password

Notices


Rate this Entry

[example] Compiling 2.6.32 kernel in Slackware 64

Posted 12-08-2009 at 11:31 PM by ~sHyLoCk~
Updated 12-09-2009 at 12:42 AM by ~sHyLoCk~

Originally Posted in my BLOG

Please Note: You should atleast read Alien_Bob's [Eric Hameleers] Guide once if you are new to kernel compiling. I always refer this guide to people who just started kernel compiling since it's very well-written and explained in details. Here is the link.
This is my second kernel compile guide [actually more like a report of my experience]. A few things I did differently than last time, so instead of updating the previous guide I thought of creating a new one. So, here goes.

Get root privilege by using su, then continue.

Code:
# cd /usr/src/

    # rm -rf linux

    # wget -c http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.tar.bz2

    # tar xvfj linux-2.6.32.tar.bz2

    # ln -s /usr/src/linux-2.6.32 /usr/src/linux
Now your linux directory points to your newly extracted kernel tree source.

I am not going to link my kernel config here as many people previously asked me why their kernel config didn't work, it's not supposed to! Your hardware is different than mine and my .config will be different than yours. So you must understand what to enable or disable in your own kernel config. Or just use:

Code:
# cp /usr/src/linux-2.6.29.6/.config /usr/src/linux
Now run:

Code:
# make localmodconfig
Now you can strip off your kernel and fine tune your config. Remove support for what you don't need and select accordingly. Read more about it here.

Now run :

Code:
# make menuconfig
Carefully check out each sections to see if localmodconfig stripped off something which you need.

WARNING: My USB Mass storage device support and Intel Sound card support was stripped off by localmodconfig and hence I had to recompile kernel again with those support re-enabled.

Now scroll all the way down and select load kernel configuration and press enter to select the .config.

Code:
# make
This will take a while, meanwhile open another tab and configure lilo.

Code:
# 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:

Code:
image = /boot/bzImage
    initrd = /boot/initrd.gz
    root= /dev/hda3
    label = Linux
    read-only
Remember to replace /dev/hda3 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:

Code:
# make modules_install

    # cp arch/x86_64/boot/bzImage /boot/bzImage

    # cp System.map /boot/System.map.new

    # rm /boot/System.map

    # ln -s /boot/System.map.new /boot/System.map
You may copy over the config file to /boot but I see now use for that and hence I skipped it.

Anyways, now for the next step, you are own your own since it depends on what partition type you are using. I use ext3 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!

Code:
# mkinitrd -c -k 2.6.32~pdg -m mbcache:jbd:ext3 -f ext3 -r /dev/hda3

    # cd /etc/rc.d

    # rm rc.modules

    # cp rc.modules-2.6.29.6-smp rc.modules-2.6.32~pdg

    # ln -s /etc/rc.d/rc.modules-2.6.32~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 4637 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 06:43 PM.

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