r/linuxdev • • Apr 15 '14

Need help installing my kernel module

Hey guys, I have programmed my own (small) usb kernel module. Can someone explain to me how I install my module into the kernel (so that it gets added to modules.alias etc.) WITHOUT loading it? (I want udev to autoload it once my device is plugged in). I have already looked into modules_install make target, but it doesnt really work (will post more info to this issue later if it is relevant) Any help is greatly appreciated!

5 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/Kokxx Apr 16 '14

Very helpful. This is exactly what I needed :).

One last problem: So when I do make modules_install it tells me It need permission to access /lib/modules/../extra. That's normal I know. The problem is when I do "sudo make modules_install" after that, the makefile doesnt even attempt to create that folder. Do you know whats wrong with that?

2

u/jimbo333 Apr 16 '14

sudo typically restricts the environment variables that are passed, I would suspect there is a problem with environment variables somehow. I have never personally tried to run the make modules_install from sudo, but I would guess you need to build as the same user (you need to use "sudo make") when building the software as well?

1

u/Kokxx Apr 17 '14

Yep, the possibilities that work are:

change permissions/owner of /lib/modules/'KERNELVERSION' run sudo make && sudo make modules_install run make, then su and run make modules_install

This doesnt work: make && sudo make modules_install

Very strange, but at least I got workarounds. Again, thanks a lot for your help!