Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Customizing & compiling a kernel?

Customizing & compiling a kernel?

Customizing & compiling a kernel?

I just installed Fedora 8 x86 on my Dell Dimension 2350 and it's running a little slow, so I wanted to configure & compile my own kernel to try to get rid of stuff I don't need and speed it up.

When I ran make menuconfig I spent a few hours going through all the hundreds of options...  Most of them I wasn't quite sure if I needed or if they would make any difference.

So I'm wondering if anyone can tell me which of those hundreds of options would help the most to speed up the system?  I'm sure choosing the specific processor that I'm using would make a big difference.  As for the others, I don't know if they'd make the kernel faster, or just smaller?

I don't care much about security since this is just test box for me to practice my Linux skills with, so any options that would sacrifice security for speed are fine with me.

RE: Customizing & compiling a kernel?

Uh, how are you measuring "slow"???

Are you running a GUI?

Are you seeing anything run slowly?

Are you low on memory?

The memory you save by recompiling stuff out of the kernel (and into modules) will save you some RAM, but I really would discourage you from diving into recompiling the kernel until you've been more diligent on removing other causes of "slowness"

D.E.R. Management - IT Project Management Consulting

RE: Customizing & compiling a kernel?

I have 768MB RAM on a 2.0GHz Celeron CPU.

I measure slowness compared to how Windows XP was running on the same machine.  ex. It takes almost 10 seconds just for Firefox to start up on Linux.  Other things take a while to run too.

I bought a new quad-core system with 2GB DDR3 RAM & RAID 0 & 5... that I'm running Vista on and it's lightning fast.
I'm not going to bother trying to upgrade any hardware on my old Dell since it's not my main machine; I'm just using it to play around with Linux.  So that's why I'm trying to speed up the kernel rather than the hardware.

I've compiled Linux kernels before, but I didn't do too much customization of the options.  Now I'd like to be a little more aggressive with the kernel options -- trim off all the fat and optimize the CPU options as much as possible.

You do bring up another question though.
How can I accurately measure the speed difference once I compile & install a new kernel?  Visual observations are only good for large speed differences, but not for millisecond differences.

Also, if I break something with all these kernel optimizations, it's no big deal, I can always go back to the old kernel or even reinstall if I really need to.

RE: Customizing & compiling a kernel?

"I bought a new quad-core system with 2GB DDR3 RAM & RAID 0 & 5... that I'm running Vista on and it's lightning fast.


D.E.R. Management - IT Project Management Consulting

RE: Customizing & compiling a kernel?

Linux might be faster than Vista on my new machine, but my point is simply that I've spent a lot of money already on my new computer, so I'm not going to spend any time or money upgrading my old Dell.

RE: Customizing & compiling a kernel?

OK, I compiled my kernel but when I ran make install it complained because I'm using Grub instead of Lilo.  So I manually edited my grub.conf.

When I tried loading the new kernel it complained that there was no .img file.  I didn't see one get created by make, so I just copied the one used by my old kernel.  I'm not sure if that was the right thing to do or if there's some other command to create a .img file?

After I did that, the kernel started loading, but spit out a bunch of errors saying it was loading the wrong version of the driver modules.  It looked like it was trying to load the old 2.6.25 modules instead of the new 2.6.26 ones that I just built.  Any ideas on what's causing the wrong modules to load?

RE: Customizing & compiling a kernel?

I assume you're talking about the initrd.img?  The initrd stands for initial RAM disk.  It's a basically a disk image that contains the files needed to get the system booted.  Generally, it's tied to the kernel, so if you rebuild the kernel, you need to use mkinitrd to rebuilt the initrd image.

That said, I would advise you not to waste your time trying to rebuild the kernel for "speed".  For starters, it's highly likely that you'll break your system in various ways.  Second, there's nothing magical about a custom kernel.  Unless you really know what you're doing, you're not likely to see any noticable improvement.  And even if you do see a difference, it's not going to be dramatic.  

Your time would be better spent lightening the load on your system - turn off unused services, switch to a ligher-weight desktop environment, avoid resource-hungry apps like Firefox, etc.  That will save you a lot more resources than a custom kernel.  As thedaver pointed out, rebuilding the kernel should be a last resort.

