kernel customization

Ali Bahar ali at
Sun Jun 12 04:38:16 EDT 2011

On Sun, Jun 12, 2011 at 10:59:56AM +0530, Venkateswarlu P wrote:
> For kernel customization  ,  i.e  for
> make menuconfig
> what is the easy way to know only required  device drivers

I wish there were one! :-)

The laziest approach may be to build everything -- eg with a 
"make allmodconfig" -- and then boot into the new kernel. Then lsmod
will show you which drivers are actually in-use.
The down side of this is the long compilation time, the disk usage,
and the slower boot for this kernel. Also, the output of lsmod is not
as obvious as you may expect: it may not be easy to dereference the
loaded-modules' names to their CONFIG options.

Other than that, you'd need to know which devices you have in your
system, and how those translate into kernel CONFIG options.

... Come to think of it, the frequent case is a plain desktop, and
that is easier: if you have not added new devices to your
box, then just run lsmod within your running kernel (ie whatever your
distro has provided), and see which devices it shows.

Of course, lsmod doesn't show whatever has been _statically_ built 
into the kernel. You can run
  grep =y /boot/config*`uname -r`
to find the statics, but this won't be much different from running
"make menuconfig".

In summary,

1. If you don't have any new devices in your system, and you have a
running kernel provided by your distro:

 a. run 'lsmod' to see which modules are in use. 
 b. run "make oldconfig".
 c. start pruning out all the things you don't want. This will take
    time, depending on how lean you want it.

2. If you have new devices,
   do as in (1), but add the new device.


More information about the Kernelnewbies mailing list