To get a list of all built-in kernel modules, run the following command.
cat /lib/modules/$(uname -r)/modules.builtin
To get a list of all built-in kernel modules containing the string
spi, run the following command.
cat /lib/modules/$(uname -r)/modules.builtin | grep spi
You should expect to see some positive results from the second command showing that built-in spi kernel module(s) are installed on your system. Searching for files that end in
spi.ko in Ubuntu 18.04 gives the following results, many of which are drivers, for example ethernet and touchscreen.
There are also many spi.ko files in
/lib/modules/. You can use
dpkg -S <path> to find out what package installed the selected spi.ko file. For example:
dpkg -S '/lib/modules/4.15.0-45-generic/kernel/drivers/iio/common/st_sensors/st_sensors_spi.ko'
I don't type the path, instead I drag the file's icon from the file manager into the terminal and the path prints after the cursor position automatically. Results:
To download the source code of a package that contains a driver run the following command:
apt --download-only source <package_name>