Questions tagged [linux-kernel]

This tag is for questions about the internals of the Linux kernel itself - particularly about writing code that runs within the context of the kernel (like kernel modules or drivers). Questions about writing userspace code in Linux should generally be tagged [linux] instead. Since the internals of the Linux kernel are constantly changing, it is helpful to include the precise kernel version(s) that you are interested in.

This tag is for questions about the internals of the Linux kernel itself - particularly about writing code that runs within the context of the kernel (like kernel modules or drivers).

Questions about writing userspace code in Linux should generally be tagged instead. Since the internals of the Linux kernel are constantly changing, it is helpful to include the precise kernel version(s) that you are interested in.

The kernel is a UNIX-like kernel initially created by Linus Torvalds in 1991 and now is maintained by developers around the world.

Frequently Asked Questions

Online resources

Books

Kernel source code and source code browsers

Further reading

Mailing lists

17371 questions
34
votes
3 answers

How to create a new Linux kernel scheduler

Looking through the scheduler source code (2.6.34, kernel/sched.c), I can see how the "pluggable" schedulers are used, and I believe I understand the interface to be implemented. What I don't understand yet is how to get my code built into the…
J Teller
  • 1,421
  • 1
  • 11
  • 14
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
34
votes
6 answers

M option in make command, Makefile

make -C ~/kernel-2.6 M=`pwd` modules What is the meaning in M='pwd' in the line above ? I could not understand the explanation : The M= option causes that makefile to move back into your module source directory before trying to build the modules…
user1047069
  • 935
  • 2
  • 13
  • 25
34
votes
3 answers

module_init() vs. core_initcall() vs. early_initcall()

In drivers I often see these three types of init functions being used. module_init() core_initcall() early_initcall() Under what circumstances should I use them? Also, are there any other ways of init?
Sandeep
  • 18,356
  • 16
  • 68
  • 108
34
votes
2 answers

Difference between ZRAM and ZSWAP

Does anyone know what is the difference between feature ZRAM and ZSWAP in linux kernel? Seems they are very similar-- store compressed pages in ram.
user1391731
  • 373
  • 1
  • 4
  • 5
34
votes
2 answers

Userspace vs kernel space driver

I am looking to write a PWM driver. I know that there are two ways we can control a hardware driver: User space driver. Kernel space driver If in general (do not consider a PWM driver case) we have to make a decision whether to go for user…
Katoch
  • 2,709
  • 9
  • 51
  • 84
34
votes
2 answers

Handling ARM TrustZones

ARM has something called TrustZone. As per ARM documentation , it gives that a process can run in Secure / Non-Secure World. What does the Secure / Non-Secure World means. Is it related to Processor executing modes or it is related to setting the…
Prabagaran
  • 903
  • 1
  • 9
  • 17
33
votes
1 answer

What does ERESTARTSYS used while writing linux driver?

I'm learning about the blocking I/O functions for writing linux device driver and I'm wondering what is the usage of ERESTARTSYS. Consider the following: Global variable : wait_queue_head_t my_wait_q_head; int read_avail = 0; device_init() :…
I'm a frog dragon
  • 7,865
  • 7
  • 46
  • 49
33
votes
3 answers

proc_create() example for kernel module

Can someone give me proc_create() example? Earlier they used create_proc_entry() in the kernel but now they are using proc_create().
Rahul
  • 1,607
  • 3
  • 23
  • 41
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
1 answer

Change default console loglevel during boot up

I setup a CentOS 6.3 setup, on which the console loglevel is set to 4, and default log level is set to 4. I know I can change the default console log level using the following steps: cat /proc/sys/kernel/printk 4 4 1 7 echo 5 >…
Ahmed A
  • 3,362
  • 7
  • 39
  • 57
33
votes
2 answers

Difference between eng and user-debug build in Android

I would like to know the difference between the two build_flavor's viz. eng & user-debug The difference between eng and user build flavors is quiet evident. But eng and user-debug is confusing me somewhat. What are the additional Debug facilities…
spitfire88
  • 1,596
  • 3
  • 19
  • 31
33
votes
6 answers

Building a kernel module from several source files which one of them has the same name as the module

Is it possible to build a kernel module from several source files which one of them has the same name as the module? For example: I want to build "mymodule.ko" with the following source files: mymodule.c mymodule_func.c This makefile doesn't…
Adrien
  • 603
  • 1
  • 5
  • 10
32
votes
1 answer

Rationale behind the container_of macro in linux/list.h

In the implementation of linux kernel lists in /include/linux/list.h, what is the rationale behind the first line (pasted below) of the container_of macro? const typeof( ((type *)0)->member ) *__mptr = (ptr); In a sample code of mine, I removed…
woodstok
  • 2,704
  • 3
  • 34
  • 50
32
votes
4 answers

buffered asynchronous file I/O on linux

I am looking for the most efficient way to do asynchronous file I/O on linux. The POSIX glibc implementation uses threads in userland. The native aio kernel api only works with unbuffered operations, patches for the kernel to add support for…
Marenz
  • 2,722
  • 3
  • 20
  • 19