LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   How to install linux kernel (https://www.linuxquestions.org/questions/linux-kernel-70/how-to-install-linux-kernel-896361/)

dspjm 08-09-2011 09:35 AM

How to install linux kernel
 
When I install some linux distributions, such as fedora, debian, especially live version, there is no source code of linux kernel under /usr/src, how can i install the source code?
Thanks

ButterflyMelissa 08-09-2011 10:23 AM

Hi,

You need to pick it up at the website , put it somewhere in the user folder and unpack it.

Next, you may want to compile it...
Greetz!

Thor

dspjm 08-09-2011 11:01 AM

I mean the src of kernel under /usr/src is the source code of the current kernel. If I download a new one and compile it, the system might not work. When I install VMPlayer or something, I have to use /usr/src/kernels to install the software. So ...

ButterflyMelissa 08-09-2011 11:35 AM

Nonononono, this is not really how a kernel works.
Granted, the ./usr/src should hold the source code of the current kernel. Your distro should have that in the repo. You could download that.

But, if you want to compile a kernel, there needs to be a good reason for it. Kernels are fairly well fine-tuned to most needs, so a recompile needs to be founded in some extra need.

Is there a reason to recompile, then go tahe these steps (roughly)

Find out what kernel you use now:

Quote:

uname -r
...will return the version number. Go to the site and download that package. Put it in your folder after unpacking.

Enter

Quote:

make menuconfig
to do the tweaks, then

Quote:

make
to compile and finally

Quote:

make install
Tweak the GRUB as required.

If you'd use a newer version, be aware that the ODD numbers are experimental, the EVEN numbers are stable. The choice (of course) ;) is yours...

At any rate, whatever is installed on the system will/should run.

See a kernel as an engine in a Lambo. By recompiling it, you basically get to choose the engine before you drive out of the garage.

In the GRUB menu, you get to choose the kernel, the old (and fully working one) stays around, if all goes bad, restart the system, and choose the previous kernel and you're off...

Thor

sundialsvcs 08-09-2011 08:06 PM

The source-code of a kernel is not required in order to successfully install a new kernel, i.e. from a package.

That source-code may be required, however, if the program in question needs to know about kernel-related data structures that pertain to the currently-installed kernel.

This is why "kernel source-code" is usually designated as an optional package.


All times are GMT -5. The time now is 03:24 PM.