1

I'd like to compile my own version of the Linux kernel and as minimal as possible, running Ubuntu 16.10. I thought of the following way but it didn't work.

First I will build a fully modular linux kernel, by installing it with a .config file generated by make allmodconfig. Then I'd boot into that kernel and create a new .config file by running make localyesconfig, to create a kernel with all modules that are active built-in (yes, with all my USB-components etc. attached).

However, the fully modular kernel didn't boot. I read some stuff on the internet and I think it is because some modules can't actually be modular such as the module for ext4.

So my question is: how can I determine which modules I should build into my kernel in order to have such a 'fully' modular kernel boot properly?

Cheers,
GeneralDuke

1

Instead of running make allmodconfig, you could just make sure you've loaded all the modules you need (i.e. plug in everything you might attach to your computer, manually load any modules you know you will need, etc.). Then run make localyesconfig.

Just remember, you will then have to rebuild your kernel if you add any new hardware of software that requires a new module.

  • I believe lsmod (where localmodconfig gets its information from) only lists the modules that are currently loaded. However, the Ubuntu linux kernel comes with a lot of modules already built-in, such as support for various filesystems, architectures etc. If I'd run make localmodconfig, wouldn't I get all these built-in modules as well, even though my system doesn't use them? – GeneralDuke Feb 10 '17 at 17:18
  • Good point, but you can remove what you don't need with rmmod. Yes, it's tedious. The Arch Linux User Repository (AUR) has a program that periodically checks which modules you have loaded, or you can run it manually every time you plug something in that loads a new module. Then you can call it before compiling to load all modules you've used for however long you've been doing this. It's called `modprobed-db'. I don't know if Ubuntu or some PPA has this, or you could look at the arch version and port it over. It takes out some of the tedium anyway. – airhuff Feb 10 '17 at 17:25
  • But how can I determine which modules to remove using rmmod? Again, lsmod doesn't list the built-in modules that are not necessary for the system to run, right? Same for this modprobed-db you mention, which sounds nice btw, doesn't that also only list loaded modules? – GeneralDuke Feb 11 '17 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.