Booting faster without kernel modules
Booting faster without kernel modules

I use genkernel (docs wiki) to automate the process of compiling the Linux kernel and building and installing a initramfs to be loaded as a ramdisk. It works fine.

There was just one pet peeve with it: when booting the ramdisk it would always look for all the modules of hardware storage and file systems and try to load them. This is a safe procedure as it make sure that the computer will boot with everything working.

So while looking at the options available at the configuration file /etc/genkernel.conf I came across one that looked promising:

# Don't copy any modules to the ramdisk
RAMDISKMODULES="0"

Whenever I configure a new kernel I always tailor it for the target host and include all the needed hardware support that it needs to successfully boot in the kernel instead of as a module. This means that the kernel image might be a bit bigger than if everything was a module, but it's faster to boot.

I gave it a shot and created a new initramfs without any modules and...

... it works great. The boot is a faster and afterwards the kernel space is not "polluted" with modules that are not in use at the moment (such as jfs, xfs and RAID modules).