x86,aarch64,arm

Ciro Santilli c4b4f029d4 cannot insmoe workqueue: module already loaded, even though lsmod says otherwise 8 years ago
buildroot @ 083c0735e9 338756a029 bak 8 years ago
host 8eb878c24e update 8 years ago
kernel_module c4b4f029d4 cannot insmoe workqueue: module already loaded, even though lsmod says otherwise 8 years ago
rootfs_overlay 8d20f8ce30 llseek 8 years ago
.gitignore d45ceace5d 0 8 years ago
.gitmodules 338756a029 bak 8 years ago
README.md 67f669487e Workqueue attempt, but fails to insmod, already loaded?? 8 years ago
bibliography.md bf3bb0cb18 fops read returns some data, busybox config frag for stat, bibliography start 8 years ago
build.md 8eb878c24e update 8 years ago
busybox_config_fragment bf3bb0cb18 fops read returns some data, busybox config frag for stat, bibliography start 8 years ago
introduction.md d45ceace5d 0 8 years ago
kernel_config_fragment 0279ae3bad Better name for config fragment 8 years ago
kmod.md d45ceace5d 0 8 years ago
run bf3bb0cb18 fops read returns some data, busybox config frag for stat, bibliography start 8 years ago

README.md

Linux Kernel Module Cheat

Run one command, get into QEMU Buildroot BusyBox with several minimal Linux kernel module example tutorials. Tested in Ubuntu 14.04.

Usage:

./run

First build will take a while (GCC, Linux kernel).

QEMU opens up, and you can run:

insmod /hello.ko
insmod /hello2.ko
rmmod hello
rmmod hello2

Each module comes from a C file under kernel_module/. head *.c for module usage.

The Linux kernel version can be found with:

grep BR2_LINUX_KERNEL_VERSION buildroot/.config

We use printk a lot, and it shows on the QEMU terminal by default. If that annoys you (e.g. you want to see stdout separately), do:

dmesg -n 1

See also: https://superuser.com/questions/351387/how-to-stop-kernel-messages-from-flooding-my-console

  1. Introduction
  2. Build
  3. kmod
  4. Bibliography
  5. Examples
    1. Host
    2. Buildroot
      1. hello
      2. hello2
      3. debugfs
      4. fops
      5. workqueue