Does anyone know how to Install kernel from source???
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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
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:
Why do you need to recompile the kernel?
Are you sure you need a vanilla kernel?
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
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....
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 ...
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.