# vim /boot/grub/grub.cfg ================================================== ... set defualt="2" # 将启动项修改为刚刚编译安装的内核(从0开始,第2个menuentry) ... submenu "Previous Linux versions" { menuentry 'Ubuntu, with Linux 3.13.0' --class ubuntu --class gnu-linux --class gnu --class os { recordfail gfxmode $linux_gfx_mode insmod gzio insmod part_msdos insmod ext2 set root='(hd0,msdos1)' search --no-floppy --fs-uuid --set=root 294b8f76-001b-4367-bead-3053c38b2578 linux /boot/vmlinuz-3.13.0 root=UUID=294b8f76-001b-4367-bead-3053c38b2578 ro quiet splash $vt_handoff kgdboc=ttyS0,115200 # 添加内核启动参数 initrd /boot/initrd.img-3.13.0 } ==================================================
3.客户机上执行:
1
# echo g > /proc/sysrq-trigger
4.主机连接到客户机:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
$ cd linux-3.13 $ socat -d -d /tmp/serial pty & [1] 7907 2017/07/01 11:56:40 socat[7907] N opening connection to AF=1 "/tmp/serial" 2017/07/01 11:56:40 socat[7907] N successfully connected from local address AF=1 ":\xAD\xEE\x7E" 2017/07/01 11:56:40 socat[7907] N successfully connected via <anon> 2017/07/01 11:56:40 socat[7907] N PTY is /dev/pts/4 2017/07/01 11:56:40 socat[7907] N starting data transfer loop with FDs [3,3] and [4,4] $ gdb vmlinux (gdb) target remote /dev/pts/4 Remote debugging using /dev/pts/4 kgdb_breakpoint () at kernel/debug/debug_core.c:1042 1042 wmb(); /* Sync point after breakpoint */ (gdb)