LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-08-2005, 11:42 PM   #1
iansoundz
Member
 
Registered: Jul 2005
Location: Arlington, VA
Distribution: CentOS 4.1 Kernel 2.6.9-11.EL
Posts: 77

Rep: Reputation: 15
Does anyone know how to Install kernel from source???


Searched all over the web. Searched the howtos on LDAP. Why are instructions for installing kernel from source so hard to find?? I really need to know how to do this. And I mean current instryuctions that apply to 2.6 kernel versions, not stuff that was written during the 2.4 days. Does anyone know WHERE I can find such a link?
 
Old 12-08-2005, 11:55 PM   #2
Charred
Member
 
Registered: Mar 2005
Location: Utah, USA
Distribution: Slackware 11
Posts: 816
Blog Entries: 2

Rep: Reputation: 30
http://www.linuxquestions.org/questi...d.php?t=127095
 
Old 12-09-2005, 12:18 AM   #3
iansoundz
Member
 
Registered: Jul 2005
Location: Arlington, VA
Distribution: CentOS 4.1 Kernel 2.6.9-11.EL
Posts: 77

Original Poster
Rep: Reputation: 15
That was way too generic...I NEED a white paper! That link doesn't take you through the steps of installing from source. Thanks anyway....anyone else?
 
Old 12-09-2005, 01:04 AM   #4
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
What else could you want? That's a step-by-step guide!
 
Old 12-09-2005, 03:27 AM   #5
gruven
Member
 
Registered: Feb 2003
Location: Arkansas
Distribution: Debian
Posts: 87
Blog Entries: 3

Rep: Reputation: 15
http://gentoo-wiki.com/HOWTO_Compile_a_Kernel_Manually

The link is pretty much self explanatory. You will have to decide what config options you want yourself, because there is not really any how-to on what to add into your kernel because most computers use different stuff.

If you use a distribution that uses RPMs or DEBs, then you will have to add the steps to convert the compiled kernel and/or kernel source into a RPM or DEB file, so that you can uninstall it later if you so choose, and the OS will recognize it in the package database.

But, if you don't mind maintaining the kernel and source manually, than that is an option also. It is generally easier to convert it to whatever package your distro uses though, because most distros that aren't built-from-scratch (and even some that are) have certain boot options that you will need (such as an initrd image and the likes). If you have another kernel listed in your grub.conf or menu.lst, you can usually just copy the same stuff and just change the kernel.

Not nearly as hard to compile a kernel as it is made out to be though.

Last edited by gruven; 12-09-2005 at 03:31 AM.
 
Old 12-09-2005, 04:38 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by gruven
Not nearly as hard to compile a kernel as it is made out to be though.
Easy for a Gentoo user to say.
I was scared shitless as a RH9 user when I contemplated it. Never did do it on RH - figured I may as well take the jump and went Gentoo.
We all know kernels are a doddle - it's committing to doing the first one that's the hard bit.
 
Old 12-09-2005, 05:43 AM   #7
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,272

Rep: Reputation: 154Reputation: 154
A quick google brought this up - http://www.linuxgazette.com/node/9060

I think you'll find Charred's link does take you through the steps of installing the kernel from source. And yes, installing the kernel from source isn't that hard. Sometimes, at first it may take a few compiles to get it right, but thats why you keep the old kernel installed - to boot from when the new one doesn't work
 
Old 12-09-2005, 08:29 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Google: "Build Linux kernel from source"---9 million hits, at least one tutorial in the first 10.

"Searched on LDAP"???? What's that?
 
Old 12-09-2005, 09:13 AM   #9
runlevel0
Member
 
Registered: Mar 2005
Location: Hilversum/Holland
Distribution: Debian GNU/Linux 5.0 (“Lenny”)
Posts: 290

Rep: Reputation: 31
Quote:
"Searched on LDAP"???? What's that?
I think TLDP
 
Old 12-09-2005, 09:41 AM   #10
runlevel0
Member
 
Registered: Mar 2005
Location: Hilversum/Holland
Distribution: Debian GNU/Linux 5.0 (“Lenny”)
Posts: 290

Rep: Reputation: 31
Exclamation

Quote:
Originally Posted by iansoundz
Searched all over the web. Searched the howtos on LDAP. Why are instructions for installing kernel from source so hard to find?? I really need to know how to do this. And I mean current instryuctions that apply to 2.6 kernel versions, not stuff that was written during the 2.4 days. Does anyone know WHERE I can find such a link?
We have an entry in the Wiki.
There are indeed tons of HOWTO's and guides, I myself wrote one in Spanish (nop, no URL, it's out of date).

But before you begin doing anything, I would ask you some important questions:
  1. Why do you need to recompile the kernel?
  2. Are you sure you need a vanilla kernel?
  3. Do you know if you have to install any patches?

Question 1 means that if you plan to recompile to get a functionality such as a modem or printer driver you will first need to check if your stock kernel ships it. Most drivers can be loaded using menus or the console command modprobe.

The second question is also important and related to Q3. I'm not quite sure that you know what the differences are between a vanilla kernel from http://kernel.org or your distro's kernel sources.
This is very important, as the kernels shipped with the distros are (sometimes heavily) modified versions of the vanilla versions (vanilla means "official and unpatched"). Each option means to download a different package from different sources.

