On Tue, 8 Jul 2003, Gordon Messmer wrote: > Robert P. J. Day wrote: > > can someone explain how the kernel source, header files and /lib/modules > > directories work together? > > My impression is that: > > Your kernel should be compiled as a non-root user, in a directory that > they have write access to (perhaps their own home dir), and then > installed by the root user. > > Modules and a symlink to the build tree are stored in > /lib/modules/<version>. Third party kernel modules should look in that > symlink to find the kernel's .config file and the headers that they need. yup, this is pretty much what i understand these days. my main concern with my previous postings was to clear up a couple of issues: 1) was there *any* reason to have the kernel source and build under /usr/src anymore? i might be wrong, but i recall from way back that, when one installed new source, one would always create a symlink /usr/src/linux -> [current source tree], and that that symlink was used by ... *something* to find the kernel source, or perhaps the header files under that source tree. i just wanted to verify that that symlink was not used anymore and that proper access went through /lib/modules these days. well, ok, i guess that's just the one point i wanted to clarify. > /usr should be able to be mounted read-only, so it's not a good idea to > build kernels there. However, it's OK for a distribution to store a > read-only copy of the kernel source and headers in that location for the > reference of third party modules. The "build" symlink in the > distributed modules directory should point to whatever location the > distribution used for its kernel source. whoa, hold on there. it occurs to me that one can store the kernel source in one location (possibly under /usr, RO), but do the builds in another location. what i've done before, for testing, is to start with a pristine, write-protected source tree, and make a duplicate of it using hard links with "cp -al". this way, i can make a mess of the duplicate directory, and just remove it entirely and recreate it if necessary. (i guess symlinks would work just as well, and allow the test directory to be in a different filesystem.) anyway, based on this idea, where would the /lib/modules/.../build symlink point? to the original pristine ("make mrproper"ed) source directory? or to my linked test directory? if the purpose of that build link is simply to allow access to the source and header files, then pointing to the original directory is fine. but if (as you suggest above), that build link is also used to find the current .config file, that would exist only in my actual build directory. and, furthermore, if it's used to locate the .config file, what if i do a "make mrproper" after i install the new kernel? then there won't *be* a .config file. will things break? anyway, you can tell i'm bored, just waiting for the TdF coverage to start. rday -- Robert P. J. Day Eno River Technologies Unix, Linux and Open Source training Waterloo, Ontario www.enoriver.com