# Where are all these ko files coming from?



## mauricev (Feb 2, 2021)

I built a custom kernel stripping every device entry I didn't find relevant in a copy of the GENERIC conf file. From uname -a, it seems my custom kernel loaded, but in the /boot/kernel directory there are still a gazillion ko files. I thought there was a one to one relationship between these and the device entries, but this is not the case. Further, there are entries here like zfs.ko that weren't even in the original GENERIC conf file to begin with, so where are these ko entries coming from and how do I tell it not build the ones I won't be using?


----------



## SirDice (Feb 2, 2021)

Your kernel config only tells the system which modules to statically include in the kernel. Everything is _always_ built as a module.



mauricev said:


> how do I tell it not build the ones I won't be using?


Read src.conf(5) and build(7).


----------



## mauricev (Feb 3, 2021)

It's not clear how to make a list of every module I want. Some are listed in GENERIC; some are listed in the NOTES file, but many like radeonkmsfw_VERDE_rlc don't seem to be formally listed anywhere, so I'd have to derive the names from what's listed in /boot/kernel and then try to figure out when to use underlines to spell the driver name correctly. Also, it's not clear how to assign a variable like WITHOUT_MODULES with multiple lines of info: quotes, backslashes?


----------



## mark_j (Feb 3, 2021)

mauricev said:


> I built a custom kernel stripping every device entry I didn't find relevant in a copy of the GENERIC conf file. From uname -a, it seems my custom kernel loaded, but in the /boot/kernel directory there are still a gazillion ko files. I thought there was a one to one relationship between these and the device entries, but this is not the case. Further, there are entries here like zfs.ko that weren't even in the original GENERIC conf file to begin with, so where are these ko entries coming from and how do I tell it not build the ones I won't be using?


zfs.ko is there because of potential boot loading. As SirDice says, configure these out of the build using src.conf


----------



## mauricev (Feb 9, 2021)

As far as I can tell, the kernel is hard-coded to build a with a whole slew of modules and there's no way to turn them off. Some examples include


```
ata_serverworks
ata_promise
ata_nvidia
ata_netcell
ata_national
ata_micron
ata_marvell
ata_jmicron
ata_ite
ata_intel
```


----------



## mark_j (Feb 9, 2021)

Yes, well unless you have no ATA/SATA, I guess you won't need these...


----------

