Pages

Tuesday, September 21, 2010

Boot time tuning chapter third: fastest boot ever 9s

Hey there. Amazing. I just got an incredible result. Boot time under 10s. I found a way to real optimization and full use of my box power. You can see my latest bootchart graph here. The steps are really painless but beware the result might be a not booting machine.

Please notice that the machine is not a micro-kernel eeePC or netbook or embedded device. It's a Core2Duo, 4GB Ram, OCZ Vertex serie SSD Laptop, MSI PR201, hand assembled and customized, but still a common PC.

The first ingredient of our soup will be OpenRC, seen few posts ago.

The rest is some luck (as it never hurts) and some risk-taking hand-made modifies.

Getting into the how-to I warn you once again you might mess things up. Follow step by step and reboot each time to ensure you've not messed up your system. ^_^

First step is trying to compile a custom kernel with just the stuff your hardware needs and all modules already compiled in. The smaller the kernel is and the less the modules you have to probe the faster will be your boot. Once you've done reboot in your new kernel and go on.

What's next is moving to wicd (network manager), a very common choice among xfce users.

So issue:
emerge -av wicd
then check it is in your default runlevel:
sudo rc-update add wicd default
now move to rc.conf
sudo nano /etc/rc.conf
and disable all network hotplug changing your line to
rc_hotplug="!net.*"

Reboot?

With these settings your system will use wicd to handle networks. This application and daemon is easier to use and to customize than other network managers, and of course it does background net init making boot straight-through.

Next step and more interesting one is to avoid XDM or GDM or whatever. If you need speed you can boot and login without graphical beauty stuff. So I suggest to never install XDM or GDM, if you have already one you can uninstall it. Just get mingetty
emerge -av mingetty
and edit /etc/inittab as follows:
c1:12345:respawn:/sbin/mingetty --autologin [your-default-user] tty1
now your system boots straight to a user. To make graphic environment start properly
nano ~/.bashrc
and add the following lines after "# Put your fun stuff here.":
if [ `tty` = "/dev/tty1" ]; then
    ck-launch-session [your_manager_start]
    exit
    clear
fi
[your manager start] is startxcfe4 for Xfce, maybe startx is enough for the other.

Reboot?

[EDIT] PLEASE LOOK AT THIS UPDATE! Boot Time Tuning Chapter 5 [EDIT]

Now the most risk-taking.
sudo nano /etc/inittab
add "&" and change bootwait and wait as in the following lines:
si::sysinit:/sbin/rc sysinit &
rc::once:/sbin/rc boot
l2:2:once:/sbin/rc nonetwork
l3:3:once:/sbin/rc default
l4:4:once:/sbin/rc default
l5:5:once:/sbin/rc default
what we have just done is to init the whole system in one shot, trusting OpenRC to handle boot dependencies in the right way. Infact "&" and "once" make the next level started while the previous is still running. Not surprisingly I have an output saying I'm starting X from read only drive.

Cross your fingers, hold your lucky charm and reboot once again.

I've just cut off other 4s in my boot time, reaching 9s ^_^.


Amazing. I wait for feedbacks of your improves or troubles.

No comments:

Post a Comment