readme ++

This commit is contained in:
Ciro Santilli
2017-05-20 11:48:47 +01:00
parent 7f6b148dc4
commit 750bf431e8

View File

@@ -1,6 +1,6 @@
# 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 host.
Run one command, get into QEMU Buildroot BusyBox with several minimal Linux kernel 4.9 module example tutorials. Tested in Ubuntu 14.04 - 16.10 hosts.
Usage:
@@ -17,6 +17,15 @@ QEMU opens up, and you can run:
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.
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:
@@ -37,11 +46,11 @@ See also: <https://superuser.com/questions/351387/how-to-stop-kernel-messages-fr
## Debugging
GDB the linux kernel:
To GDB the Linux kernel, first run:
./runqemu -d
If you want to break immediately at a symbol, e.g. `start_kernel` of the boot sequence, open another terminal and run for example:
If you want to break immediately at a symbol, e.g. `start_kernel` of the boot sequence, open another terminal and run:
./rungdb start_kernel
@@ -72,6 +81,8 @@ And now you can control the counting from GDB:
continue
continue
See also: <http://stackoverflow.com/questions/11408041/how-to-debug-the-linux-kernel-with-gdb-and-qemu>
## Text mode
Show serial output of QEMU directly on the current terminal, without opening a QEMU window: