Questions tagged [kernel-module]

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.

2228 questions
5
votes
2 answers

how to write cross-version/platform Linux kernel modules?

I'm new to programming Linux kernel modules, and many getting started guides on the topic include little information about how to build a kernel module which will run on many versions and CPU platforms of Linux. Most of the guides I've seen simply…
Dan
  • 7,155
  • 2
  • 29
  • 54
5
votes
1 answer

Is it possible to send SCSI commands to a USB device from within a kernel module?

Question How, given the information udev passes to my kernel module (the block device path maybe), can I send SCSI commands to the block device? (yet have it function normally otherwise, meaning partitions are mounted, no data loss, etc) What I'm…
5
votes
2 answers

Why is my kernel module throwing "broken pipe" errors when I try to write to a device?

I am currently in the process of writing a Linux kernel module in C. The module provides an extremely basic driver for a USB light (the device consists of three colored LEDs). I have managed to get the driver to load and unload without problems and…
Nathan Osman
  • 71,149
  • 71
  • 256
  • 361
5
votes
2 answers

Setting Dynamic Variable in Linux kernel module

i have made a new Linux TCP cong algorithm implementation and have some static variables in this code now i want them to be dynamic by using some configuration method. as per my understanding in the kernel level programming, we cant load some text…
NitinG
  • 893
  • 3
  • 21
  • 38
5
votes
0 answers

How to mmap a file in linux kernel space?

I try to mmap a file in a linux kernel module. I have tried to use the function do_mmap_pgoff. But the address returned is memory virtual address in current process' user space, i.e., below the kernel boundary. Instead, I want to map the file in the…
Zhongshu
  • 503
  • 6
  • 13
5
votes
1 answer

UDP packet send with linux-kernel module without using sockets

I am writing a kernel module which creates a IP packet. Now i want to send this packet but haven't created any socket for it's transmission. is there any way to send it directly with the help of kernel routines. as i have tracked the linux kernel…
akp
  • 1,753
  • 3
  • 18
  • 26
5
votes
1 answer

Implementing Linux System Call using LKM

I was trying to add a new System Call to linux kernel 3.2.x. While searching for useful reference material over the internet i had an impression that implementing system call as a loadable module is not possible as in SO question Is it possible to…
abhi
  • 3,476
  • 5
  • 41
  • 58
5
votes
1 answer

Kernel Module: hrtimer_start "Unknown Symbol in Module"

I'm building a kernel module that uses the hrtimer interface. I have the module compiling successfully, and it's got MODULE_LICENSE("GPL") set: make -C /lib/modules/3.0.0-23-server/build SUBDIRS=/home/projects/net-modeler modules make[1]: Entering…
Chris
  • 16,872
  • 1
  • 15
  • 16
5
votes
2 answers

Passing parameter to a kernel module

I have some custom hardware that uses a kernel module called foo.ko. This has to be insmod from the Linux kernel. Is there is a way to pass a parameter to the kernel module during insmod, something like: insmod foo.ko ?
boffin
  • 639
  • 2
  • 13
  • 26
4
votes
1 answer

How do I configure clang_complete for linux kernel module development?

I tried to get gcc to dump the include paths and my .clang_complete file now looks…
Afriza N. Arief
  • 7,696
  • 5
  • 47
  • 74
4
votes
2 answers

Cross compiling a kernel module: invalid module format

I'm trying to cross compile a helloworld kernel module with specifications: host: intel x86 32 bit, linux-3.0.0 target: ARM machine (Parrot AR.Drone), linux-2.6.27.47 I'm using the makefile: PWD := $(shell pwd) obj-m := test.o all: $(MAKE) -C…
Jens Nyman
  • 1,186
  • 2
  • 14
  • 16
4
votes
1 answer

Unable to understand working of read_proc in Linux kernel module

I am reviewing the kernel module example at this page The read_proc used in the program is as follows: int fortune_read( char *page, char **start, off_t off, int count, int *eof, void *data ) { int len; if (off > 0) { …
Jake
  • 16,329
  • 50
  • 126
  • 202
4
votes
1 answer

C - Cannot access saddr

I am trying to handle simple packet inspection with netfilter hooks. Declaration seems fairly straightforward: unsigned int hook_func(unsigned int hooknum, struct sk_buff *skb, const struct net_device *in, const struct…
kevgliss
  • 105
  • 1
  • 8
4
votes
1 answer

Adding new IOCTL's into kernel (number range)

I'm writing new kernel module and I add implement new IOCTL's. Is there any rule that I should follow with IOCTL's numbering ? Maybe there is some "user range" ? I work with kernel 2.6.21 on embedded platform.
Bartlomiej Grzeskowiak
  • 1,009
  • 5
  • 16
  • 35
4
votes
2 answers

get filesystem mount point in kernel module

I want to get the filesystem mount point for a file system in my kernel module, which is a stackable filesystem. Eg. if /home/ab/abc is a file and /home is mounted on a different filesystem I want to have a dentry or path struct to /home. I want to…
gaurav
  • 872
  • 2
  • 10
  • 25