Find out where you want to place the device driver source code. In my case I had to integrate a device driver for a device called ring oscillator. The category of the device was not clear to me and I couldn’t find a suitable place under “linux/drivers” folder except “linux/drivers/misc”. So I decided to place my driver source code under linux/drivers/misc. You may decide to place it where you think  it is appropriate. It is up to to decide.

So you should have a new file here:

Next is to decide whether you want to statically link the driver with the kernel. In my case it seems most appropriate to statically link the driver with the kernel binary. To do that you have to change few makefiles and the Kconfig file.

Add the following line in the drivers/misc/Makefile:

obj-$(CONFIG_MY_RING_OSC) += my-ring-osc.o

Add the following line in the arch/mips/configs/your_defconfig:


In my case the architecture was mips, please go to the appropriate architecture folder as may be applicable to you.

Add the following entry in the drivers/misc/Kconfig:

config MY_RING_OSC
tristate "Example Ring Oscillator driver"
depends on XYZ || ABC
You can write any text here which you think will help to describe the driver better.

Leave a Reply