This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Building Support for a Device in to the Kernel

Hi,

I'm new to Linux development but have been enjoying the process. I have learned how to build a basic device driver as a *.ko and load it using insmod. What is the recommended technique if I always want it available? Do you link it into the kernel or do you set up some configuration files to load the driver automatically?

Thanks,

Ken

  • you can do either. 

    If you want to build the driver statically into the kernel, you will likely need to write or modify a Konfig file and a makefile.  the makefile normally defines which c source files are associated with a particular driver.  The Kconfig file normally defines a name for the driver as well as any dependancies it may have on other drivers (e.g. i2c, edma, ...).  Finally, a .config file found in the root directory defines all software modules (by name) which are associated with a particular kernel, so you will also need to ensure your driver is listed here.  When menuconfig tool is invoked, it allows you to select which drivers will be built statically, dynamically or excluded all together from the kernel build; you choices are saved in the .config file which uses Kconfig files to resolved dependancies and makefiles to know how to build the individual drivers.  Anyway, this is just an overview; I am not an expert on these matters, but this is general Linux stuff and I am sure you can find other resources online.

    for the script method, there are a variety of start-up scripts under /etc/init.d that can be used to load the driver dynamically (.ko).  Again, general Linux stuff.

  • Thanks Juan. This is a nice overview and enough to get me going.