Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
Okay, somebody mentioned the following paragraph in the README file of the kernel source:
"Do NOT use the /usr/src/linux area! This area has a (usually incomplete) set of kernel headers that are used by the library header files. They should match the library, and not get messed up by whatever the kernel-du-jour happens to be."
Linus Torvalds seems to have said the same.
Now, almost every distribution seems to advise otherwise. They all say: "Copy your new kernel source into /usr/src/linux and compile it". The warning would make sense to me if you would compile a new kernel and wait for a year to use it. You could bump into the problem that library header files (like used by modules) need some reference in /usr/src/linux which is now being changed.
But I guess most users recompile their kernel to add new features they want to use right away: So we compile our kernel, place in into the boot directory, recompile our modules, reboot and we're running with the new features we want.
I guess things go wrong if you forget to recompile your modules while running a new kernel. But in most cases the version mismatch between old modules and the new running kernel is bigger than the version mismatch between old modules and the new kernel source (compiled and well).
If you are just trying to reconfigure your present kernel, then you can use the linux@ directory. But before you create the new kernel, edit the Makefile to something different than the present kernel settings or it will write over top of your old modules.
"/usr/src/linux" is really a soft-linked directory to a real directory. So if you are unpacking the source for a newer kernel, it will make a second directory beside the one that came from your installation CD's. In the case below, the linux-2.4.8 is the present kernel source and linux-2.4.22 is the newer source you have downloaded. But linux@ is still linked to linux-2.4.8 so you can't use it.
Your /usr/src might look like this:
linux@ linux-2.4.8 linux-2.4.22 /RPM
Since you cannot link linux@ to more than one directory, you must remove linux@ by entering the command (as root)
rm linux
next:
ln -s linux-2.4.22 linux
This will make linux@ linked to the new source directory.
Now you can use the linux@ for compiling your new kernel.
Hope this helps,
Harry
Last edited by harrygraham; 09-13-2003 at 10:48 PM.
Under kernel 2.2.x it was partly true that you could screw up things because the compiler would have the /usr/src/linux/.... in its include path, and a gross version mismatch could get you in trouble. 2.4.x captures its headers under /lib/modules/<version>/build/include, so this is no longer a problem. It is a good idea to make a paralle kernel tree and do the symlink if you get a new kernel so you can go back quickly.
Thanks mlp68. Your answer explains it all. I never looked into /lib/modules/<version>/build before. So that's what's eating my disk space .
About the symlink: Mostly I fool around with both a stable kernel (2.4) and a development kernel (2.5), so I use the symlink trick all the time. But I never ran into troubles when having no "/usr/src/linux" directory. Now I know I don't need one.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.