How to load a custom module at the boot time in Ubuntu?

29,824

Solution 1

This technique didn't work on Ubuntu 13.10. So after a few trial and error tries I ended up with this:

Copy my kernel module to the drivers directory.

$ sudo cp mymodule.ko /lib/modules/$(uname -r)/kernel/drivers/

Add the simple name of my module to the file /etc/modules. You can edit the file or just append to it as shown here.

$ echo 'mymodule' | sudo tee -a /etc/modules

Update the list of module dependencies.

$ sudo depmod

Reboot the computer and voila, it worked.

Solution 2

Add the module to the /etc/modules file.

And then put the module in your /lib/modules/kernelname catalogue.

Share:
29,824
Admin
Author by

Admin

Updated on July 09, 2022

Comments

  • Admin
    Admin almost 2 years

    I created a custom and simple module named Hello.ko I install the module with the command "insmod hello.ko", I check it with "dmesg" and it's working, but when I restart the system, I have to load it manually. So, how can I do for loading my custom module automatically, and where do I have to put the hello.ko? After loading the module, I would like to show the message Hello World until I press the Enter Key. Can anybody help me?