LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Closed Thread
  Search this Thread
Old 03-09-2003, 09:36 PM   #1
DaOne
Member
 
Registered: Jan 2003
Location: USA
Distribution: Slackware
Posts: 498

Rep: Reputation: 30
Kernel compiling guide for newbies...


I know how frustrating it can be for slack noobs...everyone tells you that slack is too hard for a newbie and then when you're faced with your first kernel compile...fear rolls in. Relax...slack isn't hard...it just makes you learn quicker. Compiling a custom kernel isn't hard...it just requires that you pay attention and follow the proper procedures. Once you've successfully installed slackware, then customized your kernel, you are well on your way to unleashing the raw power of linux...under the best (IMO) distro ever made.

Now to the compiling part...

First, we need to edit lilo.conf. Pick your favorite editor...one that is easy for newbies (and I still use this from time to time) is pico.

pico /etc/lilo.conf

Add this to your config...you can just copy what is there and add the .old stuff.

image = /boot/vmlinuz.old

root = /dev/hda1

label = slack.old

read-only


Note: Replace /dev/hda1 with the correct location of your root partition.

Now we need to edit the Makefile to make sure your new kernel is copied to the appropriate directory.

If you are using 8.1 or later, open /usr/src/linux/Makefile in a text editor, scroll to line 74 and
uncomment the the line #export INSTALL_PATH=/boot.
For 8.0 you must leave this line commented.

So...cd /usr/src/linux

pico Makefile

scroll to line 74 and
uncomment the the line #export INSTALL_PATH=/boot.
For 8.0 you must leave this line commented.


Now for the fun

make menuconfig (make your changes here...when done, save your new configuration)
make dep (sets all the kernel dependencies)
make clean (removes un-needed files)
make bzImage (builds the kernel)
make
make install (installs, moves and renames all the needed files and updates lilo)
make modules (builds all the kernel modules)
make modules_install (installs the modules)

Note: The 'make install' command is the one that most don't use but it works fine in slackware as long as you have prepared lilo.conf and edited Makefile according to the instructions above.

Now you can reboot using your new kernel!!!

If things did not go completely according to plan you can boot your old (working)
kernel by selecting slack.old at the lilo screen.

This is my bible when it comes to recompiling my kernel, and it has never, ever failed.
Enjoy your new kernel!

Note: All references from http://p-two.net
written by one of our own Moderators!

Last edited by Aussie; 11-10-2003 at 07:25 AM.
 
Old 03-10-2003, 01:54 AM   #2
Yorky
LQ Newbie
 
Registered: Feb 2003
Posts: 5

Rep: Reputation: 0
Good post - I have saved it and will use it when I can gather the strength to try compile my 1st kernel :=))
 
Old 03-10-2003, 02:13 PM   #3
SLaCk_KiD
Member
 
Registered: Jan 2003
Location: Philly, PA
Distribution: Slackware 10.2
Posts: 97

Rep: Reputation: 15
DaOne helped me get my first compile right, he was understanding of my fustration
and very patient with me. I dont think that i have anything to complain
about at all. Everyone here in the slack forum is always willing to help out
That is what I like about Slack, the people who use it are knowledgable
and always seem to lend a hand when it is needed. Thanks to all of you
who try to help us n00b's out!! hopefully one day when I know
the answers to questions that are asked, i can be as helpful as you guys....thnaks again!
 
Old 03-13-2003, 06:19 PM   #4
DaOne
Member
 
Registered: Jan 2003
Location: USA
Distribution: Slackware
Posts: 498

Original Poster
Rep: Reputation: 30
Glad at least one person got something good out of this. Just a note...all of this still still works through rc2...
 
Old 03-14-2003, 06:21 AM   #5
figadiablo
Member
 
Registered: Feb 2002
Location: Virginia USA
Distribution: Slackware, CentOS, Fedora
Posts: 342

Rep: Reputation: 30
I have compiled kernerls sucesfully before, but my questions is: If I just wanna improve from the current configuration or add something that I left out, some module; do I type make oldconfig or something so that when I do the menuconfig I see my current configuration? Or do I have to do everything from scratch and hope that I dont leave something else out? Am I complicating things out?

Thanks,
Figa
 
Old 03-14-2003, 10:52 AM   #6
DaOne
Member
 
Registered: Jan 2003
Location: USA
Distribution: Slackware
Posts: 498

Original Poster
Rep: Reputation: 30
When you type make menuconfig, your current configuration will be used. So no, you do not need to start over each time.
 
Old 03-14-2003, 07:21 PM   #7
trn
Member
 
Registered: Feb 2003
Distribution: freebsd/gentoo
Posts: 68

