2

I'm trying to compile a Linux kernel to debug an issue I have on Arch Linux, and I was configuring modules, but I didn't know what a lot of the stuff was so I left them on.

If this kernel works I plan to keep it, but would all those extra modules slow the system down or will it load up only when they are needed?

3 Answers 3

6

While you won't notice any performance improvement (assuming you build your kernel with the modules you actaully require), there is some benefit in removing unneeded modules: first, it can significantly reduce the compile time and secondly, it will reduce the size of the final kernel.

Creating a .config with make localmodconfig is a good way to get your feet wet. See the Arch Wiki for the traditional compilation approach.

3
  • As long as they are modules and not built-in, it won't increase the size of the resulting image, but the overall size would be larger.
    – jordanm
    Aug 21, 2014 at 3:09
  • 3
    Note that in general it tends to be safer to have a module you don't need than it is to decide to "streamline" your kernel build only to find out after a reboot that you forgot a driver that it turns out you did need... Aug 21, 2014 at 5:14
  • The kernel can be loaded to ram faster by the boot loader, but the time that it spend loading modules will produce a slower startup.
    – rfmoz
    Aug 26, 2019 at 12:07
2

The modules are loaded as needed: don't worry, as there's no slowdown.

0

While trying to install 4.16-rc4+, I discovered a pitfall of selecting too many modules while configuring the kernel.

The resulting initramfs image, which seems to include all modules by default, is 358MB in size, which is way too big to fit in my /boot partition.

I am now on a quest to discover what magic is needed to tell update-initramfs to ignore particular modules or trees in /lib/modules/kernel-version.

3
  • 3
    Set MODULES=dep in /etc/initramfs-tools/initramfs.conf to reduce the number modules in your initramfs. Mar 6, 2018 at 6:44
  • @Declan please don’t be so enthusiastic with your back-ticks — you got the “s” wrong in update-initramfs there, and versions and file-sizes aren’t easier to read when formatted as code IMO. Mar 6, 2018 at 9:42
  • @Stephen Kitt Thank you! I had figured out that MODULES=dep was relevant, but not where to set it.
    – JKna
    Mar 7, 2018 at 13:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .