I seem to be going around in circles here, to what is probably very straight forward.
This issue is probably not that common with Raspberry Pi's as I've noticed on Raspbian that most optional Linux kernel drivers are included by default.
So what I'm seeing is the following.
First we have the official repo for Linux and as you can see there is a stack of drivers available: https://github.com/torvalds/linux/tree/master/drivers
In fact what I am after is already here.
I'll start with a straightforward example, of what I am talking about.
So, let's take a CAN bus module such as the MCP2510. You can find this driver here: https://github.com/torvalds/linux/tree/master/drivers/net/can/spi/mcp251xfd
But this SPI module is not always included by default on your Single Board Computer.
So, the question I have is what is the simplest way to make a loadable linux kernel module (i.e. a .ko file) for this module.
I'm assuming there has to be well proven method of doing this. Please note that I wish to do so without having to recompile the whole kernel.
I know for starters I need to get the Linux kernel headers for my distro.
I've at least done that.
Any tips greatly appreciated.