The third question is not only valid if you try to use a vanilla kernel. You will not only need to know how to patch, but also how to know which patches are already applied.

My advice: Before doing anything, tell us why you need to recompile and what distro you are using, many of us have already compiled hundreds of kernels and we can be of help in case something goes wrong...

Important: Backup your full /boot partition, if you feel lazy, just copy it over to your /root directory. If anything goes wrong you will still be able to access your system from a LiveCD and replace the b0rked kernel with a Known Good One(TM).

There are also settings for adding a custom version suffix, so that you can keep more than one kernel w/o overwriting the files.

Last edited by runlevel0; 12-09-2005 at 09:43 AM. Reason: hilight warning
 
Old 12-09-2005, 11:19 AM   #11
Charred
Member
 
Registered: Mar 2005
Location: Utah, USA
Distribution: Slackware 11
Posts: 816
Blog Entries: 2

Rep: Reputation: 30
Quote:
Originally Posted by syg00
...kernels are a doddle - it's committing to doing the first one that's the hard bit.
Yeah, compiling a custom kernel is definitely not FUDworthy.
 
Old 12-10-2005, 03:43 AM   #12
iansoundz
Member
 
Registered: Jul 2005
Location: Arlington, VA
Distribution: CentOS 4.1 Kernel 2.6.9-11.EL
Posts: 77

Original Poster
Rep: Reputation: 15
Runlevel0,

The reason I need to do this is because CentoS 4.1 left out the /usr/src/linux.blah directory tree. I am trying to load a custom module that depends on it's existance. I was told from a different question I posted on this forum that the only way I can get this directory tree is to Install a kernel from source....
 
Old 12-10-2005, 04:21 AM   #13
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I would be mighty surprised if Centos don't provide a kernel source and/or devl rpm.
This will be your best bet if available, as it will have the Centos patchset included.
Hit the site/wiki/fora ... whatever.

However, given the RedHat ancestry I'd not be surprised if you had to define the /usr/src/linux symlink yourself.
God, I detested RH9 after a (very short) while ...
 
Old 12-10-2005, 06:24 AM   #14
runlevel0
Member
 
Registered: Mar 2005
Location: Hilversum/Holland
Distribution: Debian GNU/Linux 5.0 (“Lenny”)
Posts: 290

Rep: Reputation: 31
Quote:
Originally Posted by iansoundz
Runlevel0,

The reason I need to do this is because CentoS 4.1 left out the /usr/src/linux.blah directory tree. I am trying to load a custom module that depends on it's existance. I was told from a different question I posted on this forum that the only way I can get this directory tree is to Install a kernel from source....
Hi,
CentOS is a free clone of Red Hat Enterprise. This is an important info, so we have something to start with

First: You must use CentOS or Red Hat's packaged kernel sources, as RH patches the kernel extensively (don't forget that they have Alan Cox working there). Don't expect your sytem to work propperly with a vanilla kernel.

The good news is that this makes everything lots easier. So if you are sure that the modules you need are not shipping with the kernel, all that you need is to install one of these files:

Before starting take a look at this document, maybe you can solve your problems w/o recompiling: Red Hat Enterprise/CentOS Guide: Kernel Modules.

To get the sources in place, just install the source RPM as a normal one. After that you will have your sources properly placed. Now just make a symlink and you can begin recompiling.

Code:
ln -s /usr/src/kernel-whatsoever /usr/src/linux
Jump to your source tree and let's go:

Before starting to do anything, let's take a small but effective security meassure: Fire up your favorite editor and edit /usr/src/linux/Makefile.
Edit the field EXTRAVERSION="" to a string you like, as i.e. EXTRAVERSION="-local01"... So your kernel will be 2.6.9-5.0.5.EL-local01 and will not overwrite any file. Save the Makefile and let's go to the compilation.

Code:
gzip dc /proc/config.gz > /usr/src/.config
make menuconfig
The first command copies the actual configuration to your kernel source, so that you have a known good base to begin with.
I don't know what module you need, so you are on your own here. Just one tip: If you ingore what an option does, simply mark it as a module, if the system doesn't need it it will not be used.

To end the compilation and get evetrything copied over to it's place, just type
Code:
make install
Now use CentOS' own tools to check if grub is OK and points to your new kernel. If you use grub you can now safely reboot, if you use Lilo instead, remember to run the command lilo before rebooting.

If you need a more in deep assistance, just ask us. Also, if you tell us what module you need, we will surely find out whether you need to recompile or not.




That should be all

Last edited by runlevel0; 12-10-2005 at 06:55 AM.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
trying to find/install kernel-source or kernel-headers timsch75 Slackware 3 10-22-2005 09:17 AM
10.1 install kernel and kernel-source different - build fails Feebles Mandriva 2 06-10-2005 06:58 PM
slackware kernel source install (kernel 2.6.6) ? LinuxOG Slackware 22 06-06-2004 04:34 PM
How to install the kernel source? sweet*amber Linux - Newbie 3 04-29-2004 07:22 AM
Kernel Source Install HELP! dbzw Linux - Software 3 02-19-2004 07:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:05 AM.

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