x86,aarch64,arm

Ciro Santilli 六四事件 法轮功 包卓轩 6b0f89a8b4 aosp vor 7 Jahren
buildroot @ 8ce27bb9fe 12abf43b78 Attempt migration to Buildroot 2017.08 + kernel 4.12. vor 7 Jahren
buildroot_patches 5ad68edd00 Linux 4.12, buildroot 2017.08, Ubuntu 17.10. vor 7 Jahren
global_patch_dir 5393299433 Make global_patch_dir empty vor 7 Jahren
hello_host bb10d0e914 Improve hello_host readme vor 7 Jahren
kernel_module 12abf43b78 Attempt migration to Buildroot 2017.08 + kernel 4.12. vor 7 Jahren
linux @ d4160b40c5 eebcca4e69 You know what? v4.14 vor 7 Jahren
qemu @ 09fa182a4e 9ec43c4e88 lkmc_platform_device read example vor 7 Jahren
rootfs_overlay 69eb98b5ab Document debugfs directory created automatically vor 7 Jahren
.gitignore 8ddefa940e gem5 vor 7 Jahren
.gitmodules 23eddfb2a2 Shallow clone to save clone time and disk space vor 7 Jahren
.travis.yml 2f82f78589 build without sdl for travis vor 7 Jahren
CONTRIBUTING.md 6c51ecaf7b split build and run scripts due to option conflicts vor 7 Jahren
LICENSE.txt 36cd620dd2 license vor 8 Jahren
README.md 04d2d69623 Update README.md vor 7 Jahren
S99 4727fadcc8 procfs example, S99 symlink vor 7 Jahren
bibliography.md 6b0f89a8b4 aosp vor 7 Jahren
build f5a0111c3e Fix kernel_config_fragment that was getting ignored after gem5 addition vor 7 Jahren
build-gem5 6ddbec9c99 Automate failed gem5 x86 attempt vor 7 Jahren
buildroot_config_fragment 21da1e9b76 QEMU user mode fun vor 7 Jahren
buildroot_config_fragment_x11 fa5c64a0b0 Make X11 optional vor 7 Jahren
buildroot_override 9133fe023c qemu and linux as submodlues, S98 vs S99, readme benefits of Ctrl + C vor 7 Jahren
busybox_config_fragment 8d668d6ed3 Use busybox devmem vor 7 Jahren
configure 1be85b6dc2 configure: install automake vor 7 Jahren
configure-gem5 8ddefa940e gem5 vor 7 Jahren
count-boot-instructions.md 6c51ecaf7b split build and run scripts due to option conflicts vor 7 Jahren
device-tree.md 2ff3648e8f device tree info vor 7 Jahren
ftrace.md f80957cc40 frace docs an mmap minor improvements vor 7 Jahren
gdb-step-debugging.md c7bbc6029a Merge branch 'master' of github.com:cirosantilli/linux-kernel-module-cheat vor 7 Jahren
gdbserver.md 027bca7927 Update gdbserver.md vor 7 Jahren
gem5.md 3a34f9f2a5 gem5 kernel command line arguments vor 7 Jahren
getting-started.md 03f418b53e document how to clean the build in getting started vor 7 Jahren
init.md 920afba40a Disable networking on image with command line option ./build -p -n vor 7 Jahren
kernel_config_arm-gem5 6ddbec9c99 Automate failed gem5 x86 attempt vor 7 Jahren
kernel_config_fragment 2e04c96fad MODULE_VERSION and srcversion vor 7 Jahren
kernel_config_x86_64-gem5 6ddbec9c99 Automate failed gem5 x86 attempt vor 7 Jahren
kgdb.md 6c51ecaf7b split build and run scripts due to option conflicts vor 7 Jahren
kmod.md fa0a7e150d Less converstaion vor 7 Jahren
maintainers.md 32c4ce0291 Further improve gem5 documentation vor 7 Jahren
modprobe.md fa0a7e150d Less converstaion vor 7 Jahren
other-architectures.md 6c51ecaf7b split build and run scripts due to option conflicts vor 7 Jahren
qemu-user-mode.md 21da1e9b76 QEMU user mode fun vor 7 Jahren
qemumonitor a8e11e6de9 qemumonitor helper, extra_append from CLI, pci_rescan.sh vor 7 Jahren
record-and-replay.md a070486855 Mention rr on record and replay vor 7 Jahren
rootfs_post_build_script 920afba40a Disable networking on image with command line option ./build -p -n vor 7 Jahren
run 6c51ecaf7b split build and run scripts due to option conflicts vor 7 Jahren
run-on-host.md c7bbc6029a Merge branch 'master' of github.com:cirosantilli/linux-kernel-module-cheat vor 7 Jahren
rungdb b3b1df5560 bak vor 7 Jahren
rungdb-user 52c3ee15dc Userland without gdbserver vor 7 Jahren
rungdbserver b89ba9b799 gdbserver shared library vor 7 Jahren
rungem5 3a34f9f2a5 gem5 kernel command line arguments vor 7 Jahren
rungem5-shell 8ddefa940e gem5 vor 7 Jahren
screenshot.png 53c1b61879 screenshot, vm to description, qemu debug non intrusive vor 8 Jahren
user_table b2459d07f5 Add a non-root user user0 password "a" vor 7 Jahren
x11.md 6c51ecaf7b split build and run scripts due to option conflicts vor 7 Jahren
x11.png 01f6ca24e5 x11 screenshot and link to insmod C vor 7 Jahren

README.md

Linux Kernel Module Cheat

Run one command, get a QEMU Buildroot BusyBox virtual machine built from source with several minimal Linux kernel 4.14 module development example tutorials with GDB and KGDB step debugging and minimal educational hardware models. Limited GEM5 full system support. "Tested" in x86, ARM and MIPS guests, Ubuntu 17.10 host.

Reserve 12Gb of disk and run:

git clone https://github.com/cirosantilli/linux-kernel-module-cheat
cd linux-kernel-module-cheat
./configure && ./build && ./run

The first build will take a while (GCC, Linux kernel), e.g.:

  • 2 hours on a mid end 2012 laptop
  • 30 minutes on a high end 2017 desktop

If you don't want to wait, you could also try to compile the examples and run them on your host computer as explained on the "Run on host" section, but as explained on that section, that is dangerous, limited, and will likely not work.

After QEMU opens up, you can start playing with the kernel modules:

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

This should print to the screen:

hello init
hello2 init
hello cleanup
hello2 cleanup

which are printk messages from init and cleanup methods of those modules.

All available modules can be found in the kernel_module directory.

See the getting started section for further details.

  1. Getting started
  2. Action
    1. Step debugging
      1. GDB step debugging
      2. KGDB
      3. gdbserver
    2. Other architectures
    3. modprobe
    4. X11
    5. Count boot instructions
    6. GEM5
    7. ftrace
    8. QEMU user mode
  3. Failed action
    1. Record and replay
  4. Insane action
    1. Run on host
    2. Hello host
  5. Conversation
    1. kmod
    2. Device tree
    3. Maintainers
    4. Bibliography