LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 06-04-2014, 09:10 AM   #1
saroj1439
LQ Newbie
 
Registered: Nov 2011
Posts: 17

Rep: Reputation: Disabled
How to compile a kernel in linux


Hi Team,

I would like to know how to compile kernel in linux, Kindly share the info.

Many Thank's in Adv
Saroj M.
 
Old 06-04-2014, 09:32 AM   #2
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,453
Blog Entries: 55

Rep: Reputation: Disabled
You're in the wrong forum for questions. However, here's one source of information:

http://kernelnewbies.org/KernelBuild
 
Old 06-04-2014, 09:57 PM   #3
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 811

Rep: Reputation: 264Reputation: 264Reputation: 264
The Arch wiki also has info on how to compile a kernel for any distro.

https://wiki.archlinux.org/index.php...on/Traditional
 
Old 06-04-2014, 09:59 PM   #4
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
Compiling is easy, configuring is time consuming (if you want to do a good job).
 
Old 06-04-2014, 10:31 PM   #5
l33y
Member
 
Registered: Jan 2014
Location: Gulf Coast, USA
Distribution: Xubuntu
Posts: 50
Blog Entries: 1

Rep: Reputation: Disabled
Thank you for the great references!
 
Old 06-06-2014, 10:05 AM   #6
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,517
Blog Entries: 1

Rep: Reputation: 494Reputation: 494Reputation: 494Reputation: 494Reputation: 494
Configuring isn't that time consuming if you "cp /boot/config .config" of the kernel supplied by your distro to the source tree. And then make oldconfig.

If you want to change a few things it's a hefty learning curve to know what to change and where it is located in the tree of options. And it's no small task these days since the expanded sources is 450MB-ish before compiling anything. It used to be 450MB AFTER a compile just a decade-ish ago.
 
Old 06-06-2014, 05:11 PM   #7
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
Copying over the generic .config kind of defeats the idea of custom kernel. And then you need to build initrd which is not needed if you build your own.
 
Old 06-06-2014, 05:16 PM   #8
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,116

Rep: Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530Reputation: 1530
I use kernel seeds as a starting point for custom kernel settings.

http://kernel-seeds.org/seeds/64_bit/
 
Old 06-06-2014, 05:29 PM   #9
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 6,324

Rep: Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730
Quote:
Originally Posted by Emerson View Post
Copying over the generic .config kind of defeats the idea of custom kernel. And then you need to build initrd which is not needed if you build your own.
Doesn't that rather depend upon why one is compiling the kernel? For example, I have compiled newer kernels than available on my system. Others may simply want one or two changes necessary for specific hardware or software processes.
Not all of us are obsessed with eeking out every bit of performance we can through fine-tuning our kernels to our hardware religiously you know.
 
1 members found this post helpful.
Old 06-06-2014, 05:41 PM   #10
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
You do it just once, make oldconfig will take care of upgrades. Kernel is the most important part of your GNU/Linux box, why not dedicate an hour of your time configuring it? I never regretted the time spent on kernel, you learn alot, too.
 
Old 06-06-2014, 05:56 PM   #11
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 6,324

Rep: Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730
I forgot to add, sorry I got sidetracked, that I found the following very useful for compiling the kernel on Debian based systems:
http://mapopa.blogspot.co.uk/2009/01/compiling-2.html
If you're just compiling to try the latest kernel or because there are just one or two things you need to change it's a quick, easy method which is very easy to undo should you run into problems.
 
Old 06-14-2014, 08:41 PM   #12
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 513
Blog Entries: 15

Rep: Reputation: 106Reputation: 106
Quote:
Originally Posted by 273 View Post
Not all of us are obsessed with eeking out every bit of performance we can through fine-tuning our kernels to our hardware religiously you know.
Distros build all available modules to cover every piece of hardware that is supported. Why would you want to build modules that have nothing to do with you? Why build v4l and v4l2 if you don't have a video input device? Why build IDE support if you have just SATA? Why build all available ALSA drivers? Configuration takes at most half an hour if you're thorough, and once you choose what you want, you can always make old_config it when you build a new one.
 
Old 06-14-2014, 08:49 PM   #13
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 6,324

Rep: Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730Reputation: 1730
Quote:
Originally Posted by DJ Shaji View Post
Distros build all available modules to cover every piece of hardware that is supported. Why would you want to build modules that have nothing to do with you? Why build v4l and v4l2 if you don't have a video input device? Why build IDE support if you have just SATA? Why build all available ALSA drivers? Configuration takes at most half an hour if you're thorough, and once you choose what you want, you can always make old_config it when you build a new one.
Please explain how not compiling modules I don't use would make my system behave better on a day-to-day basis.
Please let me know how my Windows 8 VM would be faster than its already fine pace or how many more frames per second I would see in Second Life because my kernel didn't take as long to compile.
Really, for a lot of people compiling a custom kernel is pointless. Please don't assume everybody is the same as you.
 
Old 06-15-2014, 10:17 AM   #14
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,517
Blog Entries: 1

Rep: Reputation: 494Reputation: 494Reputation: 494Reputation: 494Reputation: 494
Having a compiled module is not a limitation to performance, outside of wasted space on a storage device. Having a module that's not used loaded into RAM and managed by the OS means fewer resources for everything else. CPU cycles to check in on it, less RAM for other things. But the nice thing about linux is that MOST of the modules can be unloaded. And you can blacklist many of those so they don't automagically load at boot. So time spent making those modules an impossibility by excluding them isn't technically necessary. And the performance gains are not really earth shattering, +10% faster, isn't exactly twice or three times faster.

In the old days there were gains because you were compiling for your architecture instead of taking a literal i386 build in a 64 bit world. But these days the kernel is probably compiled for your actual chipset by default. So outside of low latency for audio, or special splash screen boot options, or something bleeding edge, the "need" to compile your own kernel is not something that most users of linux will encounter. It's still educational, and there may be some security concerns that make it desireable. But it's not really necessary for most use cases.
 
Old 06-15-2014, 04:09 PM   #15
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 513
Blog Entries: 15

Rep: Reputation: 106Reputation: 106
Quote:
Originally Posted by 273 View Post
Please explain how not compiling modules I don't use would make my system behave better on a day-to-day basis.
Please let me know how my Windows 8 VM would be faster than its already fine pace or how many more frames per second I would see in Second Life because my kernel didn't take as long to compile.
You are right. It won't. Here are some drivers that are not part of the official kernel tree. Compile 'em all. Knock yourself out.

Quote:
Really, for a lot of people compiling a custom kernel is pointless.
Yep. Just curious, though, do you by any chance have a rooted android phone? Do you use dd-wrt? Compiling your own kernel follows the same logic. Do it because you can. And let me tell you from experience, on my old system when I upgraded from 2.6.18 to 2.6.20 the performance boost was very impressive. Of course that is not that much of an issue nowadays, does running a lightweight kernel really hurt anything? You can optimize it for your CPU, use the realtime patch by Ingo Molnar, and do a lot of other stuff too. There are many reasons to compile your own, and it's certainly not as pointless as you may think. There's the LFS project too. If you think compiling the kernel is pointless, I don't even want to ask what you might think of that

Quote:
Please don't assume everybody is the same as you.
Yep. I shouldn't do that. Saying that my views are representative of others' is not really justified.

Quote:
Really, for a lot of people compiling a custom kernel is pointless.
 
  


Reply


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
How to compile linux kernel 3.8 averzo29 Linux - Newbie 5 03-12-2013 06:39 AM


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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration