-   Linux - General (
-   -   Does recompiling the kernel overwrite the modules ? (

ankit4u1 07-17-2007 07:36 PM

Does recompiling the kernel overwrite the modules ?

I want to recompile the kernel. But I am not sure if it overwrites the modules !!!

I have 2.6.16 kernel with RHEL 4. but I want to recompile it to 2.6.11 as I need that, because I need to patch it and the patch is available for 2.6.11 only.

so, should I go ahead with recompiling? Is it advisable? will the modules be over written?

Thanks in advance.


slakmagik 07-17-2007 07:50 PM

The modules should go to /lib/modules/$KERNEL_VERSION, so I believe they'd be stored alongside, rather than overwrite, and you should be okay.

However, some patches will apply (maybe with fuzz/offset, but apply) even if they weren't specifically for a certain version, so you could try applying it to a more recent kernel source. I can't say whether that would be more or less desirable, but it's a possible alternative.

As yet another possibility, if you know your hardware and it doesn't often change, you can compile a static kernel with no modules, though everything's set up to expect modules, so that's definitely swimming against the current.

ankit4u1 07-17-2007 08:05 PM

I am compiling the kernel. As you said, it did not overwrite the modules. Great !


you can compile a static kernel with no modules, though everything's set up to expect modules, so that's definitely swimming against the current
Does this mean that, I should not select any module while compilation !!
When I started the compilation, it showed me the GUI, from where i can select the modules...
Do you mean that I should uncheck all the options?

Plz correct me if I am wrong !! thanks

slakmagik 07-17-2007 08:38 PM

No no - if everything's going well for you (and I'm glad it is), then just stick with it. :)

I just mentioned the alternative method because it makes modules a non-issue. You'd basically go through whatever configuration method you choose and disable kernel support for modules and then, for each config option, you'd either build it in directly or not build it at all. So definitely not uncheck all - just uncheck all unneeded and then make sure all that *are* needed are builtin. The problem is that if you miss anything, it's broken; if you build in anything you don't need, it's wasting resources at all times; and if your hardware configuration changes, your kernel will need to be recompiled to cope with that - and, as I say, system startup scripts and whatnot always assume you have modules to be probed and inserted and so on and get disappointed when they can't. So there are many arguments against it and I probably shouldn't have even mentioned it. ;)

ankit4u1 07-20-2007 10:39 AM

general question about recompilation
Also, during recompilation, there are three options,

module <M>
build-in[*] and
[] excluded

If I want to include some module, which one should i select, module<M> or built-in[*] ??

thanks in advance...

slakmagik 07-20-2007 11:00 AM

If you want to include 'some module' then it has to be 'module' - builtin means it won't be a module and not setting something means it won't be anything at all - but I'm guessing you mean whether it should be a module in the first place.

Basically, it's up to you. When compiling a kernel and not doing a static one (everything builtin), I tend to go on the theory that, if I need it all the time and it's not likely to change, compile it in. If it's something I rarely need or often change, make it a module. Like IDE and ext3 builtin and USB storage and FAT as modules - that sort of thing. Most things should be builtin.

ankit4u1 07-20-2007 11:07 AM


I selected M for IPSEC service. But when I do, ipsec --version, it says

Linux Openswan U3.0.06GITGITGIT/K(no kernel code presently loaded)

I also did

modprobe ipsec, then it says
FATAL: Module ipsec not found

So, I started recompilation of the kernel again and changed M to[*] built in for IPSEC and i did

modprobe ipsec again, but without success...Does that mean that module IPSEC is not installed?

That's where is the confusion.....

slakmagik 07-20-2007 11:15 AM

Well, that's just it - if you build something in, it's not going to produce a module and none of the module tools apply. If it's builtin, then (keeping in mind I don't know anything about ipsec) you should have ipsec capability - it's just that it's not going to be loadable code, so the module tools won't know anything about it.

ankit4u1 07-20-2007 11:25 AM everything is fine with the recompilation...seems to be some other problem to be sorted out for IPSEC...

frustration setting in now !! spent too many days behind this...

Thanks for the wonderful help !

slakmagik 07-20-2007 12:25 PM

You're very welcome! I know the 'burned out' frustrated feeling, too. Sometimes just stepping away for awhile almost sorts the problem out by itself - I've had several problems that seemed impossible and on coming back to them after a break, they seemed almost easy. Or maybe start a new thread specifically on ipsec and somebody who knows about that will pitch in. Good luck. :)

ankit4u1 07-20-2007 12:33 PM

Thanks !! M starting a new thread after one to two more hours of fight !:scratch: lemme scratch my head

All times are GMT -5. The time now is 11:20 AM.