First, the environment
Ubuntu 14.04
A PC with serial port (number PC1, Debug machine)
Another PC connects the PC1 (number PC2, the machine that initiates the debug command) via USB to serial cable
Second, serial line configuration and testing
Installing cutecom
USB to serial port connected to the PC2, and connected to the PC1
PC1 and PC2 use sudo cutecom to open the serial software
Use/DEV/TTYS0 same baud rate 115200 on PC1 on/dev/ttyusb0 PC2
Test: PC1 send data, PC2 can receive and echo normally.
Third, compile and install the kernel
Compile in PC2, and then build the *header*.deb and *image*.deb in PC1 and install them.
sudo make Menuconfig
sudo make-kpkg--initrd--revision 1.0--append-to-version-2016 kernel_image kernel_headers
sudo dpkg-i *headers*.deb
sudo dpkg-i *image*.deb
Four, PC1 dynamic start debugging options
echo ttys0,115200 >/sys/module/kgdboc/parameters/kgdboc
V. Test configuration Results
PC1 Run the following command
sudo su
echo g >/proc/sysrq-trigger
PC2 into the Linux kernel source directory and run
GDB Vmlinux
>set Serial baud 115200
>target remote/dev/ttyusb0
After normal then can see PC2 into Linux corresponding code snippet
Vi. reference materials
Dual-machine kernel debug via kgdb-Blog channel-csdn.net
KGDB with Virtualbox:debug a Live kernel-open Source for you
Kernel Debugging and Tracing Linux Update
GDB-KGDB remote Debugging connection issue via USB and Serial Connection-stack Overflow
Chapter 5. Using Kgdb/gdb
Debug the Linux kernel with a serial line