x86,aarch64,arm

Ciro Santilli 67a7414f8c bak 8 tahun lalu
buildroot @ 083c0735e9 338756a029 bak 8 tahun lalu
host 690284a3bf Userland test programs 8 tahun lalu
kernel_module 67a7414f8c bak 8 tahun lalu
rootfs_overlay ad077d3943 Workqueue works! QEMU CLI mode with -n for panic 8 tahun lalu
.gitignore d45ceace5d 0 8 tahun lalu
.gitmodules 338756a029 bak 8 tahun lalu
README.md 9370512176 delay attempt 2 8 tahun lalu
bibliography.md bf3bb0cb18 fops read returns some data, busybox config frag for stat, bibliography start 8 tahun lalu
build.md 8eb878c24e update 8 tahun lalu
busybox_config_fragment bf3bb0cb18 fops read returns some data, busybox config frag for stat, bibliography start 8 tahun lalu
introduction.md d45ceace5d 0 8 tahun lalu
kernel_config_fragment 0279ae3bad Better name for config fragment 8 tahun lalu
kmod.md d45ceace5d 0 8 tahun lalu
run 9370512176 delay attempt 2 8 tahun lalu

README.md

Linux Kernel Module Cheat

Run one command, get into QEMU Buildroot BusyBox with several minimal Linux kernel 4.9 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/. For module usage do:

head *. use Buildroot's default kernel version, you can confirm it after build 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

When your kernel starts crashing, get the full trace with:

./run -n

See also: https://unix.stackexchange.com/questions/208260/how-to-scroll-up-after-a-kernel-panic

Then if you want your terminal back, hit Ctrl + C, A and type quit. See also: http://stackoverflow.com/questions/14165158/how-to-switch-to-qemu-monitor-console-when-running-with-curses

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