I have enabled a number of config options on a machine in order to take advantage of the newly-included wireguard
module in Linux 5.6.0-rc1.
This was somewhat laborious: I had a minimal working config and guided by the errors I received while trying to put up the wireguard
network interface I had to enable, one by one, kernel config options I was not familiar with, until wireguard
worked (options like, say, CONFIG_IP_NF_MANGLE
).
I now want to automate the replication of this process on another machine as much as possible. That other laptop, in turn, has a relatively small custom-configured kernel; it is an entirely different machine, so make localmodconfig
on the current machine is not really an option, because I would then somehow have to merge the two configs anyway.
What I would like to achieve
I would like to have a process that takes a module name as input, as listed by lsmod
(e.g. iptable_mangle
) and gives me back the kernel option(s) relevant to enabling it (presumably CONFIG_IP_NF_MANGLE=m
in this case?).
I have tried
grepping for the kernel module
iptable_mangle
in the Linux source (github
clone) in the hope of maybe finding something that links it to the corresponding kernel option;running
modinfo <target module name>
on the current machine, hoping that the displayed info would mention the kernel config option.
Neither of these works: the output doesn't mention CONFIG_IP_NF_MANGLE
in either case.
find /usr/src/linux/ -name "Makefile" -exec grep "CONFIG_<whichever config set as a module>" {} \;
which got all the modules I needed for Docker except for CONFIG_IP_NF_TARGET_MASQUERADE. Going the other way, I think it would just befind /usr/src/linux -name "Makefile" -exec grep " += <module file name>" {} \;
– B.Kaatz Sep 02 '21 at 02:10