Linux.com

Home Linux Community Forums Linux Distributions Slackware Doubt in linux file management?

Doubt in linux file management?

Link to this post 19 May 11

Hai,

Am using slackware,fedora. In both cases , there are two dirs,

1. /usr/src/linux-{Kernerl version}/
2. /lib/modules/{kernel-version}/


what is the difference b/w these two? Actually , these two dir content are totally different, I agree. But, which one is the Kernel source ? :huh:

For writing device drivers, I am using the second one. But, actually, the first one only is in "src" dir .

I am not sure , this question is meaningfull or not, may this is so naive. But , want to know the difference. thank you

Link to this post 19 May 11

/usr/src/linux-{version} is where the linux kernel source code is stored for you to make new modules or compile a new kernel.

/lib/modules is where your compiled kernel modules are stored to be used by your system, if you make a custom kernel this directory will only contain the modules that you have selected as modules in the kernel configuration.

Link to this post 19 May 11

got it. thank you fillpot. :-)

Link to this post 19 May 11

linustorvalds wrote:

Hai,

Am using slackware,fedora. In both cases , there are two dirs,

1. /usr/src/linux-{Kernerl version}/
2. /lib/modules/{kernel-version}/


what is the difference b/w these two? Actually , these two dir content are totally different, I agree. But, which one is the Kernel source ? :huh:

For writing device drivers, I am using the second one. But, actually, the first one only is in "src" dir .

I am not sure , this question is meaningfull or not, may this is so naive. But , want to know the difference. thank you

Just to be clear, in Fedora, the kernel source (packaged in kernel-devel or kernel-PAE-devel) is installed to:

/usr/src/kernels/{kernel_version}/

and like mfillpot said, the kernel modules, etc. are installed to:

/lib/modules/{kernel_version}/

In this directory is a directory named "source" which is actuall a symbolic link to "build" in the same dir and "build" is actually a symbolic link to the above kernel source dir (/usr/src/kernels/{kernel_version}/).

Link to this post 20 May 11

The kernel source can be wherever you want.

The modules, on the otherhand, must be in /lib/modules (or you symlink/hardlink it somehow)

Regards

Link to this post 20 May 11

thanks Marc and atreyu .

@ atreyu : " In this directory is a directory named "source" which is actuall a symbolic link to "build" in the same dir and "build" is actually a symbolic link to the above kernel source dir (/usr/src/kernels/{kernel_version}/). "

Having a Kernel Source is optinal[ I guess]. If that is true, If I dont have kernel source, where these symlinks in lib/modules points to?
And, as Matt told, if we change modules[load/unload], those changes will be in "lib/modules" ,If they are symlinks, will it affect[it has to, I think], the ORIGINAL Kernel source ?

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board