Compiling Your Own Kernel to Decrease Boot Time
October 3rd, 2008After reading about Fedora and Ubuntu attempts to speed up the boot times I thought I’d see how my boot times compared, plus if there was anything I could easily do to improve mine.
First I installed Bootchart, it’s in the Fedora 9 repositories so it’s a simple install.
# yum install bootchart
That’s all the is to it, it even edits your grub.conf to append the init=/sbin/bootchartd to your currently running kernel (to stop Bootchart running each boot just remove this entry from your grub.conf).
After booting the Bootchart output is saved to /var/log/bootchart.svgz, but just running the command bootchart with no arguments will automatically parse the file and format the output into a svg file in your current directory.
Running a stock Fedora 9 kernel (2.6.26.5-45.fc9.i686) gave a boot time of 42 seconds, not that bad for a 5 year old laptop plus I’m running SELinux. This is probably because I have already turned off many services that I rarely or never use.
As a comparison I decided to download and compile a ‘vanilla’ 2.6.26.5 kernel from kernel.org. Running `make menuconfig` I was fairly ruthless with removing unneeded options and trying to compile most options into the kernel instead of into modules. For example my laptop has a pccard slot but I never use it so I removed support in the kernel.
Another optimization I tried was to remove all the debugging options under ‘Kernel Hacking’ and to remove the ‘Compile for size’ option under ‘General Setup’ so the compiler uses the -O2 flag instead of -Os, as the help says:
CONFIG_CC_OPTIMIZE_FOR_SIZE:
Enabling this option will pass "-Os" instead of "-O2" to gcc
resulting in a smaller kernel.
I didn’t change anything that affected the functionality of my laptop, it still works perfectly, plus I didn’t compile all options into the kernel (ipw2100 wireless to name one) or remove everything I could have.
The result of running Bootchart with the new kernel gave a boot time of 33 seconds. That’s a 9 second or 21% speedup! I must admit that it was more than I expected and it’s a good improvement for about 1 hours work. It would be even quicker the next time since most of the time was spent creating the .config file but I can just use that again next time.
October 7th, 2008 at 1:54 pm
[...] -> blog Better late than never Compiling Your Own Kernel to Decrease Boot Time [...]