开发者

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

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?


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.


Add the module to the /etc/modules file.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