LOL, I had a feeling that might be your next question. Now it's gets tricky, there are always patches...
Almost every day new patches are released, the vast majority are hardware fixes, so unless you're targeting
a specific thing ( wi-fi card, network card, bluetooth chip, logical volume manager, etc... )
It's hard to know what to patch.
There are literally hundreds, but I suspect for a VM with "generic" drivers you won't need most of them.
If you're going to put these on real hardware, you'll need to know what chipsets you have.
what cpu? what soundcard? what network card? what wi-fi chip? etc...
If you're doing this on multiple PC's, you need to know those chipsets too.
The good news is, the newer the kernel, the less patches you need.
Also all hardware modules/patches are not included in the kernel source, if you have a newer broadcom or realtech or mediaTek you may have to go out to the vendors site, download the code and patch it in yourself.
By now, you have probably realized the difference between external dynamically loaded modules, and internally compiled in modules. You have something called an initramfs ( different distro's call this different things )
This is starting to get into another subject, I will have AI try to summarize this part for me.
Purpose of Initramfs
Initramfs is a temporary root filesystem loaded into memory during the early stages of the Linux boot process. It contains the necessary drivers and tools to mount the real root filesystem. The kernel unpacks the initramfs archive into a RAM disk, mounts it, and uses it as the initial root filesystem. This allows the kernel to load essential modules and perform initial setup tasks before switching to the actual root filesystem
Purpose of Dracut
Dracut is a tool used to create initramfs images. It provides a modular framework for generating initramfs images by including only the necessary components required for the system to boot. Dracut is highly configurable and can be tailored to include specific drivers, tools, and configurations needed for different environments
Debian can use dracut, but more typically use...
update-initramfs: This command is used to generate or update initramfs images.
mkinitramfs: This script is called by update-initramfs to create the actual initramfs image.
Determining Which Kernel Modules Get Loaded
The process of determining which kernel modules get loaded involves several steps:
Module Inclusion: Dracut includes modules based on the system's configuration and the installed Dracut modules. These modules are located in the /usr/lib/dracut/modules.d directory and provide specific functionalities, such as support for different filesystems, hardware drivers, and network configurations
Configuration Files: Dracut reads configuration files located in /etc/dracut.conf and /etc/dracut.conf.d/. These files can specify which modules to include or exclude, additional files to add, and other customization options
Kernel Command Line: The kernel command line can also influence which modules are loaded. Parameters passed to the kernel at boot time can instruct Dracut to include specific modules or enable debugging options
Automatic Detection: Dracut can automatically detect the necessary modules based on the current hardware and system configuration. This is particularly useful for creating a generic initramfs that works across different systems
Yeah, it can really get complicated if you really want to specialize in custom kernels. But the point here is
your kernel only loads the modules it needs, the only disadvantage to having all the other modules around is
they use a little more space on your hard drive.
You can test this using lsmod. I personally rarely ( if ever ) see a module loaded for hardware I don't have ).
But I won't say it never happens.