[wplug] Where the modules live

Rafael E. Herrera raffo at neuronet.pitt.edu
Mon Mar 5 12:13:18 EST 2001


> Rick Reynolds wrote:
> 
> I've always wondered how this works:  where is the path to the modules
> directory defined?
> 
> E.g., I build a kernel (say 2.4.2).  When I do the make_install, it
> places the modules under /lib/modules/2.4.2/...  Then, magically, the
> kernel knows where to get its modules from when it loads.  It seems
> like the definition of the modules directory is somehow "built-into"
> kernels when the get compiled.

The modules get installed under /lib/modules/"Kernel Version". The job
of loading the utilities is done by the modutilities (insmod, rmmod,
etc.), which in turn are called by the kernel. The kernel doesn't care
where they are stored.

> I'd like to be able to change the path to something like
> "2.4.2-addDriver1" when I'm recompiling kernels to add certain
> features.  What I do now is rename the modules directory to something
> like "2.4.2-SAVE" and let the kernel build place the modules into the
> real location "2.4.2".  It would be nice if I could have multiple
> module paths, one for each of my kernels that I've built (especially
> when trying out new things).


You can compile your own kernel with a special version, just edit the
top Makefile

$ head /usr/src/linux-2.4.0/Makefile 
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 2
EXTRAVERSION =

Add whatever you want in EXTRAVERSION, for example,

EXTRAVERSION ="-addDriver1"

After booting that kernel you should get

	$ uname -r
	2.4.2-addDriver1

and your modules will be installed in lib/modules/2.4.2-addDriver1.

-- 
     Rafael



More information about the wplug mailing list