Rep: Reputation: 15
a tip also, after make menuconfig you can use the line "make dep && make clean bzImage modules modules_install" then go get a bite to eat or whatever and when you come back everything is all compiled and ready to go. (and yes i stole this from the gentoo install guide.. just a handy tip.)
 
Old 03-14-2003, 07:33 PM   #8
DaOne
Member
 
Registered: Jan 2003
Location: USA
Distribution: Slackware
Posts: 498

Original Poster
Rep: Reputation: 30
Quote:
"make dep && make clean bzImage modules modules_install"
This can be done if you plan to manually copy bzImage to /boot/vmlinuz, and then update lilo. Otherwise, the new kernel wouldn't be copied to the proper location, which is what make install does for you...it will copy the kernel to the appropriate location, and updates lilo.
 
Old 03-14-2003, 09:38 PM   #9
figadiablo
Member
 
Registered: Feb 2002
Location: Virginia USA
Distribution: Slackware, CentOS, Fedora
Posts: 342

Rep: Reputation: 30
Ok, maybe I'm a little dumb today, but I wan't to make sure that I get this. For example if Im using the 2.4.18, which I've already recompiled for my likings, and then go and download 2.4.20. When I type make menuconfig, does that means that the computer is going to scan the settings that Im already using and they will appear in the new kernel Im compiling? In other words will I see my curent config with the 2.4.20?

Before I forget, thaks for the earlier response,
Figa
 
Old 03-14-2003, 10:06 PM   #10
DaOne
Member
 
Registered: Jan 2003
Location: USA
Distribution: Slackware
Posts: 498

Original Poster
Rep: Reputation: 30
What you'll need to do in that case is copy your current config to the new kernel source tree...here is how I like to do this.

Once the new kernel source is in place, cd to that directory...

cd /usr/src/linux-2.4.20
make mrproper

Then copy your 2.4.18 config...

cp /usr/src/linux-2.4.18/.config /usr/src/linux-2.4.20/.config

Then you can run make menuconfig...your current configuration will be in place. There will likely be some new features in the new kernel, so you'll want to make sure you go through the configuration menu and add/remove as necessary. Once you are satisfied, you can save your changes, and continue on to make dep and so on.

Last edited by DaOne; 03-14-2003 at 10:11 PM.
 
Old 03-15-2003, 02:06 PM   #11
figadiablo
Member
 
Registered: Feb 2002
Location: Virginia USA
Distribution: Slackware, CentOS, Fedora
Posts: 342

Rep: Reputation: 30
DaOne,
Thanks for the reply. Something new that I just learn.

Figa
 
Old 03-15-2003, 07:02 PM   #12
Aussie
Senior Member
 
Registered: Sep 2001
Location: Brisvegas, Antipodes
Distribution: Slackware
Posts: 4,590

Rep: Reputation: 58
If you plan to use your previous .config you can do "make oldconfig" and it will only prompt for new kernel options.
 
Old 03-15-2003, 07:42 PM   #13
DaOne
Member
 
Registered: Jan 2003
Location: USA
Distribution: Slackware
Posts: 498

Original Poster
Rep: Reputation: 30
Quote:
If you plan to use your previous .config you can do "make oldconfig" and it will only prompt for new kernel options.
Thanks Aussie...I forgot about that one
 
Old 03-15-2003, 08:41 PM   #14
figadiablo
Member
 
Registered: Feb 2002
Location: Virginia USA
Distribution: Slackware, CentOS, Fedora
Posts: 342

Rep: Reputation: 30
cool yeah!! I knew there was a make oldconfig somewhere. Thanks for the tips guys!

Figa
 
Old 03-19-2003, 01:21 PM   #15
Astro
Member
 
Registered: Jan 2003
Location: Ballston Lake, NY
Distribution: Slackware, Debian
Posts: 665

Rep: Reputation: 30
I find that the commands make modules and make modules_install tends to mess up my kernel QUITE a bit.... i use make menuconfig; make dep; make clean; make bzImage; cp arch/i386/bzImage /boot then edit lilo accordingly...if I do the make modules and make install and make modules_install it doesnt always work, in fact it never does even if I have modules to install... not sure why at all..so I use the method I described above and it works every time.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie Guide To Compiling A Kernel! DrOzz Linux - General 318 08-20-2008 05:21 AM
I'm interested in compiling a 2.6.x kernel, is this is a decent guide? Erik_the_Red Linux - Newbie 7 08-14-2005 06:03 AM
Acid Guide to compiling Kernel 2.6.10 on Slack 10.1 acidjuice Slackware 54 03-11-2005 05:16 PM
Hardware identification guide for newbies ?? massai Linux - Hardware 5 02-03-2004 08:15 AM
: Kernel compiling guide for newbies Question Anibal Slackware 6 08-01-2003 07:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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

Main Menu
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