Sapan
Sapan

Reputation: 1613

Linux Device Driver not loaded automatically using udev

I am looking for a way to load my linux device driver automatically on start-up. For that I created a udev rules file:

KERNEL=="k1", SUBSYSTEM=="subx", SYMLINK+="sym_subx", ATTRS{vendor}=="0x14ab", ATTRS{device}=="0xe001", MODE="0660", GROUP="xyz"

I manually installed the driver first and then restarted the udev. After this, for the first time, I uninstalled and then installed the driver. I could see the driver getting installed correctly and also the symlink being created.

Now when I restart the machine, I am expecting that the driver is loaded automatically on start-up but its not the case. What could be missing here? Is there any entry that I need to do in some .conf file (modprobe.conf or any other)? Where should I put my module.ko file?

I am suspecting that something minor is missing. Any help will be highly appreciated.

Regards, Sapan

Upvotes: 2

Views: 4961

Answers (1)

Sapan
Sapan

Reputation: 1613

I was finally able to do it myself. Steps to load the driver automatically are:

  1. Put module.ko in /lib/modules/$(uname -r)/kernel/drivers/ - You may need to create the "module" directory for the first time
  2. Write Udev Rules
  3. % sudo depmod -a This will update the dependencies of the drivers
  4. Check /lib/modules/$(uname -r)/modules.dep file and search for modules.ko . It should list the dependencies on other modules if any
  5. % sudo /sbin/reboot OR sudo udevadm trigger

It worked for me Linux SLES11

Upvotes: 2

Related Questions