LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-24-2009, 04:03 AM   #1
kinkle
LQ Newbie
 
Registered: Mar 2009
Location: MN
Distribution: Debian squeeze
Posts: 13

Rep: Reputation: 3
Compiling a fast linux kernel


My stock kernel is about 85MB and using "make menuconfig" I managed to deselect a bunch of options and I got it down to 34MB. But there is still a large number of options that I have no clue if they are really needed or not. menuconfig explains a little about each option but not really enough to really make a good decision for us non-tech people.

I am running a home Desktop computer with nothing special: GNOME, speakers, printer, etc. so I do not need all the techy extra stuff included in the kernel.

I was googleing but did not find any tutorial on how to achieve a fast/efficient kernel. Any good tuts around? Thanks.

Last edited by kinkle; 09-24-2009 at 04:12 AM.
 
Old 09-24-2009, 08:10 AM   #2
~sHyLoCk~
Senior Member
 
Registered: Jul 2008
Location: /dev/null
Posts: 1,173
Blog Entries: 12

Rep: Reputation: 129Reputation: 129
Try the make xconfig or make gconfig [whichever is there] and you can find description about each option. Also use the lzma compression for smaller file size.
 
Old 09-24-2009, 08:48 AM   #3
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
The best thing to do is leave most drivers as modules and only compile into the kernel anything that is absolutely necessary for accessing the HDD and filesystem ... your HDD controller driver and your filesystem driver should be built-in, the rest leave as modules.

See chapters 7 and 8 of this for more info:
http://www.kroah.com/lkn/
 
Old 09-24-2009, 10:36 AM   #4
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,299
Blog Entries: 61

Rep: Reputation: Disabled
Are you sure about those figures? 85 and 34 MB? Slackware's kernels are 4.8 MiB for the huge, and 2.5 MiB for the generic. I doubt if Debian's stock kernel is that much bigger.
 
Old 09-24-2009, 10:52 AM   #5
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Yeah, I don't see how any kernel can be that huge, mine is about 2 MB or so.
 
Old 09-24-2009, 10:54 AM   #6
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,299
Blog Entries: 61

Rep: Reputation: Disabled
Probably missed the decimal point out. Although 8.5 MB is still big.

Last edited by brianL; 09-24-2009 at 10:55 AM.
 
Old 09-24-2009, 12:50 PM   #7
kinkle
LQ Newbie
 
Registered: Mar 2009
Location: MN
Distribution: Debian squeeze
Posts: 13

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by brianL View Post
Are you sure about those figures? 85 and 34 MB? Slackware's kernels are 4.8 MiB for the huge, and 2.5 MiB for the generic. I doubt if Debian's stock kernel is that much bigger.
Yes, it is. Check => Linux-image-2.6.30, installed size is about 85MB. Ubuntu's has a similar size but Ubuntu server edition is over 100MB.
 
Old 09-24-2009, 12:52 PM   #8
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Surprisingly enough, a smaller kernel doesn't mean it will be faster.
 
Old 09-24-2009, 01:13 PM   #9
manwithaplan
Member
 
Registered: Nov 2008
Location: ~/
Distribution: Arch || Sidux
Posts: 393

Rep: Reputation: 45
Wow ..! those stock kernels are huge. I have 3.5 mb kernel, and I think that I can still do some more trimming. I use several different variants. I use the git sources, gentoo-sources, and now testing the zen-sources. I have to say with the timer enhancements, and the BFS patch, I have to say Zen-sources is fast. I boot very quickly.

As a suggestion I would encourage you check out this guy's site, he frequents the Gentoo forums, Pappy's Kernel seeds. I learned alot from his custom .config files. Its a trial and error process. At first I had to compile several times to get it right. I kept my stock kernel until I could stabilize my new kernel.
 
Old 09-24-2009, 01:22 PM   #10
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,299
Blog Entries: 61

Rep: Reputation: Disabled
Quote:
Originally Posted by kinkle View Post
Yes, it is. Check => Linux-image-2.6.30, installed size is about 85MB. Ubuntu's has a similar size but Ubuntu server edition is over 100MB.
That's the size of the whole package, not just the kernel.

http://packages.debian.org/squeeze/a...amd64/filelist
 
Old 09-24-2009, 01:32 PM   #11
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by kinkle View Post
Yes, it is. Check => Linux-image-2.6.30, installed size is about 85MB. Ubuntu's has a similar size but Ubuntu server edition is over 100MB.
That package includes every existing driver under the sun, not just the kernel image. When most people talk about the size of the kernel, they are talking about the size of the compressed linux kernel image (usually vmlinuz), not taking into account any external driver.

You can see the size of the kernel image using ls -l on /boot

About stripping down the kernel, it will be hit and miss, new options get added with every new minor release, other change, other go away, the linux kernel is a very dynamic beast. There are a few things that are really critical, like the hd controller and fs drivers, which needs to be accessible before anything else can be reached. There are lots of drivers in the kernel, if you want to really strip it down that much you are going to need lots of patience, I'd start with sensors, network and sound, there are quite a few there and you only need one a few.

But, as someone said, unless you are really constrained in space, it's not much of a deal. Your system will perform the same.
 
Old 09-25-2009, 12:42 AM   #12
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by H_TeXMeX_H View Post
The best thing to do is leave most drivers as modules and only compile into the kernel anything that is absolutely necessary for accessing the HDD and filesystem ... your HDD controller driver and your filesystem driver should be built-in, the rest leave as modules.

See chapters 7 and 8 of this for more info:
http://www.kroah.com/lkn/
Those also can be compiled as modules and loaded from initrd.
I think, the whole (or at least most important) point of initrd is to allow root filesystem driver and HDD driver be modules
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Opinion: Linux-kernel virtualization finally on the fast track LXer Syndicated Linux News 0 03-08-2007 07:31 PM
How P IV system work fast with Red Hat Linux 8, I recompile the kernel also. benoy4007 Red Hat 2 06-12-2004 03:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:01 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
Open Source Consulting | Domain Registration