mgalgs / 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 support. "Tested" in x86, ARM and MIPS guests, Ubuntu 17.10 host.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 support. "Tested" in x86, ARM and MIPS guests, Ubuntu 17.10 host.

Reserve 12Gb of disk and run:

git clone https://github.com/************/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

About

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 support. "Tested" in x86, ARM and MIPS guests, Ubuntu 17.10 host.

License:GNU General Public License v3.0


Languages

Language:C 81.8%Language:Shell 16.5%Language:Makefile 1.7%