RE: Customizing & compiling a kernel?

There is no mkinitrd on my system.
Could it have a different name on some systems, or is there a package I need to install?

RE: Customizing & compiling a kernel?

Nevermind, I found & installed the mkinitrd package.

RE: Customizing & compiling a kernel?

OK, I created the initrd.img file but I get these errors when booting:


root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83
kernel /vmlinux ro root=/dev/VolGroup00/LogVol00 rhgb quiet
   [Linux-bzImage, setup=0x3000, size=0x16e430]
initrd /initrd-2.6.26.fc8.img
   [Linux-initrd @ 0x2fb51000, 0x38e7df bytes]

Decompressing Linux... Parsing ELF... done.
Booting the kernel.
Red Hat nash version 6.0.19 starting
  Reading all physical volumes.  This may take a while...
  No volume groups found
  Volume group "VolGroup00" not found
Unable to access resume device (/dev/VolGroup00/LogVol01)
mount: could not find filesystem '/dev/root'
setuproot: moving /dev failed.  No such file or directory
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
switchroot: mount failed: No such file or directory

RE: Customizing & compiling a kernel?

Google is your friend.  I've never seen that error before, but my first guess would be that you're missing a driver, e.g. for you hard drive.  Or maybe your Grub configuration is broken.  I don't know - just throwing out ideas.

Incidentally, this is exactly why I regard building your own kernel is more trouble than it's worth.

RE: Customizing & compiling a kernel?

I want to be as completely positive and polite as possible in delivering this message, please understand that I am trying to be supportive in your cause.

Both Adahacker and I have both suggested (strongly?) that you not fiddle with the stock/packaged kernel to enhance performance.  At best you are going to save ~20MB of RAM and the kernel performance will be negligible if noticed at all.

Rather, particularly as Adahacker has suggested, learn about and remove unnecessary services.  This will free RAM and will reduce the number of processes that consume the available CPU on your resource limited machine.

Please also be aware that you will need to reconfigure your yum (package manager) to exclude future kernels and kernel libs from the package source trees/repositories.  You will forever be committed to self-maintaining the kernel for mitigation of bugs, performance issues, and module management for any new services/hardware you might choose to enable.

I'm going to step out of this thread since I'm not offering you the guidance/support you seem driven to pursue.  I wish you luck.

D.E.R. Management - IT Project Management Consulting

RE: Customizing & compiling a kernel?


Quote (thedaver):

Please also be aware that you will need to reconfigure your yum (package manager) to exclude future kernels and kernel libs from the package source trees/repositories.
Oh yeah, I never thought of that.  Thanks, that would have been kind of annoying to have yum replace my customer kernel out from under me.

I understand that it might be better to just focus on optimizing the services that are running, but this is more of a learning experience for me than anything else.  So if I could rebuild the kernel and see with my own eyes how much of a difference it makes (if any) then it would be worth it.

Anyways, I got past the errors I posted above and I actually got my new kernel to boot all the way to the desktop, but unfortunately I have no mouse control and the boot sequence looks a bit odd (it doesn't show all those [OK] messages, just a black screen and then the desktop).

I'm sure the mouse problem is just some drivers that I excluded from the build, so I can probably get it working from here.

RE: Customizing & compiling a kernel?

The first thing You should do is some "troubleshooting"
before you start fixing things that might not be broken.
I second thedaver on the "Compiling a new kernel might not help you anything" part.
There are several ways to measure how fast things are,
and many sites that show how to "tune linux performance"
Google is your friend.
Take as an example how fast can your maschine access files
etc from your harddrive?


hdparm -tT
should show you that.


vmstat 1 30
will show you some info about what the CPU uses it time to,
how much RAM you use, how much swap etc.
It prints a line each second for 30 seconds.
Do something that you know runs slow within these 30 seconds,
and examine the report afterwords to se if you can spot anything.

As a sidenote, if you are after a speedy desktop, Fedora and Gnome
might not be the best alternative for your maschine.
You could consider a distro that comes with the XFCE desktop,
it's lighter on the hardware and generaly feals snappyer.
Not sure if you can add XFCE to your Fedora install,
but I think you can.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close