LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   A question about kernel recompiling... (https://www.linuxquestions.org/questions/linux-newbie-8/a-question-about-kernel-recompiling-4175431009/)

trist007 10-07-2012 03:58 PM

A question about kernel recompiling...
 
Usually I follow this procedure to recompile a kernel.

cd /usr/src/linux
make clean
cp /boot/config .config
make menuconfig // make my changes
make
make modules
make modules_install
make install
update boot loader and reboot

However, I noticed that after running "make" I see that it is compiling modules. So I took a look at the Makefile and it says it builds modules by default. So obviously we can skip that setup and go straight to "make modules_install" and then "make install"?

I just wanted to check on this.

-Tristan

trist007 10-07-2012 04:08 PM

Also, sometimes when I recompile a kernel, I get errors at the beginning as the modules are loading saying that the kernel modules are meant for a different kernel. I'm pretty sure this has to do with the name of the kernel not matching up the kernel that the modules were compiled for. The error is "kernel mismatch" I think. So when I do a kernel recompile, where do I specify what new kernel name to use? It's going to be the same kernel version. I just set PREEMPTION to full. Do I even need to recompile the modules? I mean they still get recompiled under "make" by default, but I mean theoretically. In any case to avoid that error, what needs to happen? I'm guessing I need to name the kernel something like 2.6.37.3-smp-preempt? Then the modules will be under /lib/modules/2.6.37.3-smp-preempt? instead of /lib/modules/2.6.37.3-smp? What causes the kernel version mismatch to occur exactly? Where does it check it and how would I fix it?

Also, I'd like some feed back on my first post as well.

-Tristan

trist007 10-09-2012 08:35 AM

bump

JaseP 10-09-2012 09:03 AM

If all you are doing is building modules and not compiling them into a kernel, directly, or applying kernel patches, you can usually just use the kernel headers to compile your modules. So, it begs the question of what you are doing... ??? Building kernel modules? Patching a kernel for use with problem hardware? Customizing a kernel for optimal/streamlined hardware use?

Also, there are tools like module-assistant that make your life easier when compiling modules. Also, don't forget that you may have to recompile your backports, and other things, when you (re)compile the kernel. Plus you should make sure you are compiling within the correct kernel tree, etc. All modules must match the kernel version you are running, and many modules are found in other separately installed packages (and need to be updated too). It's usually something stupid, like not being in the right path when compiling that gives you this kind of trouble. Things like DKMS make this less painful than in years past.

I was actually surprised that a RHCE would have this issue, until I looked again at the current requirements. "Back in the day," the RHCE required more hands-on kernel config stuff. But I'm going back to around the 1999-2000 era for that. Back then, we had to config and compile our kernels on install with many distros... That meant intimate knowledge of hardware devices, etc. ... setting the kconfig,... and was a big reason that I didn't jump into using Linux, full time at home, until about 2002... or go for a RHCE cert., myself. I've since forgotten more of this stuff than a lot of typical users know now...

brianL 10-09-2012 10:34 AM

I've only recompiled a kernel once, but I followed Alien Bob's article successfully.
http://docs.slackware.com/howtos:sla...kernelbuilding

trist007 10-09-2012 01:38 PM

Thanks for that link that answered it.

Quote:

If you are (re-)building a Slackware kernel, you should make sure that installing your new kernel will leave the original kernel modules intact. You do this by changing the local-version part of the kernel's release number to an unique string (under “General setup” > “Local version - append to kernel release”). This kernel option corresponds to CONFIG_LOCALVERSION in your .config file. Slackware sets that value to ”-smp” for a SMP kernel to give you an idea.
The resulting kernel release value (as returned by ”umake -r”) for a kernel version ”2.6.37.6” with a local-version of ”-alien” would be ”2.6.37.6-alien”


All times are GMT -5. The time now is 03:45 PM.