Debugging the kernel with KGDB
By now, I'll assume that you've configured and built a Linux target system suitable for KGDB (as described in detail in the previous section). It could be for any machine, including a guest system... Here, we'll continue to use the SEALS-generated ARM32 VExpress platform that we just set up as the target.
The intention here is to demo debugging the kernel early in the boot process with KGDB. To do so, the GDB server component within the target kernel will have to make it wait early in the boot process. This is so that the remote GDB client can connect to it. Linux supplies a boot parameter to do precisely this – it's named kgdbwait
. To use it, you need to have a KGDB I/O driver built into the kernel image and specify which one via the kgdboc
boot parameter (for example, kgdboc=/dev/ttyS0
). You can also set it up later (on the console) by echoing the device name into the pseudofile /sys/module/kgdboc/parameters/kgdboc
.