x86,aarch64,arm

Ciro Santilli 8ddefa940e gem5 пре 7 година
buildroot @ 8ce27bb9fe 12abf43b78 Attempt migration to Buildroot 2017.08 + kernel 4.12. пре 7 година
buildroot_patches 5ad68edd00 Linux 4.12, buildroot 2017.08, Ubuntu 17.10. пре 7 година
global_patch_dir 5393299433 Make global_patch_dir empty пре 8 година
hello_host bb10d0e914 Improve hello_host readme пре 7 година
kernel_module 12abf43b78 Attempt migration to Buildroot 2017.08 + kernel 4.12. пре 7 година
linux @ d4160b40c5 eebcca4e69 You know what? v4.14 пре 7 година
qemu @ 09fa182a4e 9ec43c4e88 lkmc_platform_device read example пре 7 година
rootfs_overlay 938e742209 Explain /etc/modprobe.conf further пре 7 година
.gitignore 8ddefa940e gem5 пре 7 година
.gitmodules 23eddfb2a2 Shallow clone to save clone time and disk space пре 7 година
.travis.yml 2f82f78589 build without sdl for travis пре 7 година
CONTRIBUTING.md 6c51ecaf7b split build and run scripts due to option conflicts пре 7 година
LICENSE.txt 36cd620dd2 license пре 8 година
README.md c7bbc6029a Merge branch 'master' of github.com:cirosantilli/linux-kernel-module-cheat пре 7 година
S99 4727fadcc8 procfs example, S99 symlink пре 8 година
bibliography.md 74dec92b4b link to linux-kernel-labs пре 7 година
build 8ddefa940e gem5 пре 7 година
build-gem5 8ddefa940e gem5 пре 7 година
buildroot_config_fragment 8ddefa940e gem5 пре 7 година
buildroot_config_fragment_x11 fa5c64a0b0 Make X11 optional пре 7 година
buildroot_override 9133fe023c qemu and linux as submodlues, S98 vs S99, readme benefits of Ctrl + C пре 8 година
busybox_config_fragment 8d668d6ed3 Use busybox devmem пре 8 година
configure 8ddefa940e gem5 пре 7 година
configure-gem5 8ddefa940e gem5 пре 7 година
count-boot-instructions.md 6c51ecaf7b split build and run scripts due to option conflicts пре 7 година
device-tree.md 2ff3648e8f device tree info пре 8 година
ftrace.md f80957cc40 frace docs an mmap minor improvements пре 7 година
gdb-step-debugging.md c7bbc6029a Merge branch 'master' of github.com:cirosantilli/linux-kernel-module-cheat пре 7 година
gdbserver.md 6c51ecaf7b split build and run scripts due to option conflicts пре 7 година
gem5.md 8ddefa940e gem5 пре 7 година
getting-started.md c7bbc6029a Merge branch 'master' of github.com:cirosantilli/linux-kernel-module-cheat пре 7 година
init.md 6c51ecaf7b split build and run scripts due to option conflicts пре 7 година
kernel_config_fragment 2e04c96fad MODULE_VERSION and srcversion пре 7 година
kernel_config_gem5 8ddefa940e gem5 пре 7 година
kgdb.md 6c51ecaf7b split build and run scripts due to option conflicts пре 7 година
kmod.md fa0a7e150d Less converstaion пре 7 година
maintainers.md 959ecac538 Maintainers how to update linux kernel пре 7 година
modprobe.md fa0a7e150d Less converstaion пре 7 година
other-architectures.md 6c51ecaf7b split build and run scripts due to option conflicts пре 7 година
qemumonitor a8e11e6de9 qemumonitor helper, extra_append from CLI, pci_rescan.sh пре 8 година
record-and-replay.md a070486855 Mention rr on record and replay пре 7 година
rootfs_post_build_script f69e894034 rootfs_post_build_script stub пре 7 година
run 6c51ecaf7b split build and run scripts due to option conflicts пре 7 година
run-on-host.md c7bbc6029a Merge branch 'master' of github.com:cirosantilli/linux-kernel-module-cheat пре 7 година
rungdb b3b1df5560 bak пре 7 година
rungdb-user 52c3ee15dc Userland without gdbserver пре 7 година
rungdbserver b89ba9b799 gdbserver shared library пре 7 година
rungem5 8ddefa940e gem5 пре 7 година
rungem5-shell 8ddefa940e gem5 пре 7 година
screenshot.png 53c1b61879 screenshot, vm to description, qemu debug non intrusive пре 8 година
user_table b2459d07f5 Add a non-root user user0 password "a" пре 8 година
x11.md 6c51ecaf7b split build and run scripts due to option conflicts пре 7 година
x11.png 01f6ca24e5 x11 screenshot and link to insmod C пре 7 година

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. "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. ftrace
    7. Device tree
  3. Failed action
    1. Record and replay
    2. GEM5
  4. Insane action
    1. Run on host
    2. Hello host
  5. Conversation
    1. kmod
    2. Maintainers
    3. Bibliography