mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
qemu and linux as submodlues, S98 vs S99, readme benefits of Ctrl + C
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,6 +4,8 @@
|
||||
*.o
|
||||
*.out
|
||||
*.tmp
|
||||
*~
|
||||
.tmp_versions
|
||||
/rootfs_overlay/etc/init.d/S99
|
||||
Module.symvers
|
||||
modules.order
|
||||
|
||||
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -1,3 +1,9 @@
|
||||
[submodule "buildroot"]
|
||||
path = buildroot
|
||||
url = https://github.com/buildroot/buildroot
|
||||
[submodule "qemu"]
|
||||
path = qemu
|
||||
url = https://github.com/cirosantilli/qemu
|
||||
[submodule "linux"]
|
||||
path = linux
|
||||
url = https://github.com/cirosantilli/linux
|
||||
|
||||
@@ -122,6 +122,8 @@ TODO: Ctrl + C kills the emulator, it is not sent to guest processes. See:
|
||||
- <https://github.com/cloudius-systems/osv/issues/49>
|
||||
- <https://unix.stackexchange.com/questions/167165/how-to-pass-ctrl-c-in-qemu>
|
||||
|
||||
This is however fortunate when running QEMU with GDB, as the Ctrl + C reaches GDB and breaks.
|
||||
|
||||
## Automatic startup commands
|
||||
|
||||
When debugging a module, it becomes tedious to wait for build and re-type:
|
||||
@@ -131,10 +133,14 @@ When debugging a module, it becomes tedious to wait for build and re-type:
|
||||
|
||||
Instead, you can add your test commands to:
|
||||
|
||||
rootfs_overlay/etc/init.d/S99
|
||||
cd rootfs_overlay/etc/init.d
|
||||
cp S98 S99
|
||||
vim S99
|
||||
|
||||
and they will be run automatically before the login prompt.
|
||||
|
||||
`S99` is already gitignored for you.
|
||||
|
||||
## Debugging
|
||||
|
||||
To GDB the Linux kernel, first run:
|
||||
|
||||
@@ -2,6 +2,7 @@ BR2_GLOBAL_PATCH_DIR="../global_patch_dir"
|
||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="../kernel_config_fragment"
|
||||
BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="../busybox_config_fragment"
|
||||
BR2_PACKAGE_KERNEL_MODULE=y
|
||||
BR2_PACKAGE_OVERRIDE_FILE=../buildroot_override
|
||||
BR2_PACKAGE_STRACE=y
|
||||
BR2_ROOTFS_OVERLAY="../rootfs_overlay"
|
||||
|
||||
|
||||
2
buildroot_override
Normal file
2
buildroot_override
Normal file
@@ -0,0 +1,2 @@
|
||||
HOST_QEMU_OVERRIDE_SRCDIR = ../qemu
|
||||
LINUX_OVERRIDE_SRCDIR = ../linux
|
||||
1
linux
Submodule
1
linux
Submodule
Submodule linux added at 54e66cc228
1
qemu
Submodule
1
qemu
Submodule
Submodule qemu added at 144ea94d71
6
rootfs_overlay/etc/init.d/S98
Executable file
6
rootfs_overlay/etc/init.d/S98
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# For temparary test commands, first copy this file to to
|
||||
# S99 which is already gitignored.
|
||||
echo 'S98'
|
||||
# insmod /hello.ko
|
||||
exit 0
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
echo 'S99'
|
||||
# insmod /hello.ko
|
||||
exit 0
|
||||
Reference in New Issue
Block a user