TL;DR: How do I build a custom Linux kernel from the Fedora dist-git that only includes modules from a specified list?
I’m running Fedora 41 (Workstation) on my laptop and have built a kernel (version 6.12.13, if it matters) with a few configuration changes following the instructions here. I would now like to also change the configuration to only build kernel modules that are in a list I provide (which would come from modprobed-db, a tool that logs which modules have ever been loaded on my system, thus giving a list of only the modules I actually need), but I’m having trouble figuring out how to do this.
In particular, I’ve checked out the Fedora Linux kernel repository from https://src.fedoraproject.org/rpms/kernel.git
, switched to the f41
branch, and applied the custom configuration settings in the kernel-local
file; I then build the kernel using the following command:
fedpkg local --arch x86_64 --without configchecks --with baseonly
This works but involves building a huge number of kernel modules, the vast majority of which I’ll probably never need, and this makes the build pretty slow (typically over an hour). If this was a vanilla kernel, I think I could use make localmodconfig
to disable all module options that aren’t in the list; however, with the above method using fedpkg
, I don’t seem to have direct access to the makefile (I think it’s generated at an intermediate step?) and so I’m not sure how to customize the configuration in this way. Any help would be much appreciated.