Booting even faster with mkinitcpio

First things first: I’m not going to go into huge detail over mkinitcpio, because the Arch Wiki, the 0.8 installer and the /etc/mkinitcpio.conf file have plenty of information to get you started.

I think the key is to keep things as lean as possible. You have the option of turning off the udev event inside mkinitcpio.conf (by omitting it from the hooks line, that is) and building the initramfs module by module, and for this machine that makes a big, big difference timewise.

For example, here are the pertinent lines from my mkinitcpio.conf file, less the extensive commenting:

MODULES="piix ata_piix ide_disk"
HOOKS="base ide filesystems"

As you can see, it’s very slim. I don’t even use autodetect. Of course, I don’t have much in the way of fancy hardware, so I can afford to keep it slim.

I’ve tried variations on what you see there, and inevitably it left me with a broken system. Luckily you can reboot with the fallback boot option and fix what you damaged. I think that’s what I like best about mkinitcpio: It’s easy to recover from … so long as you have time enough to keep your patience. ๐Ÿ˜‰

I let the hwdetect sequence pick modules at first, and then pruned it down further. I use ext2 and ext3 as filesystems, so I didn’t need anything else to get going. There’s a complete list of hooks on the wiki page.

Remember that this isn’t like the MODULES line in /etc/rc.conf. As I understand it, this is all about getting the core hardware going, then passing control to your complete system setup. So you don’t want sound or video or network modules here, you want them in /etc/rc.conf.

Building takes a little time on this laptop; no doubt you’ll have better luck if your computer was made after 1998. ๐Ÿ™„

Personally, I really love this. Combining this with manually inserted modules in the kernel have easily cut as much as 30 seconds off my boot time for this machine. That puts it well within reach of my main laptop, a 1Ghz Pentium III running Openbox on Ubuntu Edgy.

So to have a six-second difference in boot times between this and a machine that runs more than three times as fast … is giddying.


3 thoughts on “Booting even faster with mkinitcpio

  1. The same guy

    My mkinitcpio.conf:

    # /bin/bash
    # /etc/mkinitcpio.conf

    MODULES=”ahci sd-mod ext4″

  2. fjew

    It’s also unnecessary to have ide hook and piix, ata_piix annd ide_disk modules. They will cover each other nevertheless.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s