Static Driver Loading Issue

To load the driver at boot time I added my driver name in /etc/modules.
Next I copied the driver to /lib/modules/2.6.34.12/kernel/drivers/char/.

But when I reboot the machine the drriver does not get loaded.
What am I missing and how to load the driver at boot time?

What OS, version, architecture?

1 Like

Ubuntu 10.04
Kernel Version 2.6.34.12

Im not sure I understand ->moved to more suitable forum...

What do you mean by "static driver"? Most kernel modules are not static; they are loadable. Static drivers are compiled into kernel.

1 Like

Murphy I meant the same.
I want my driver to load at boot time and for that we will have to compile it in kernel.
How to do this?

It may ask to change kernel parameters for compilation... what driver are you trying to install? I still wonder if you understand this time - If static, that means you will have to compile - not your driver - but a new kernel...
therefore it will no more be a module but more a kernel builtin. It will be built in the new kernel.

1 Like

Presently I am just trying to install a simple char driver or say a simple kernel module.

---------- Post updated 07-03-12 at 12:41 AM ---------- Previous update was 07-02-12 at 09:39 PM ----------

Thanks vbe for the inputs.
What if I want just to get the driver module loaded at boot time without building it in the kernel?
How to go about it?

You will have to build your driver so that is a loadable kernel module. To get you started, I suggest you read Linux Loadable Kernel Module HOWTO

There is some problem in static loading of driver which is leading to confusion.
To load the driver statically I followed two ways Process 1) and Process 2).
Earlier I had followed:
Process 1)
The steps are:
1) I built my char driver named demochardrv.ko.
2) I copied the driver in /lib/modules/2.6.34.12/kernel/drivers/char/.
3) I made an entry of it in /etc/modules.
4) Reboot.

But these 4 steps were not working earlier and I did not see my driver in lsmod.

So apart from the above steps I followed the other way:
Process 2)
The steps are as:
1) I added the driver details in file "/lib/modules/2.6.34.12/build/drivers/char/Kconfig":
config DEMOCHARDRV
tristate "TEST DEMO DRIVER'
default n
help
TEST STATIC INSTALL DRIVER

2) I added the driver details in "/lib/modules/2.6.34.12/build/drivers/char/Makefile":
obj-$(CONFIG_DEMOCHARDRV) += demochardrv.o

3) Copied the driver files in /lib/modules/2.6.34.12/build/drivers/char/.
4) Edited the .config file and added CONFIG_DEMOCHARDRV=y.
5) Fired make menuconfig and selected(with either * / M) my driver.
6) Did make, make modules, make modules_install and make install.
7) Reboot

Now the driver was loading at boot time even if I was not selecting it in menuconfig.

To resolve the issue in Process 2 I removed the entry made in /etc/modules. But now the driver was not loading at all.
So I removed the Process 2 steps and again followed Process 1 steps and driver is loading at boot time now.
Now Process 1 is working.
But Process 2 is not working alone and it need additional steps of Process 1.

So I am confused as to which process are correct.
Can anybody pls provide some inputs?