LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-26-2010, 02:58 PM   #1
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Rep: Reputation: 31
Compile kernel from one PC for another?


Can I compile a kernel from kernel.org and later install it on another PC?
Do I lose some advantage this way?
or, kernel I compile for my computer is valid only for my computer?
 
Old 01-26-2010, 04:12 PM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
You must download the source to the usual place, then build the kernel. The result is a .deb file which you can install on any machine. Provided of course you have not excluded any modules needed for that other computer, but those chances are slight.

jlinkels
 
1 members found this post helpful.
Old 01-27-2010, 12:00 PM   #3
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
And when I start compile a kernel, before compile I can add or remove modules with makegconfig.
If I dont change anything, will be compiled as the default kernels that I have in debian.org?
I have to add modules always?
 
Old 01-27-2010, 12:23 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
You can exclude loadable modules. As a matter of fact, over 90% of the compiled modules are not needed for a particular machine. The trick is to determine which modules you don't need. Both lsmod and lspci do not give you a one-to-one relationship between hardware, module name on one side and the config name on the other side. It is easy to exclude the wrong modules from compiling.

On the other hand, compiled loadable modules only use disk space and compiler time. They are not loaded at boot time.

This is different for compiled-in modules, which make the kernel larger and make the kernel longer to load.

However you must have good reasons to want to exclude compiled-in modules and really know what you are doing.

jlinkels
 
1 members found this post helpful.
Old 01-27-2010, 12:34 PM   #5
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Hey jlinekls

Thank you for explaine me somethings.
I never compile a kernel but I wantto do it.
Actually I tried, but I had some problems.

Quote:
On the other hand, compiled loadable modules only use disk space and compiler time. They are not loaded at boot time.
Are that options you put in fron "m"
So, all modules you marked as "m" are compiled loadable modules and they are not loaded at boot time?
 
Old 01-27-2010, 12:40 PM   #6
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by miros84 View Post
Are that options you put in fron "m"
So, all modules you marked as "m" are compiled loadable modules and they are not loaded at boot time?
That is correct. Only the ones you need are loaded at boot time. Those are listed in lsmod

jlinkels
 
Old 01-27-2010, 12:50 PM   #7
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
So, thats not bad idea to select modules as "m"
So, if someday you need one, you can just enable it.
Because if you dont have it, you must compile your kernel again, is that right?
I mean, if you miss some modul, you cannot just add it, if before, at least you havenot marked it as "m"
Is that correct?
 
Old 01-27-2010, 01:21 PM   #8
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
If you did not include a module you must recompile your kernel. However, I believe that only the missing module is compiled. All other modules are already compiled and if you have not changed anything else, the kernel make process might decide it only has to compile the added module. So only the missing modules are compiled and a new .deb file is produced.

That is how it should work. I do recall however that in the past I have seen the entire tree was recompiled after I added a module. I don't recall if I did something stupid or that the Debian tools recompile everything by default.

jlinkels
 
Old 01-27-2010, 01:50 PM   #9
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
One more questios,
Do you know where can I change the name of the kernel before compile it?
 
Old 01-27-2010, 01:59 PM   #10
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
The name of the kernel can be altered in "General Setup" near the very start of the configuration. Enter a string for LOCAL_VERSION and that will be the internal name of the kernel.

Sasha
 
Old 01-27-2010, 02:11 PM   #11
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Thank you Sasha.
Helping me again

I have it this way:

Code:
CONFIG_LOCALVERSION=""
by default
So, I can put some name in "name" right?
Is there some howto or manual where can I learn about all these optio in .config file?
 
Old 01-27-2010, 02:14 PM   #12
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
As for a manual, there probably is one, or probably MANY of them, but I don't have a good link to give you unfortunately. I usually use "make xconfig" and just go with the documentation that this provides built-in. Also, there is LOADS of documentation inside the /Documentation folder inside the kernel source, and it is probably most current with whatever kernel version you are working with.

And yes, you can use whatever name you like in that LOCAL_VERSION thing. I usually use a combination of the kernel version, plus a build version.

Sasha
 
Old 01-27-2010, 03:28 PM   #13
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
After installing the new kernel, do I have to delete the folder, in which I extracted the kernel from kernel.org?
I mean, I downloaded the sources from kernel.org and extracted in /home/miros/kernel
After compiling the kernel, can I delete folder /home/miros/kernel?
I need to keep it?
 
Old 01-27-2010, 03:34 PM   #14
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Uhhhh.. Well, if the kernel you made is for another machine anyhow, and on that other machine, nothing will be compiled against the kernel sources, then yes, you can delete it.
However, I feel I should mention that, usually, the kernel sources are KEPT after compiling, for the reason mentioned: you will need it to compile anything against the kernel (such as nvidia driver or whatever).

In short: copy the new kernel image, and the modules directory, over to the destination machine. And delete the sources off your build machine.

EDIT: Or, copy the sources over to the other machine too, just incase

Last edited by GrapefruiTgirl; 01-27-2010 at 03:38 PM.
 
Old 01-27-2010, 03:48 PM   #15
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Original Poster
Rep: Reputation: 31
Good info.
i use to install nvidia driver.
And if I copy the source to other PC, how this other mashine will know where I copied the source?
I need to put it somewhere?
 
  


Reply



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
[Compile kernel] How to compile/install the modules ? frenchn00b Linux - General 1 09-06-2009 03:18 PM
Trying to patch kernel + compile, compile is looping. kripz Linux - Kernel 1 06-16-2009 06:51 AM
Why can't I compile this kernel module? (kernel: 2.6.8-powerpc Debian sarge) Lannix Linux - Hardware 5 05-01-2007 12:29 PM
upgraded kernel, won't let me compile kernel once Suspend2 patches are applied microsoft/linux Linux - Laptop and Netbook 3 10-02-2005 02:37 PM
Kernel 2.4.23 compile causes kernel panics on ATA RAID-1 (mirror) array Raptor Ramjet Slackware 3 12-18-2003 01:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:37 PM.

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