The make localmodconfig
command is still the right tool for the job. In fact make localmodconfig
runs scripts/kconfig/streamline_config.pl
.
File input
When reading the streamline_config.pl
(perl) source code, there is an undocumented feature my $lsmod_file = $ENV{'LSMOD'};
that allows file input for loaded module detection instead of the output from the lsmod
command.
Live CD
Because localmodconfig uses the output lsmod
to detect the loaded modules. We run a Ubuntu Live CD on each of the different hardware setups, open a terminal (Ctrl+Alt+T), run lsmod
and save its output.
Concatenate output
By concatenating the lsmod
output files while stripping consecutive headers lines you can quickly create an input file that covers all your required kernel modules. We like to review the module list by hand and use a more manual recipe:
$ cd linux-3.11.0/
or go the directory where you will run your make command
$ lsmod > lsmod.txt
creates a text file with your loaded modules
$ nano lsmod.txt
will open the nano text editor, of course you can use your favorite editor application
Append your desired modules that are not already there, to the bottom of this file (see for an example the bottom of this anwer), and save it when you are ready.
Note: use spaces not tabs to match the column tabulator positions.
$ make LSMOD="lsmod.txt" localmodconfig
this will tell localmodconfig to use your lsmod.txt file as input for loaded modules detection
With regards to Steven Rostedt - the author of steamline_config.pl - for suggesting a shorter notation in step 5.
Example for what to append and not append to lsmod.txt (step 4):
Because the Intel D33217CK main board has Intel thermal sensors that we would like to read, we append these lines:
x86_pkg_temp_thermal 13810 0
intel_powerclamp 14239 0
But we don't want to run virtual machines on this hardware, that is why we skip these lines:
kvm_intel 128218 0
kvm 364766 1 kvm_intel
It has an Apple (Broadcom) Gibabit ethernet adapter connected to its Thunderbolt port, so we append:
tg3 152066 0
ptp 18156 1 tg3
pps_core 18546 1 ptp
We think we don't need volume mirroring, and therefor do not add:
dm_mirror 21715 0
dm_region_hash 15984 1 dm_mirror
dm_log 18072 2 dm_region_hash,dm_mirror
And we also don't need graphics output (text will do on a headless server), so we do not include:
i915 589697 3
i2c_algo_bit 13197 1 i915
drm_kms_helper 46867 1 i915
drm 242354 4 i915,drm_kms_helper
For another machine we need this Realtek ethernet driver aditionally:
r8169 61434 0
mii 13654 1 r8169