configuring linux kernel with (hard-loaded, built in) currently loaded modules

I want to build from source a recent Linux kernel (e.g. 4.13.4 in end of september 2017) on my Debian/Sid/x86-64 with all (or most) currently loaded modules configured as hard-built in the new kernel.

(I believe that I have read something like this somewhere, but can't remember where and can't find it)

It would be some make configfromloadedmodules (but of course it is not exactly configfromloadedmodules makefile target, but some other target that I did not easily find).

That is, for most (ideally all) currently loaded modules (as given by lsmod) it would answer Y (not m) for each of them at make config time and give me some good enough .config; but I don't want a bloated kernel with all drivers -even those that I don't use and which are not currently loaded- built in.

Does that exist, or was what I have probably read some wish or some non standard feature of experimental kernels?

This would avoid any initrd thing and give me a kernel suited for my hardware and habits.

The current kernel is a standard Debian one 4.12.0-2-amd64, so I have its /boot/config-4.12.0-2-amd64 (so I want to automatize the replacement of CONFIGxxx=m with CONFIGxxx=y there, according to the currently loaded modules, e.g. as given by lsmod).

See also this answer; I still believe that device trees are not essential to Linux, but they are a useful convenience.

A near variant of my question is how to easily configure a kernel, suited to my computer and hardware and set-up, without ìnitrd, without any modules (e.g. with CONFIG_MODULES=n) and without (or with very few) useless drivers, which would work as nicely as my current Debian kernel.

Upvotes: 3

Views: 565

Answers (1)

Manoj
Manoj

Reputation: 863

I believe, you should read about "make localmodconfig" and "make localyesconfig" and use one as per your requirement.

This, This and This are helpful links.

Upvotes: 4

Related Questions