What can you do with kernel modules?
There are several advantages that come with using kernel modules:
- The kernel does not have to rebuild your kernel as often.
- It is easier to diagnose system problems.
- Using modules can save memory, because they are loaded only when the system is actually using them.
- Modules are much faster to maintain and debug.
How do I open a kernel module?
Loading a Module
- To load a kernel module, run modprobe module_name as root .
- By default, modprobe attempts to load the module from /lib/modules/kernel_version/kernel/drivers/ .
- Some modules have dependencies, which are other kernel modules that must be loaded before the module in question can be loaded.
Is there a way to debug the kernel?
There are numerous better ways to do kernel debugging, most of which we’ll get to in upcoming columns. But for a quick-and-dirty way of examining some of those kernel space values, as long as you have all of the prerequisites in the list above, what we’re about to demonstrate will work just fine.
Where do I find the kernel and modules in Linux?
Built and installed the corresponding kernel and modules, leaving the ELF-format vmlinux image file at the top of the source tree Installed the gdb debugger. Once all that’s done, you can carry on.
Where do I invoke GDB on the kernel?
In a sense, that’s exactly what we’re doing above — invoking it on an executable (vmlinux) and its corresponding core file, which is supplied via /proc/kcore. Trivial, no? And That’s It? Of course not. So here’s what you need to remember when debugging your running kernel with gdb:
Can you examine the kernel symbol table from user space?
Once you realize that you can examine the values of symbols in the kernel symbol table from user space, it should be easy to see that you can just as conveniently examine some of the values in your loadable (and loaded) modules.