KGDB-Serial setup steps : kgdb-2.4patches,Linux- 2.6.16 kernel

Steps i followed in setting up Kgdb-Serial b/w two Desktop Pc's.

Downloaded kgdb-2.4(eperimental)patches from SourceForge.net: kgdb.

Downloaded Linux kernel-2.6.16.40 from kernel.org.

I used quilt utilty to patch the kernel.

In Dev m/c

$ cd /usr/src/linux-2.6.16.40
$ make mrproper
Now copy target's (kernel) config file to Dev machines target linux source directory
$ scp root@ipaddress:/boot/config-2.6.18-FC6 /usr/src/linux-2.6.16.40/.config

$ make menuconfig

2. Build:
------
Enable following config options (in this order).

1) Kernel hacking ->
KGDB: kernel debugging with remote gdb ->
KGDB: Thread analysis
KGDB: Console messages through gdb
KGDB: Select the serial port(0/1)
[Note: I selected port no as 0, as there is
only com1 is there in my target m/c]

2) Device drivers ->
Character devices ->
Serial drivers ->
KGDB: On generic serial port (8250)

3) Security ->
Disable selinux

$ make clean
$ make bzImage
$ make modules
$ make modules_install

3. Follow the steps for Target machine
----------------------------------

1) Copy /lib/modules/2.6.16.40 in Dev machine to same location in Target machine.
2) Make initrd
$ mkinitrd /boot/initrd-2.6.16-s0404.img /lib/modules/2.6.16.40
3) Copy bzImage from Dev machine(/usr/src/linux2.6.16.40/arch/i386/boot) to Target machines /boot/vmlinuz-2.6.16-s0404
4) Copy System.map from Dev machine(/usr/src/linux2.6.16.40) to Target's /boot/System.map-2.6.16-s0404
5) Boot:
-----
Put 'kgdbwait' on the command line in /boot/grub/menu.lst if you have configured KGDB to use the
serial port you want, and you want KGDB to stop on boot.

Eg:
title Fedora Core (2.6.16-s0404-ttys0)
root (hd0,1)
kernel /boot/vmlinuz-2.6.16-s0404 ro root=LABEL=/ kgdbwait
initrd /boot/initrd-2.6.16-s0404.img

If you pass 'kgdbwait' on the command line, target machine stops at:
"Uncompressing Linux... Ok, booting the kernel."

4.
Now on the development machine start the gdb (@ /usr/src/linux-2.6.16.40) and set the baudrate and serial port as shown below.

% gdb ./vmlinux
(gdb) set remotebaud 115200
(gdb) set debug remote 10
(gdb) target remote /dev/ttyS0
remote debugging using /dev/ttyS0
breakpoint () at kernel/kgdb.c:1889
1889 atomic_set(&kgdb_setting_breakpoint, 0);
warning: shared library handler failed to enable breakpoint
(gdb) c
Continuing.

Hope this listing will be helpful...

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值