• Stars
    star
    6,998
  • Rank 5,342 (Top 0.2 %)
  • Language
    TeX
  • License
    Open Software Lic...
  • Created almost 3 years ago
  • Updated 7 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The Linux Kernel Module Programming Guide (updated for 5.0+ kernels)

The Linux Kernel Module Programming Guide

This project keeps the Linux Kernel Module Programming Guide up to date, with working examples for recent 5.x kernel versions. The guide has been around since 2001 and most copies of it on the web only describe old 2.6.x kernels.

The book can be freely accessed via https://sysprog21.github.io/lkmpg/ or latest PDF file. The original guide may be found at Linux Documentation Project. You may check other freely available programming books listed by The Free Ebook Foundation or Linux online books collected by The Online Books Page.

Getting Started

Summary

  1. Get the latest source code from the GitHub page.
  2. Install the prerequisites.
  3. Generate PDF and/or HTML documents.

Step 1: Get the latest source code

Make sure you can run git with an Internet connection.

$ git clone https://github.com/sysprog21/lkmpg.git && cd lkmpg

Step 2: Install the prerequisites

To generate the book from source, TeXLive (MacTeX) is required.

For Ubuntu Linux, macOS, and other Unix-like systems, run the following command(s):

# Debian / Ubuntu
$ sudo apt install make texlive-full

# Arch / Manjaro
$ sudo pacman -S make texlive-most texlive-bin

# macOS
$ brew install mactex
$ sudo tlmgr update --self

Note that latexmk is required to generated PDF, and it probably has been installed on your OS already. If not, please follow the installation guide.

In macOS systems, package Pygments may not be pre-installed. If not, please refer to the installation guide before generate documents.

Alternatively, using Docker is recommended, as it guarantees the same dependencies with our GitHub Actions workflow. After install docker engine on your machine, pull the docker image twtug/lkmpg and run in isolated containers.

# pull docker image and run it as container
$ docker pull twtug/lkmpg
$ docker run --rm -it -v $(pwd):/workdir twtug/lkmpg

nerdctl is a Docker-compatible command line tool for containerd, and you can replace the above docker commands with nerdctl counterparts.

Step 3: Generate PDF and/or HTML documents

Now we could build document with following commands:

$ make all              # Generate PDF document
$ make html             # Convert TeX to HTML
$ make clean            # Delete generated files

License

The Linux Kernel Module Programming Guide is a free book; you may reproduce and/or modify it under the terms of the Open Software License. Use of this work is governed by a copyleft license that can be found in the LICENSE file.

The complementary sample code is licensed under GNU GPL version 2, as same as Linux kernel.

More Repositories

1

shecc

A self-hosting and educational C optimizing compiler
C
1,042
star
2

lab0-c

C Programming Lab: Assessing Your C Programming Skills
C
382
star
3

rv32emu

Compact and Efficient RISC-V RV32I[MAFC] emulator
C
327
star
4

simplefs

A simple native file system for Linux kernel
C
308
star
5

concurrent-programs

Complementary Concurrency Programs for course "Linux Kernel Internals"
C
301
star
6

jitboy

A Game Boy emulator with dynamic recompilation (JIT)
C
288
star
7

cpumemory-zhtw

Traditional Chinese translation of "What Every Programmer Should Know About Memory"
CSS
216
star
8

semu

A minimalist RISC-V system emulator capable of running Linux kernel
C
214
star
9

vwifi

A virtual wireless device driver for Linux
C
174
star
10

kvm-host

A minimalist type 2 hypervisor using Linux Kernel Virtual Machine (KVM)
C
137
star
11

pitifulvm

A shabby implementation of Java virtual machine in C
C
137
star
12

vcam

Virtual camera device driver for Linux
C
89
star
13

sehttpd

A small and efficient web server with 1K lines of C code
C
82
star
14

cserv

An event-driven and non-blocking web server
C
70
star
15

concurrent-ll

concurrent linked list implementation
C
68
star
16

khttpd

An experimental HTTP server implemented as Linux kernel module
C
60
star
17

rv32emu-legacy

RISC-V RV32I[MA] emulator with ELF support
C
47
star
18

raycaster

Wolfenstein 3D-style raycasting implementation
C
42
star
19

linux-list

Linux-like doubly-linked list
C
39
star
20

fibdrv

Linux kernel module that calculates Fibonacci numbers
Shell
37
star
21

gameboy-emu

