Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-07-2012, 03:58 PM   #1
Senior Member
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Rep: Reputation: 69
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 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.

Old 10-07-2012, 04:08 PM   #2
Senior Member
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
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 Then the modules will be under /lib/modules/ instead of /lib/modules/ 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.

Old 10-09-2012, 08:35 AM   #3
Senior Member
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
Old 10-09-2012, 09:03 AM   #4
Senior Member
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 12.04/14.04, Scientific Linux 6.3/6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,799

Rep: Reputation: 157Reputation: 157
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...
Old 10-09-2012, 10:34 AM   #5
LQ 5k Club
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.2
Posts: 7,533
Blog Entries: 56

Rep: Reputation: Disabled
I've only recompiled a kernel once, but I followed Alien Bob's article successfully.
Old 10-09-2012, 01:38 PM   #6
Senior Member
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
Thanks for that link that answered it.

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 ”” with a local-version of ”-alien” would be ””


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
recompiling a kernel module without rebuiling the kernel? MrUmunhum Linux - General 1 07-24-2011 04:43 PM
difference between kernel recompiling and kernel rebuilding vineet7kumar Linux - General 1 09-27-2007 01:35 AM
Increasing Kernel stack size to 8k without recompiling the Kernel deathman Linux - Software 2 04-08-2006 04:39 AM
can i compile just one kernel module whithout recompiling the whole kernel? edman007 Linux - Software 3 02-17-2004 03:05 PM
Recompiling Stoc Drake 9.0 kernel for Athlon XP question wrc1944 Linux - Distributions 3 02-14-2003 04:26 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:04 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration