I have to compile the Linux kernel quite frequently for a device with a limited use-case. Naturally, I don't need most of the modules of the Linux kernel. Is there a good way to determine which modules I can disable to improve the compile speed as much as possible. I've already disabled a bunch of modules which I know I don't need. But I'd like to know which specific modules would give me the most gain in compilation speed.

1 Answer 1


You can build a .config appropriate for your system (more precisely, enabling only modules which are currently loaded) by running

make localmodconfig

if you want modules or

make localyesconfig

if you want a static build.

This will avoid building any modules which your system doesn’t need, thus achieving your goal: “to improve the compile speed as much as possible”.

  • I already have a custom config. This question is more about how to figure out which modules would help me most by disabling them. Sorry if that wasn't clear from the original question.
    – Philippe
    Commented Jan 5, 2023 at 15:35
  • That’s what I’d gathered from your question; the purpose of my answer was to explain how to get a configuration specific to your question, thus eliminating as many modules as possible, “to improve the compile speed as much as possible” as specified in your question. Commented Jan 5, 2023 at 15:37
  • Ah, thanks. I misunderstood. I didn't know that was a possibility. Thank you
    – Philippe
    Commented Jan 5, 2023 at 15:40
  • Apologies, that should be “specific to your system”, not “specific to your question”. Commented Jan 5, 2023 at 15:46
  • What if I don't have a preference regarding mod/static and I just want what is recommended?
    – Philippe
    Commented Jan 5, 2023 at 17:41

You must log in to answer this question.

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