mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-27 04:01:36 +01:00
getting started back to getting started
This commit is contained in:
@@ -1,5 +1,37 @@
|
||||
# Getting started
|
||||
|
||||
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](https://stackoverflow.com/questions/10833672/buildroot-environment-with-host-toolchain), 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](run-on-host.md), 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](kernel_module/).
|
||||
|
||||
## Module documentation
|
||||
|
||||
head kernel_module/modulename.c
|
||||
|
||||
Reference in New Issue
Block a user