Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2590564
  • 博文数量: 351
  • 博客积分: 76
  • 博客等级: 上将
  • 技术积分: 3555
  • 用 户 组: 普通用户
  • 注册时间: 2004-11-13 21:27
文章分类

全部博文(351)

文章存档

2013年(1)

2012年(4)

2011年(7)

2010年(16)

2009年(34)

2008年(34)

2007年(34)

2006年(68)

2005年(82)

2004年(71)

分类: LINUX

2006-08-13 17:08:26

这几天调试kernel bug总是觉得不顺手,想找一些比较好的调试方法。 用了lkcd(Linux Kernel Crash Dump)感觉真的不错.

安装环境
OS: Debian testing, linux-2.6.16.18
gcc: gcc (GCC) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)

安装步骤:
1。下载软件包, linux-2.6.9.tar.bz2, lkcd-6.1.0_2.6.9.patch.gz和lkcdutils-6.1.0.tar.gz
下载地址:

2. 给kernel 打patch
patch -p1 < lkcd-6.1.0_2.6.9.patch

3。编译内核
由于使用的是4.0的gcc,编译除了不少错,具体错误和解决办法可以看附录1。


4.安装lkcdutils
按照doc/lkcd_tutorial.pdf中的步骤
在安装lkcdutils过程中除了不少错误,安装了libelfg0-dev之后好像就好了

5./sbin/lkcd config
报gethostbyname错
看了不少文档,最后发现是配置错了,
最后配置文件如下:
/etc/sysconfig/dump
DUMP_ACTIVE="1"
DUMPDEV="/dev/vmdump"
DUMPDIR="/var/log/dump"
DUMP_LEVEL="2"
DUMP_COMPRESS="2"
DUMP_FLAGS="0x80000000"
DUMP_SAVE="1"
PANIC_TIMEOUT="5"
BOUNDS_LIMIT=10
KEXEC_IMAGE=/boot/vmlinuz
KEXEC_CMDLINE="root console=tty0"
TARGET_HOST="localhost"
TARGET_PORT=6688
SOURCE_PORT=6688


附录1 使用gcc4编译2.6.9。
drivers/char/sx.c:2371: warning: passing argument 1 of 'readl' makes pointer from integer without a cast
drivers/char/sx.c:2374: warning: passing argument 2 of 'writel' makes pointer from integer without a cast
  CC [M]  drivers/char/generic_serial.o
drivers/char/generic_serial.c:37: error: static declaration of 'gs_debug' follows non-static declaration
include/linux/generic_serial.h:95: error: previous declaration of 'gs_debug' was here
drivers/char/generic_serial.c: In function 'gs_init_port':
drivers/char/generic_serial.c:920: warning: pointer targets in assignment differ in signedness
make[2]: *** [drivers/char/generic_serial.o] Error 1
make[1]: *** [drivers/char] Error 2
make: *** [drivers] Error 2
[root@debian-server linux-2.6.9]$

删除include/linux/generic_serial.h:95的 static


  CC [M]  drivers/char/scx200_gpio.o
In file included from drivers/char/scx200_gpio.c:17:
include/linux/scx200_gpio.h: In function 'scx200_gpio_set_high':
include/linux/scx200_gpio.h:48: warning: pointer targets in passing argument 2 of 'set_bit' differ in signedness
include/linux/scx200_gpio.h: In function 'scx200_gpio_set_low':
include/linux/scx200_gpio.h:59: warning: pointer targets in passing argument 2 of 'clear_bit' differ in signedness
include/linux/scx200_gpio.h: In function 'scx200_gpio_set':
include/linux/scx200_gpio.h:71: warning: pointer targets in passing argument 2 of 'set_bit' differ in signedness
include/linux/scx200_gpio.h:73: warning: pointer targets in passing argument 2 of 'clear_bit' differ in signedness
include/linux/scx200_gpio.h: In function 'scx200_gpio_change':
include/linux/scx200_gpio.h:83: warning: pointer targets in passing argument 2 of 'change_bit' differ in signedness
  GEN     drivers/eisa/devlist.h
  CC      drivers/eisa/eisa-bus.o
cc1: warnings being treated as errors
drivers/eisa/eisa-bus.c:421: warning: pointer targets in initialization differ in signedness
drivers/eisa/eisa-bus.c:422: warning: pointer targets in initialization differ in signedness
make[2]: *** [drivers/eisa/eisa-bus.o] Error 1
make[1]: *** [drivers/eisa] Error 2

去掉isa的编译

In file included from drivers/i2c/algos/i2c-algo-bit.c:31:
include/linux/i2c.h:58: error: array type has incomplete element type
include/linux/i2c.h:205: error: array type has incomplete element type
drivers/i2c/algos/i2c-algo-bit.c: In function 'sendbytes':
drivers/i2c/algos/i2c-algo-bit.c:337: warning: pointer targets in initialization differ in signedness
drivers/i2c/algos/i2c-algo-bit.c: In function 'readbytes':
drivers/i2c/algos/i2c-algo-bit.c:370: warning: pointer targets in initialization differ in signedness
make[3]: *** [drivers/i2c/algos/i2c-algo-bit.o] Error 1
make[2]: *** [drivers/i2c/algos] Error 2
make[1]: *** [drivers/i2c] Error 2
make: *** [drivers] Error 2
[root@debian-server linux-2.6.9]$

修改代码
struct i2c_msg msg[]
改成
struct i2c_msg *msg




  CC [M]  drivers/video/aty/atyfb_base.o
In file included from drivers/video/aty/atyfb_base.c:59:
include/linux/fb.h:751: error: array type has incomplete element type
In file included from drivers/video/aty/atyfb_base.c:69:
drivers/video/aty/atyfb.h: In function 'aty_ld_le32':
drivers/video/aty/atyfb.h:136: warning: passing argument 1 of 'readl' makes pointer from integer without a cast
drivers/video/aty/atyfb.h: In function 'aty_st_le32':
drivers/video/aty/atyfb.h:150: warning: passing argument 2 of 'writel' makes pointer from integer without a cast
drivers/video/aty/atyfb.h: In function 'aty_ld_8':
drivers/video/aty/atyfb.h:162: warning: passing argument 1 of 'readb' makes pointer from integer without a cast
drivers/video/aty/atyfb.h: In function 'aty_st_8':
drivers/video/aty/atyfb.h:176: warning: passing argument 2 of 'writeb' makes pointer from integer without a cast
make[3]: *** [drivers/video/aty/atyfb_base.o] Error 1
make[2]: *** [drivers/video/aty] Error 2
make[1]: *** [drivers/video] Error 2
make: *** [drivers] Error 2


去除frame buffer的编译



drivers/dump/dump_overlay.c:424: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigne
d int'
drivers/dump/dump_overlay.c: In function 'dump_passthru_add_data':
drivers/dump/dump_overlay.c:791: error: 'struct page' has no member named 'count'
make[2]: *** [drivers/dump/dump_overlay.o] Error 1
make[1]: *** [drivers/dump] Error 2


drivers/dump/dump_overlay.c:424: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigne
d int'
drivers/dump/dump_overlay.c: In function 'dump_passthru_add_data':
drivers/dump/dump_overlay.c:791: error: invalid type argument of '->'
make[2]: *** [drivers/dump/dump_overlay.o] Error 1
make[1]: *** [drivers/dump] Error 2
make: *** [drivers] Error 2


注视掉了这一行:

//printk("Page count 0x%x\n", page_count(page->count));




阅读(5840) | 评论(6) | 转发(0) |
0

上一篇: 河边的苹果

下一篇:不要拒绝

给主人留下些什么吧!~~