A kernel module is a run-time loadable object file that is loaded into operating system kernel to add functionality to a running kernel. Examples include device drivers and other kernel items.
Questions tagged [kernel-module]
2228 questions
122
votes
2 answers
Read/write files within a Linux kernel module
I know all the discussions about why one should not read/write files from kernel, instead how to use /proc or netlink to do that. I want to read/write anyway. I have also read
Driving Me Nuts - Things You Never Should Do in the Kernel.
However, the…

Methos
- 13,608
- 11
- 46
- 49
81
votes
7 answers
Is there a way to figure out what is using a Linux kernel module?
If I load a kernel module and list the loaded modules with lsmod, I can get the "use count" of the module (number of other modules with a reference to the module). Is there a way to figure out what is using a module, though?
The issue is that a…

mipadi
- 398,885
- 90
- 523
- 479
59
votes
5 answers
How to recompile just a single kernel module?
Usually kernel source are stored in /usr/src/linux-2.6.x/.
To avoid to recompile the entire kernel if I modify a module's source, how can I recompile just that module?

user1056635
- 785
- 2
- 9
- 12
55
votes
4 answers
How do I configure modprobe to find my module?
I'm trying to get a kernel module to load at boot.
If I run insmod /path/to/module.ko, it works fine. But this has to be repeated every time I reboot.
If I run modprobe /path/to/module.ko, it can't find the module.
I know modprobe uses a…

sep332
- 1,039
- 2
- 13
- 24
51
votes
2 answers
What is the opposite of `mknod`?
I am learning to write character device drivers from the Kernel Module Programming Guide, and used mknod to create a node in /dev to talk to my driver.
However, I cannot find any obvious way to remove it, after checking the manpage and observing…

merlin2011
- 71,677
- 44
- 195
- 329
36
votes
4 answers
What is a Kernel thread?
I am just started coding of device driver and new to threading, went through many documents for getting an idea about threads. I still have some doubts.
what is a kernel thread?
how it differs from user thread?
what is the relationship between the…

tijin
- 707
- 1
- 6
- 12
34
votes
4 answers
kvm: module verification failed: signature and/or required key missing - tainting kernel
I'm using Ubuntu 14.04 LTS and kernel version 3.13.11.4. I'm trying to load patched KVM modules kvm and kvm-intel and I'm getting the following errors
kvm: module verification failed: signature and/or required key missing - tainting kernel
…

user2743
- 1,423
- 3
- 22
- 34
33
votes
2 answers
Difference between printk and pr_info
What's the exact difference between printk and pr_info functions ? And under what conditions, should I choose one over the another ?

Jarvis
- 8,494
- 3
- 27
- 58
33
votes
6 answers
Cross compiling a kernel module
I'm trying to cross compile a helloworld kernel (2.6.x) module for ARM architecture on my intel x86 host.
The codesourcery tool chain for ARM is located at: /home/ravi/workspace/hawk/arm-2009q3
The kernel source is located at…

itisravi
- 3,406
- 3
- 23
- 30
29
votes
2 answers
How to find the list of processes using a particular kernel module?
When I try to rmmod a module I get the error message "Error: Module in use" , lsmod | grep shows the count.
Is there a way that would tell me which processes are using this particular kernel module/driver?

Raj
- 379
- 2
- 5
- 14
28
votes
6 answers
How to compile a kernel module for Raspberry pi?
I'm having trouble compiling a kernel module for a raspberry pi. I want to compile a "hello world" kernel module using the raspberry pi itself.
I am using raspbian wheezy 3.6.11+.
I tried following the directions at…

user3025582
- 339
- 1
- 4
- 8
26
votes
5 answers
How to load Linux kernel modules from C code?
I have an application that has both two external kernel modules and a userspace daemon. I want to load the modules from the daemon code, written in C, at startup, and unload them on clean exit. Can I load them in a cleaner way than doing…

Prof. Moriarty
- 601
- 1
- 6
- 10
24
votes
5 answers
linux kernel module linker warnings: "*** Warning: [] undefined!" - any way to get rid of them?
While compiling Linux kernel modules that depend on each other, linker gives undefined symbol warnings like
Building modules, stage 2.
MODPOST
*** Warning: "function_name1" [module_name] undefined!
*** Warning: "function_name2" [module_name]…

Gary
- 331
- 1
- 2
- 8
24
votes
1 answer
What is EXPORT_SYMBOL_GPL in Linux kernel code?
What is EXPORT_SYMBOL_GPL in Linux kernel code?
Below is a piece of code, which contains EXPORT_SYMBOL_GPL
62 struct resource *platform_get_resource(struct platform_device *dev,
63 unsigned int type, unsigned…

Sagar Jain
- 7,475
- 12
- 47
- 83
23
votes
3 answers
How to stop Linux kernel threads on rmmod?
I wrote the following code to create a kernel thread:
#include
#include
#include
#include
#include
struct task_struct *task;
int data;
int ret;
int thread_function(void…

pradeepchhetri
- 2,899
- 6
- 28
- 50