linux-2.6.31.12. Not sure if these will work for any previous or later versions.make menuconfigand select the following- Select Kernel Hacking → KGDB: kernel debugging with remote gdb
- Select KGDB: use kgdb over the serial console
- Build the kernel
make bzImage; make modules; sudo make modules_install - Install the kernel. Copy
bzImage,System.mapand.configinto/boot - On another machine (say remote) where the serial null modem cable is connected, copy the entire kernel folder that you compiled on the target machine.
- Restart the target machine. At the grub menu, select your kernel, edit it and add the following at the end of the kernel line:
kgdboc=ttyS0,115200 kgdbwait
This is assuming that you have a serial port and it is connected onttyS0. Boot into your kernel. It will wait for gdb to connect. - On the remote machine, go in the kernel folder you copied over and debug
vmlinxby starting gdb gdb ./vmliux- Set the baud rate -
(gdb) set remotebaud 115200 - Connect to the target -
(gdb) target remote /dev/ttyS0 - Run the kernel -
(gdb) continue
For more details, refer to the docbook on KGDB in the kernel documentation folder. Just do a
make htmldocs to convert into a readable format. You would have to install xmlto first. sudo aptitude install xmlto should help.