LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Kernel Source Location (https://www.linuxquestions.org/questions/linux-kernel-70/kernel-source-location-476780/)

pete1234 08-23-2006 07:49 PM

Kernel Source Location
 
Up until now I think I've been going about updating my kernel ass backwards. First off, I always download the whole source which doesn't take very long, but seems unnecessary. So I was looking into just applying the patch instead. In doing so I realized I keep my kernel source in /boot, and not /usr/src/linux. So I'd like to know two things; one is there any reason to store the source in /usr/src/linux, or is it just tradition, also is there any disadvantage to applying a kernel patch, as opposed to fresh source. I apologize if these are silly question, when it comes to kernel matters other than just customizing / compiling I'm a newb.

perfect_circle 08-23-2006 08:06 PM

Quote:

one is there any reason to store the source in /usr/src/linux, or is it just tradition,
No, and Linus Torvads says it's a bad idea to compile kernels from there. He says it's better to compile the kernel as a user in your home directory and then install.
Some old programs may check the /usr/src/linux link to find the kernel source if they need it (not sure about that), but the correct place to find the kernel source is the /lib/modules/<version>/build link. So make sure this points to the correct location.

Quote:

also is there any disadvantage to applying a kernel patch, as opposed to fresh source
No, it's the same thing. That's why the patches are for.

pete1234 08-23-2006 08:13 PM

Thanks for the reply. Another question, when I patch, I'd still patch the kernel source (which I have in /boot) per this link: http://kernelnewbies.org/FAQ/HowToApplyAPatch as opposed to /lib/modules/<version>/build?

perfect_circle 08-23-2006 08:41 PM

This link is created when you do "make modules_install" To install the modules. So this is not a problem.

pete1234 08-23-2006 08:49 PM

Thanks. Guess I'm going to go ahead and patch.

ciotog 08-27-2006 02:53 AM

Patching is definitely the way to go, even if just to take some load off of the kernel.org servers.

I read that FAQ, and I must say they make it sound rather confusing. It's really not so complicated - I think the README in the kernel source says it more clearer.

unreal128 08-27-2006 03:10 AM

If it is a bad idea to have the source in /usr/src/linux, why do some distros (eg. Gentoo) use it to compile the kernel with their automated tools (eg. genkernel?) Why put it in the user directory if it can only be compiled by root? I am not questioning the wisdom of your guy's conclusion, I just want to understand it better for myself.

ciotog 08-27-2006 10:54 AM

The kernel can be compiled by anyone with read/write privileges in the folder where the kernel has been extracted, it only needs to be installed as root.

As for the kernel location, I always used to use /usr/src but have since migrated to /home/share/kernel (I create a /home/share folder on every system I set up for shared files). Basically when you are compiling some software, it may look at /usr/src/linux first when it should really be checking /lib/modules first (as mentioned by perfect_circle). If this software uses kernel headers for a new kernel, whereas the c libraries were compiled against an older kernel, you could end up with library issues ("missing" functions and such that were added to the new kernel).

I don't think I'm explaining it too well, but that's the general idea. If you search for "linus /usr/src headers" I'm sure you could find some commentary by Linus Torvalds concerning the matter. If you read the original README files for some older kernels you'll see that at one point it was suggested to use /usr/src, but this has been changed.

unreal128 08-27-2006 04:08 PM

Thanks for the explaination. I will check out the resources out there.


All times are GMT -5. The time now is 10:14 PM.