Premjith
Premjith

Reputation: 1198

Step to build a built in kernel module?

I can build a loadable module and it is working with the application successfully. Now I'm trying to include this driver in kernel driver folder as a built-in driver. But when i tried this, there is no device file created in /dev folder. What are the necessary steps to do this built-in module ? Is there any modification needed in the existing module ?

Thanks in advance

Upvotes: 4

Views: 8496

Answers (2)

Christophe Augier
Christophe Augier

Reputation: 575

I believe your question is similar to the question Compiling a driver as a part of a kernel, not as a module

The answer to that question mentioned modifying the kernel Makefiles to include your module object or directory.

In summary the steps are:

  1. Copy your driver source code directory under <linux kernel src>/drivers.
  2. Edit the Makefile to add the line:

    obj-y += your_driver_dir

  3. Edit the Makefile in your driver directory to add the line:

    obj-y := your_driver.o

Upvotes: 6

c4f4t0r
c4f4t0r

Reputation: 1641

If you would like to include your module into your kernel modules (not building), you need to copy yourmodule_file.ko under /lib/modules/$(uname -r)/ and give the command depmod -a, after this you can load your module with modprobe.

Upvotes: 0

Related Questions