An efficient and portable Game Boy emulator
C
36
star
22

lkm-hidden

A Linux kernel module which hides itself
C
29
star
23

rubi

Ruby-like high-performance script programming language with JIT compilation
C
25
star
24

kecho

A lightweight echo server implementation in Linux kernel mode
C
25
star
25

threaded-logger

Threaded Logger
C
21
star
26

threadkit

A collection of lightweight threading utilities
C
20
star
27

vinput

A collection of virtual input device drivers for Linux
C
20
star
28

linux-cfs-sim

Simulate Linux Completely Fair Scheduler (CFS) using POSIX Threads
C
18
star
29

rnnoise

A noise suppression library based on a recurrent neural network
C
17
star
30

kcalc

Math expression evaluation as Linux kernel module
C
16
star
31

dict

Ternary Search Tree + Bloom filter
C
15
star
32

jitcalc

A simple integer calculator using JIT compilation
C
15
star
33

y86_64-tools

Y86-64 Tools: assembler, simulator, Verilog designs
C
14
star
34

fastcat

A faster "cat" implementation using splice and sendfile system calls
C
13
star
35

neocon

A simple serial console utility
C
13
star
36

bignum

An incomplete arbitrary-precision integer arithmetic library
C
13
star
37

fiber

A User Space Threading Library
C
13
star
38

compute-pi

Leibniz formula for ฯ€
C
12
star
39

ca2023-lab3

Lab3: Construct a single-cycle CPU with Chisel
Scala
12
star
40

mapreduce

A simple C Thread pool implementation
C
12
star
41

prefix-search

Implement prefix search using ternary search tree
C
12
star
42

jit-construct

JIT compiler from scratch, derived from Nick Desaulniers' great work
Lua
11
star
43

datalab

Improved CS:APP Data Lab
C
9
star
44

buddy

Buddy Memory Allocator
C
8
star
45

moxiebox

A secure, sandboxed execution mechanism that enables deterministic input, processing and output
C
8
star
46

phonebook

sample phonebook program to illustrate the impact of cache miss
Shell
8
star
47

kilo

A text editor in less than 1000 LoC with syntax highlight and search
C
8
star
48

raytracing

Small ray tracing program for performance evaluation
C
8
star
49

intrusive-ds

A collection of intrusive data-structures for C
C
8
star
50

concurrency-primer

Concurrency Primer
TeX
8
star
51

gecos

GECOS: A lock-free synchronization mechanism
C
7
star
52

nyancat

Nyancat rendered in your terminal
C
6
star
53

matrix_oo

Sample matrix implementation illustrating object-oriented techniques in C99
Shell
6
star
54

dont-trace

A simple Linux kernel module that kills ptrace tracer and its tracees
C
6
star
55

kfifo-examples

Linux kernel module examples about kfifo
C
5
star
56

mergesort-concurrent

merge sort on singly-linked list utilzing POSIX Thread
C
5
star
57

tinymembench

Measure peak bandwidth of sequential memory accesses and the latency of random memory accesses
C
5
star
58

align-bench

Microbenchmark for unaligned memory access
C
4
star
59

cirbuf

Circular Buffer implementation with mmap(2) *incomplete*
C
4
star
60

kcalc-fixed

Math expression evaluation as Linux kernel module, fixed-point implementation
C
4
star
61

prefetcher

Evaluate the effects of prefetching
Shell
3
star
62

malloc-test-concurrent

concurrent malloc benchmark
C
3
star
63

sched-plugin

A Linux kernel module to allow user processes being handed out with LKM based scheduler
C
3
star
64

phonebook-concurrent

build a phonebook program by concurrent linked list
C
3
star
65

simrupt

A Linux device driver that simulates interrupts
C
3
star
66

tco-test

Test the ability of C compilers performing Tail Call Optimization
C
2
star
67

balanced-ternary

Ilustrate how balanced ternary works
Shell
2
star
68

vsnd

Virtual Linux soundcard driver
C
2
star
69

bf-runtime

Brainf*ck runtime engine
C
1
star
70

quotient-filter

(Incomplete) in-memory quotient filter
C
1
star
71

ksort

Linux kernel module that implements and validates sorting algorithms
C
1
star
72

arm-assembler-latex-listings

Arm Assembler language definition for the LaTeX listings package
TeX
1
star
73

clz-tests

Evaluate implementations of count leading zero
C
1
star
74

rv32emu-demo

HTML
1
star