• «
  • 1
  • 2
  • 3
  • »
  • Pages: 1/3     Go
主题 : KGDB 调试 Tiny210 V2 内核( 3.0.8 ) 复制链接 | 浏览器收藏 | 打印
级别: 骑士
UID: 5844
精华: 9
发帖: 62
金钱: 760 两
威望: 152 点
贡献值: 9 点
综合积分: 304 分
注册时间: 2009-05-11
最后登录: 2016-11-28
楼主  发表于: 2012-12-10 20:01

 KGDB 调试 Tiny210 V2 内核( 3.0.8 )

管理提醒: 本帖被 qq2440 设置为精华(2012-12-11)
图片:


1. 参考资料
------------------------------
碰到问题在查找资料的过程中,发现下面的资料还是很有用的:
http://en.wikipedia.org/wiki/KGDB
https://kgdb.wiki.kernel.org
http://kernel.org/pub/linux/kernel/people/jwessel/kdb/
http://comments.gmane.org/gmane.linux.kernel.samsung-soc/9477
http://blog.csdn.net/mayaoyao11/article/details/6636977
http://git.kernel.org/?p=utils/kernel/kgdb/agent-proxy.git;a=summary

2. 初衷
------------------------------
    原本是想要了解 Tiny210 V2 开发板的 OpenGL 如何保存 图像数据,以及他们和 framebuffer 之
间的关系的。 虽然 内核中有 SGX540 的驱动源代码,但是要看懂这些源代码太费时间了,想要一种更加简便
的方法提高效率。
    很久以前用过kgdb调试内核,于是就想尝试一下kgdb是否可以。通过单步执行,查看代码的执行过程,并
且查看过程中各种变量的数据,这绝对是快速理解的绝佳途径。
    实现KGDB调试内核的过程遇到很多问题,这个过程就省略了,重点分享一下需要注意的地方。

3. 串口通信
------------------------------
    KGDB 在 ARM 平台下,如果想要 break 内核,是通过执行一个 非法指令, 产生 exception 从而
进入到 KGDB 的处理函数中的, 因此我理解 KGDB 是工作在中断状态下。
    通过PC 上的 gdb 链接到 开发板的 KGDB,在我的环境中,是通过交叉串口线(NULL-MODERM)链接
的,就是开发板自带的那个串口线。而KGDB和GDB之间是需要通信的,这个通信数据就是通过串口线传输的。
    也就是说,工作在中断状态下的KGDB需要和远程的gdb通信,而通常外设通信是通过中断发送或者接受数
据,但KGDB已经在中断状态下了,如果可以中断嵌套的话,我不知到内核是否支持,但是这个绝对是一个很复杂
的事情,并且容易出错,因此KGDB需要串口能够提供不许要使用中断就能够发送和接收数据的能力。
    在KGDB的官方资料中也提到了,串口的 file operations 需要提供如下两个接口:
    .poll_get_char,
    .poll_put_char,
    这两个接口就是用来通过直接读取串口的状态位判断是否有数据收到->读取数据;发送数据->读取发送成
功状态;反正就是不是用中断发送和接受数据。

4. s5pv210-uart
------------------------------
    三星提供的UART驱动中,没有实现 poll_get_char 和 poll_put_char 这两个接口。幸运的是网上
已经有人实现了,因为很好利用了已有的实现,因此修改的代码并不多。
    在 http://comments.gmane.org/gmane.linux.kernel.samsung-soc/9477 这里是有人针对
mini2440修改的代码,我比较了一下,这部分修改的代码和 tiny210 v2 的 3.0.8 内核中的驱动几乎是
一样的。可以直接将那个补丁打到 3.0.8 的内核上。
    但是需要注意一下, 原 patch 中:
        +console_initcall(s3c24xx_serial_console_init);
    这一行需要注释掉,因为 drivers/tty/serial/s5pv210.c 已经有了:
        console_initcall(s5pv210_serial_console_init);
    而 s5pv210_serial_console_init 会 调用 s3c24xx_serial_console_init。
    所以如果不删除那一行的话, 内核启动过程中会出错,导致不停的 reset。
    修改后的patch参考最后部分。


5. 改变串口的启动顺序1
------------------------------
    我的初衷是确认 s3cfb 启动中关于 framebuffer 部分内容的,因此,需要 s3cfb 初始化之前就能
够使用KGDB调试内核。也就是说 KGDB 和 serial 都要先启动。

6. kgdboc 和 ekgdboc
------------------------------
    如果想要在内核启动过程中就自己暂停下来,等待PC上的gdb链接过来的话,通常需要设置内核参数
kgdbwait。而 kgdboc 是 KGDB over console ? 的意思吧,也就是设置串口信息的。在我机器上的内核
启动参数是这么设置的:(只有KGDB部分)
    console=ttySAC0,115200 ekgdboc=ttySAC0,115200 kgdbwait
    与 kgdboc 对应的是 kgdboe, over ethernet,是通过网络远程链接KGDB的,不过目前内核中没
有这个部分,很久以前,需要自己手动打patch的那个KGDB是有的。
    kgdboc 的处理时机比较靠后,是在 serial 初始化完成以后,因此想要更早的调试内核,可以使用
ekgdboc 这个参数, e 是 early 的意思。
    在上面提到的文档中, ekgdboc 传递的参数是 kdb,但查看源代码发现 ekgdboc 的处理和 kgdboc
是一样的,应该传递 ttySAC0,115200。
    在我机器上, 内核启动参数是这样的:
    root=/dev/mtdblock4 console=ttySAC0,115200 init=/linuxrc skipcali=yes ctp=1 ekgdboc=ttySAC0,115200 kgdbwait earlyprintk lcd=S70
    虽然传递了 ekgdboc 参数给内核,但由于太早了,KGDB通过tty去查找可以poll的 serial driver
的时候, char dev 子系统好像还没有初始化呢,因此 KGDB 不会让内核停下来。
    这时候,就只剩下唯一的办法了,不能特别早,但让 serial 和 KGDB 早于 s3cfb 就行啊。

7. 改变串口的启动顺序2
------------------------------
    参考 http://blog.csdn.net/mayaoyao11/article/details/6636977 这个链接。大致意思是
虽然各个模块都有初始化函数,但这个初始化函数通过链接脚本,将函数指针放在统一的启动顺序表格中,内核已
经定义了都有哪些表格。比如 console_initcall(s5pv210_serial_console_init)。
    这个表格其实是一个大分类,大致意思是 console_initcall 和 device_initcall 谁先谁后,但
如果都是 device_initcall 的话,哪又是谁先谁后呢?我想这个应该是按照传递给 连接器的顺序来进行的吧。
    我是需要改变 serial 和 s3cfb 的启动顺序,因此通过改变他们在 Makefile 中的顺序应该就可以
了。
    serial 属于 drivers/tty 目录, s3cfb 属于 drivers/video 目录,内核默认配置中,
video 是在 tty 上面, 我猜测可能是由于 framebuffer console 的原因 -- 将console输出
到framebuffer, 因此需要先初始化 video,然后才是 tty。
    为了避免framebuffer console导致问题出现,干脆禁用这个机能:
    # CONFIG_FRAMEBUFFER_CONSOLE is not set
    另外,将 drivers/Makefile 中,将 obj-y += video/ 放到  obj-y += char 的下面。

8. KGDB的内核启动参数
------------------------------
    Tiny210v2提供的内核默认是没有KGDB的,因此需要重新编译内核,内核的配置文件 .config 中,也
需要添加 KGDB 的配置内容:
    CONFIG_FRAME_POINTER=y
    CONFIG_KGDB=y
    CONFIG_KGDB_SERIAL_CONSOLE=y
    
    需要注意, KGDB 的官方文档中,提及需要 disable CONFIG_DEBUG_RODATA :
     # CONFIG_DEBUG_RODATA is not set
    但在 3.0.8 内核中,已经没有这个配置项了,因此可以忽略。

    重新编译完内核以后,将新的内核以及内核参数,通过 supperboot 写入 flash。

9. agent-proxy
------------------------------
    Tiny210V2 的 UART 口,我这边只有 COM1 好用, COM3 不清楚是电压的原因还是内核中驱动的原因
不能和PC通信,因此就只有一个UART口可用了。即需要用这个UART口进行gdb通信,也需要通过它登录到终端。
    agent-proxy 就是用来干这个的, 它运行在PC上,具体方法,参考它的说明文档。
    你可以从这里下载:
    http://git.kernel.org/?p=utils/kernel/kgdb/agent-proxy.git;a=summary
    
    需要注意一点,因为 gdb 和 console 都是走 uart,因此 console 中能够看到 gdb 和 KGDB 通信
的数据,这是正常的。

10. gdb版本
------------------------------
    上面的修改完成后,已经可以在 framebuffer 初始化之前,就让 kernel 暂停下来等待 gdb 链接了。
理论上已经成功了。 但在用gdb 调试的阶段发现单步调试的时候,内核源代码串行非常厉害,已经影响到正常
的调试了。除非使用 nexti 或者 stepi ,但谁愿意用汇编语言调试呢。
    经过一系列的确认,发现原来是我的gdb版本太低导致。 我的 tollchain 是用 cross-ng 生成的,它
只有 gdb-6.8 一个可用, 下了一个 gdb-7.5 自己编译成 arm 的,就好用了,那是相当好用啊!!调试内
核和调试应用程序一个体验。

11. 总结
------------------------------
    1. 串口实现 poll_get_char / poll_put_char。
    2. 依据需要,将 KGDB 和 serial 提前到 需要调试的模块之前启动。
    3. 重新编译内核,并启用KGDB。
    4. 正确设置 内核启动参数。
    5. 考虑使用 agent-proxy。
    6. 高版本的 gdb。

12. 稍加修改的串口poll的patch
------------------------------
---
drivers/tty/serial/samsung.c |   50 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index f96f37b..9f703ca 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -877,11 +877,24 @@ s3c24xx_serial_verify_port(struct uart_port *port, struct serial_struct *ser)

static struct console s3c24xx_serial_console;

+static int __init s3c24xx_serial_console_init(void)
+{
+    register_console(&s3c24xx_serial_console);
+    return 0;
+}

#define S3C24XX_SERIAL_CONSOLE &s3c24xx_serial_console
#else
#define S3C24XX_SERIAL_CONSOLE NULL
#endif

+#ifdef CONFIG_CONSOLE_POLL
+static int s3c24xx_serial_get_poll_char(struct uart_port *port);
+static void s3c24xx_serial_put_poll_char(struct uart_port *port,
+             unsigned char c);
+#endif
+
static struct uart_ops s3c24xx_serial_ops = {
     .pm        = s3c24xx_serial_pm,
     .tx_empty    = s3c24xx_serial_tx_empty,
@@ -900,6 +913,10 @@ static struct uart_ops s3c24xx_serial_ops = {
     .request_port    = s3c24xx_serial_request_port,
     .config_port    = s3c24xx_serial_config_port,
     .verify_port    = s3c24xx_serial_verify_port,
+#ifdef CONFIG_CONSOLE_POLL
+    .poll_get_char = s3c24xx_serial_get_poll_char,
+    .poll_put_char = s3c24xx_serial_put_poll_char,
+#endif
};

static struct uart_driver s3c24xx_uart_drv = {
@@ -1311,6 +1328,39 @@ s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon)
     return (utrstat & S3C2410_UTRSTAT_TXE) ? 1 : 0;
}

+#ifdef CONFIG_CONSOLE_POLL
+/*
+ * Console polling routines for writing and reading from the uart while
+ * in an interrupt or debug context.
+ */
+
+static int s3c24xx_serial_get_poll_char(struct uart_port *port)
+{
+    struct s3c24xx_uart_port *ourport = to_ourport(port);
+    unsigned int ufstat, count;
+
+    do {
+        ufstat = rd_regl(port, S3C2410_UFSTAT);
+        count = s3c24xx_serial_rx_fifocnt(ourport, ufstat);
+        if (!count)
+            cpu_relax();
+    } while (!count);
+
+    return rd_regb(port, S3C2410_URXH);
+}
+
+static void s3c24xx_serial_put_poll_char(struct uart_port *port,
+        unsigned char c)
+{
+    unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
+
+    while (!s3c24xx_serial_console_txrdy(port, ufcon))
+        cpu_relax();
+    wr_regb(cons_uart, S3C2410_UTXH, c);
+}
+
+#endif /* CONFIG_CONSOLE_POLL */
+
static void
s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
{
--

13. 附加一个内核启动log,内核源代码有一点小修改,另外针对log写了一点注释:
------------------------------
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.0.8-FA-HD (zoulz@Seagate) (gcc version 4.5.3 (crosstool-NG 1.16.0 - S5PV210) ) #26 PREEMPT Mon Dec 10 10:52:57 CST 2012
[    0.000000] CPU: ARMv7 Processor [412fc082] revision 2 (ARMv7), cr=10c53c7f
[    0.000000] CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: MINI210
[    0.000000] kgdboc: +kgdboc_early_init(ttySAC0,115200)
[    0.000000] kgdboc: +kgdboc_option_setup(ttySAC0,115200)
[    0.000000] kgdboc: -kgdboc_option_setup(ttySAC0,115200)
[    0.000000] kgdboc: +init_kgdboc()
[    0.000000] kgdboc: +configure_kgdboc()
[    0.000000] kgdboc: +kgdboc_option_setup(ttySAC0,115200)
[    0.000000] kgdboc: -kgdboc_option_setup(ttySAC0,115200)
[    0.000000] kgdboc: +tty_find_polling_driver( ttySAC0,115200 0 )
[    0.000000] kgdboc: -tty_find_polling_driver() return   (null)
[    0.000000] kgdboc: *configure_kgdboc() : tty_find_polling_driver failed
[    0.000000] kgdboc: -configure_kgdboc() : noconfig
[    0.000000] kgdboc: -init_kgdboc()
[    0.000000] kgdboc: -kgdboc_early_init(ttySAC0,115200)
[    0.000000] kgdboc: +opt_kgdb_wait()
[    0.000000] kgdboc: -opt_kgdb_wait()

内核参数 ekgdboc 导致的试图让 kgdb 暂停内核失败,因为串口还没有初始化。

[    0.000000] MINI210: S70 selected
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] CPU S5PV210/S5PC110 (id 0x43110220)
[    0.000000] s5pv210_init_clocks: initializing clocks
[    0.000000] S3C24XX Clocks, Copyright 2004 Simtec Electronics
[    0.000000] s5pv210_setup_clocks: registering clocks
[    0.000000] s5pv210_setup_clocks: clkdiv0 = 14131440, clkdiv1 = 00000400
[    0.000000] s5pv210_setup_clocks: xtal is 24000000
[    0.000000] S5PV210: PLL settings, A=1000000000, M=667000000, E=80000000 V=54000000
[    0.000000] S5PV210: ARMCLK=1000000000, HCLKM=200000000, HCLKD=166750000
[    0.000000] HCLKP=133400000, PCLKM=100000000, PCLKD=83375000, PCLKP=66700000
[    0.000000] sclk_dmc: source is sclk_a2m (0), rate is 200000000
[    0.000000] sclk_onenand: source is hclk_dsys (1), rate is 166750000
[    0.000000] uclk1: source is mout_mpll (6), rate is 66700000
[    0.000000] uclk1: source is mout_mpll (6), rate is 66700000
[    0.000000] uclk1: source is mout_mpll (6), rate is 66700000
[    0.000000] uclk1: source is mout_mpll (6), rate is 66700000
[    0.000000] sclk_mixer: source is sclk_dac (0), rate is 54000000
[    0.000000] sclk_fimc: source is ext_xtal (0), rate is 24000000
[    0.000000] sclk_fimc: source is ext_xtal (0), rate is 24000000
[    0.000000] sclk_fimc: source is ext_xtal (0), rate is 24000000
[    0.000000] sclk_cam0: source is ext_xtal (0), rate is 24000000
[    0.000000] sclk_cam1: source is ext_xtal (0), rate is 24000000
[    0.000000] sclk_fimd: source is ext_xtal (0), rate is 24000000
[    0.000000] sclk_mmc: source is mout_epll (7), rate is 80000000
[    0.000000] sclk_mmc: source is mout_epll (7), rate is 80000000
[    0.000000] sclk_mmc: source is mout_epll (7), rate is 80000000
[    0.000000] sclk_mmc: source is mout_epll (7), rate is 80000000
[    0.000000] sclk_mfc: source is sclk_a2m (0), rate is 200000000
[    0.000000] sclk_g2d: source is sclk_a2m (0), rate is 200000000
[    0.000000] sclk_g3d: source is sclk_a2m (0), rate is 200000000
[    0.000000] sclk_csis: source is ext_xtal (0), rate is 24000000
[    0.000000] sclk_spi: source is ext_xtal (0), rate is 24000000
[    0.000000] sclk_spi: source is ext_xtal (0), rate is 24000000
[    0.000000] sclk_pwi: source is ext_xtal (0), rate is 24000000
[    0.000000] sclk_pwm: source is ext_xtal (0), rate is 24000000
[    0.000000] s5p: 36864 kbytes system memory reserved for mfc at 0x2dc00000, 0-bank base(0x2dc00000)
[    0.000000] s5p: 36864 kbytes system memory reserved for mfc at 0x3dbf5000, 1-bank base(0x3dbf5000)
[    0.000000] s5p: 6144 kbytes system memory reserved for fimc0 at 0x3d5f5000, 1-bank base(0x3d5f5000)
[    0.000000] s5p: 16 kbytes system memory reserved for fimc1 at 0x3d5f1000, 1-bank base(0x3d5f1000)
[    0.000000] s5p: 6144 kbytes system memory reserved for fimc2 at 0x3cff1000, 1-bank base(0x3cff1000)
[    0.000000] s5p: 8192 kbytes system memory reserved for jpeg at 0x2d400000, 0-bank base(0x2d400000)
[    0.000000] s5p: 13060 kbytes system memory reserved for fimd at 0x3c330000, 1-bank base(0x3c330000)
[    0.000000] s5p: 8192 kbytes system memory reserved for g2d at 0x2cc00000, 0-bank base(0x2cc00000)
[    0.000000] On node 0 totalpages: 102203
[    0.000000]   Normal zone: 1024 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 101179 pages, LIFO batch:31
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 101179
[    0.000000] Kernel command line: root=/dev/mtdblock4 console=ttySAC0,115200 init=/linuxrc skipcali=yes ctp=1 ekgdboc=ttySAC0,115200 kgdbwait earlyprintk lcd=S70
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 204MB 195MB 0MB = 399MB total
[    0.000000] Memory: 396796k/512272k available, 12016k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     DMA     : 0xff000000 - 0xffe00000   (  14 MB)
[    0.000000]     vmalloc : 0xe0800000 - 0xfd000000   ( 456 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .init : 0xc0008000 - 0xc0033000   ( 172 kB)
[    0.000000]       .text : 0xc0033000 - 0xc06aa3a8   (6621 kB)
[    0.000000]       .data : 0xc06ac000 - 0xc06f9f80   ( 312 kB)
[    0.000000]        .bss : 0xc06f9fa4 - 0xc0741c60   ( 288 kB)
[    0.000000] SLUB: Genslabs=11, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:393
[    0.000000] VIC @fd000000: id 0x00041192, vendor 0x41
[    0.000000] VIC @fd010000: id 0x00041192, vendor 0x41
[    0.000000] VIC @fd020000: id 0x00041192, vendor 0x41
[    0.000000] VIC @fd030000: id 0x00041192, vendor 0x41
[    0.000000] mult[140737]
[    0.000000] max_delta_ns[2937815369]
[    0.000000] min_delta_ns[30517]
[    0.000000] rate[32768]
[    0.000000] HZ[256]
[    0.000000] Console: colour dummy device 80x30
[    0.000000] s3c24xx: call s5pv210_serial_console_init
[    0.000000] console [ttySAC0] enabled
[    0.000000] kgdboc: +s5pv210_ttysac0_gdboc_init()
[    0.000000] kgdboc: +kgdboc_early_init(ttySAC0,115200)
[    0.000000] kgdboc: +kgdboc_option_setup(ttySAC0,115200)
[    0.000000] kgdboc: -kgdboc_option_setup(ttySAC0,115200)
[    0.000000] kgdboc: +init_kgdboc()
[    0.000000] kgdboc: +configure_kgdboc()
[    0.000000] kgdboc: +kgdboc_option_setup(ttySAC0,115200)
[    0.000000] kgdboc: -kgdboc_option_setup(ttySAC0,115200)
[    0.000000] kgdboc: +tty_find_polling_driver( ttySAC0,115200 0 )
[    0.000000] kgdboc: -tty_find_polling_driver() return   (null)
[    0.000000] kgdboc: *configure_kgdboc() : tty_find_polling_driver failed
[    0.000000] kgdboc: -configure_kgdboc() : noconfig
[    0.000000] kgdboc: -init_kgdboc()
[    0.000000] kgdboc: -kgdboc_early_init(ttySAC0,115200)
[    0.000000] kgdboc: -s5pv210_ttysac0_gdboc_init()

内核参数 console=XXX 导致的 kgdb 企图暂停内核,但由于 tty 系统还没有初始化,所以失败。

[    0.595483] Calibrating delay loop... 994.84 BogoMIPS (lpj=1941504)
[    0.621040] pid_max: default: 32768 minimum: 301
[    0.621229] Mount-cache hash table entries: 512
[    0.621577] Initializing cgroup subsys debug
[    0.621618] Initializing cgroup subsys cpuacct
[    0.621667] Initializing cgroup subsys freezer
[    0.623912] CPU: Testing write buffer coherency: ok
[    0.631593] print_constraints: dummy:
[    0.632625] NET: Registered protocol family 16
[    0.642337] S3C Power Management, Copyright 2004 Simtec Electronics
[    0.648804] fimd at 0x3c330000
[    0.648884] hsmmc0: sclk_mmc: source is mout_mpll, rate is 47642857
[    0.652617] hsmmc1: sclk_mmc: source is mout_mpll, rate is 47642857
[    0.658675] hsmmc2: sclk_mmc: source is mout_mpll, rate is 47642857
[    0.664902] hsmmc3: sclk_mmc: source is mout_mpll, rate is 47642857
[    0.672016] S5PV210: Initializing architecture
[    0.676243] s3c-adc s5pv210-adc: attached adc driver
[    0.680665] s3c24xx-pwm s3c24xx-pwm.0: tin at 66700000, tdiv at 66700000, tin=divclk, base 0
[    0.689302] print_constraints: pd_tv_supply: 5000 mV normal
[    0.694727] print_constraints: pd_lcd_supply: 5000 mV normal
[    0.700440] print_constraints: pd_g3d_supply: 5000 mV normal
[    0.706152] print_constraints: pd_mfc_supply: 5000 mV normal
[    0.711878] print_constraints: pd_audio_supply: 5000 mV normal
[    0.740702] bio: create slab <bio-0> at 0
[    0.741737] SCSI subsystem initialized
[    0.743993] usbcore: registered new interface driver usbfs
[    0.744282] usbcore: registered new interface driver hub
[    0.744476] usbcore: registered new device driver usb
[    0.745035] s3c-i2c s3c2440-i2c.0: slave address 0x10
[    0.746978] s3c-i2c s3c2440-i2c.0: bus frequency set to 378 KHz
[    0.753509] s3c-i2c s3c2440-i2c.0: i2c-0: S3C I2C adapter
[    0.758298] s3c-i2c s3c2440-i2c.1: slave address 0x10
[    0.763281] s3c-i2c s3c2440-i2c.1: bus frequency set to 65 KHz
[    0.769321] s3c-i2c s3c2440-i2c.1: i2c-1: S3C I2C adapter
[    0.774489] s3c-i2c s3c2440-i2c.2: slave address 0x10
[    0.779470] s3c-i2c s3c2440-i2c.2: bus frequency set to 260 KHz
[    0.785742] s3c-i2c s3c2440-i2c.2: i2c-2: S3C I2C adapter
[    0.791293] Advanced Linux Sound Architecture Driver Version 1.0.24.
[    0.797616] Bluetooth: Core ver 2.16
[    0.800754] NET: Registered protocol family 31
[    0.805056] Bluetooth: HCI device and connection manager initialized
[    0.811358] Bluetooth: HCI socket layer initialized
[    0.816206] Bluetooth: L2CAP socket layer initialized
[    0.821240] Bluetooth: SCO socket layer initialized
[    0.826331] Switching to clocksource clock_source_systimer
[    0.831956] Switched to NOHz mode on CPU #0
[    0.847535] NET: Registered protocol family 2
[    0.847732] IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.848346] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[    0.854541] TCP bind hash table entries: 16384 (order: 6, 327680 bytes)
[    0.861063] TCP: Hash tables configured (established 16384 bind 16384)
[    0.867259] TCP reno registered
[    0.870356] UDP hash table entries: 256 (order: 1, 12288 bytes)
[    0.876273] UDP-Lite hash table entries: 256 (order: 1, 12288 bytes)
[    0.882840] NET: Registered protocol family 1
[    0.887157] RPC: Registered named UNIX socket transport module.
[    0.892851] RPC: Registered udp transport module.
[    0.897490] RPC: Registered tcp transport module.
[    0.902168] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.908688] PMU: registered new PMU device of type 0
[    0.913820] cpuidle: phy_regs_save:0x3bca3000
[    0.917991] Loaded driver for PL330 DMAC-0 s3c-pl330
[    0.922805]     DBUFF-64x8bytes Num_Chans-8 Num_Peri-2 Num_Events-32
[    0.928925] Loaded driver for PL330 DMAC-1 s3c-pl330
[    0.933819]     DBUFF-8x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32
[    0.939930] Loaded driver for PL330 DMAC-2 s3c-pl330
[    0.944807]     DBUFF-8x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32
[    0.959157] ashmem: initialized
[    0.973457] ROMFS MTD (C) 2007 Red Hat, Inc.
[    0.973725] yaffs: yaffs built Dec  8 2012 17:08:26 Installing.
[    0.973755] msgmni has been set to 774
[    0.974798] io scheduler noop registered
[    0.974835] io scheduler deadline registered
[    0.974925] io scheduler cfq registered (default)
[    0.974966] start plist test
[    0.980848] end plist test
[    0.986149] s5pv210-uart.0: ttySAC0 at MMIO 0xe2900000 (irq = 16) is a S3C6400/10
[    0.995757] s5pv210-uart.1: ttySAC1 at MMIO 0xe2900400 (irq = 20) is a S3C6400/10
[    1.003557] s5pv210-uart.2: ttySAC2 at MMIO 0xe2900800 (irq = 24) is a S3C6400/10
[    1.011368] s5pv210-uart.3: ttySAC3 at MMIO 0xe2900c00 (irq = 28) is a S3C6400/10
[    1.019246] kgdboc: +init_kgdboc()
[    1.019278] kgdboc: +configure_kgdboc()
[    1.019312] kgdboc: +kgdboc_option_setup(ttySAC0,115200)
[    1.022607] kgdboc: -kgdboc_option_setup(ttySAC0,115200)
[    1.027932] kgdboc: +tty_find_polling_driver( ttySAC0,115200 0 )
[    1.033893] kgdboc: *tty_find_polling_driver() compare ttySAC0,115200 - ttySAC
[    1.041194] kgdboc: -tty_find_polling_driver() return dbcce6c0
[    1.047060] kgdboc: +kgdb_register_io_module()
[    1.051477] kgdb: Registered I/O driver kgdboc.
[    1.055994] kgdboc: +kgdb_register_callbacks()
[    1.060489] kgdboc: *kgdb_register_callbacks(): kgdb_arch_init
[    1.066382] kgdboc: +kgdb_arch_init()
[    1.070109] kgdboc: -kgdb_arch_init():
[    1.073921] kgdboc: *kgdb_register_callbacks(): register_sysrq_key : 'g'
[    1.080681] kgdboc: -kgdb_register_callbacks()
[    1.085186] kgdb: Waiting for connection from remote gdb...

这是 tty 系统初始化完了以后, kgdb 才能正常暂停内核,因为修改了 s3cfb 和 serial 的启动顺序,
所以就可以调试下面的 s3cfb_probe 函数了。

[  144.792126] kgdboc: -kgdb_register_io_module()
[  144.792167] kgdboc: -configure_kgdboc(): do_register
[  144.792208] kgdboc: -init_kgdboc()
[  144.792695] leds    initialized
[  144.792880] pwm    initialized
[  144.793079] mini210-adc    initialized
[  144.793370] backlight    initialized
[  311.794414] INFO: task kinteractiveup:449 blocked for more than 120 seconds.
[  311.794474] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  311.794539] kinteractiveup  D c04ca8a4     0   449      2 0x00000000
[  311.794628] [<c04ca8a4>] (__schedule+0x358/0x3a4) from [<c006fe2c>] (kthread+0x6c/0x8c)
[  311.862068] [<c006fe2c>] (kthread+0x6c/0x8c) from [<c0039ddc>] (kernel_thread_exit+0x0/0x8)
[  438.611651] INFO: task kinteractiveup:449 blocked for more than 120 seconds.
[  438.611710] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  438.611774] kinteractiveup  D c04ca8a4     0   449      2 0x00000000
[  438.611844] [<c04ca8a4>] (__schedule+0x358/0x3a4) from [<c006fe2c>] (kthread+0x6c/0x8c)
[  439.184085] [<c006fe2c>] (kthread+0x6c/0x8c) from [<c0039ddc>] (kernel_thread_exit+0x0/0x8)
[  485.973774] [s3cfb]pixclock: 31646
[  499.610097] [s3cfb]pixclock: 31646
[  507.315827] [s3cfb]pixclock: 31646
[  507.316250] [s3cfb]win 2: pmem_start=0x3c795000
[  507.316292] [s3cfb][fb2] dma: 0x3c795000, cpu: 0xe1000000, size: 0x0085c000
[  507.322430] [s3cfb]pixclock: 31646
[  507.322439] [s3cfb]pixclock: 31646
[  507.322669] [s3cfb][fb2] check_var
[  507.322677] [s3cfb][fb2] set_par
[  507.332858] FIMD src sclk = 166750000
[  507.332925] [s3cfb]registered successfully
[  507.333888] PA FB = 0x3C795000, bits per pixel = 32
[  507.333933] screen width=800 height=480 va=0xdc795000 pa=0x3c795000
[  507.333987] xres_virtual = 800, yres_virtual = 1440, xoffset = 0, yoffset = 0
[  507.336543] fb_size=8765440
[  507.339351] Back frameBuffer[0].VAddr=dc90c000 PAddr=3c90c000 size=1536000
[  507.346146] Back frameBuffer[1].VAddr=dca83000 PAddr=3ca83000 size=1536000
[  507.353014] Video Y Buffer[0].VAddr=dcbfa000 PAddr=3cbfa000 size=921600
[  507.359576] Video Y Buffer[1].VAddr=dccdb000 PAddr=3ccdb000 size=921600
[  507.366161] Video Y Buffer[2].VAddr=dcdbc000 PAddr=3cdbc000 size=921600
[  507.372750] Video UV Buffer[0].VAddr=dce9d000 PAddr=3ce9d000 size=462848
[  507.379418] Video UV Buffer[1].VAddr=dcf0e000 PAddr=3cf0e000 size=462848
[  507.386093] Video UV Buffer[2].VAddr=dcf7f000 PAddr=3cf7f000 size=462848
[  507.399654] brd: module loaded
[  507.403322] loop: module loaded
[  507.404447] S3C NAND Driver, (c) 2008 Samsung Electronics
[  507.507749] MLC nand initialized, 2012 ported by FriendlyARM
[  507.507800] S3C NAND Driver is using hardware ECC.
[  507.507879] NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5 (Samsung NAND 2GiB 3,3V 8-bit)
[  507.507957] Creating 5 MTD partitions on "s5pv210-nand":
[  507.509587] 0x0000000c0000-0x000000100000 : "misc"
[  507.515561] 0x000000100000-0x000000600000 : "recovery"
[  507.521270] 0x000000600000-0x000000b00000 : "kernel"
[  507.526081] 0x000000b00000-0x000000e00000 : "ramdisk"
[  507.530901] 0x000000e00000-0x000080000000 : "system"
[  507.862315] PPP generic driver version 2.4.2
[  507.862637] PPP Deflate Compression module registered
[  507.862682] PPP BSD Compression module registered
[  507.863186] PPP MPPE Compression module registered
[  507.863231] NET: Registered protocol family 24
[  507.864688] tun: Universal TUN/TAP device driver, 1.6
[  507.868326] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[  507.874562] dm9000 Ethernet Driver, V1.31
[  507.879635] eth0: dm9000a at e0838000,e083c00c IRQ 39 MAC: 08:90:00:a0:02:10 (platform data)
[  507.887022] sdhci: Secure Digital Host Controller Interface driver
[  507.892953] sdhci: Copyright(c) Pierre Ossman
[  507.897329] s3c-sdhci s3c-sdhci.0: clock source 0: hsmmc (133400000 Hz)
[  507.903863] s3c-sdhci s3c-sdhci.0: clock source 2: sclk_mmc (47642857 Hz)
[  507.910665] mmc0: no vmmc regulator found
[  507.914731] Registered led device: mmc0::
[  507.914914] mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0] using ADMA
[  507.921677] s3c-sdhci s3c-sdhci.1: clock source 0: hsmmc (133400000 Hz)
[  507.928218] s3c-sdhci s3c-sdhci.1: clock source 2: sclk_mmc (47642857 Hz)
[  507.934992] mmc1: no vmmc regulator found
[  507.941153] Registered led device: mmc1::
[  507.941318] mmc1: SDHCI controller on samsung-hsmmc [s3c-sdhci.1] using ADMA
[  507.946020] s3c-sdhci s3c-sdhci.2: clock source 0: hsmmc (133400000 Hz)
[  507.952564] s3c-sdhci s3c-sdhci.2: clock source 2: sclk_mmc (47642857 Hz)
[  507.962415] mmc2: no vmmc regulator found
[  507.963498] Registered led device: mmc2::
[  507.963675] mmc2: SDHCI controller on samsung-hsmmc [s3c-sdhci.2] using ADMA
[  507.970369] s3c-sdhci s3c-sdhci.3: clock source 0: hsmmc (133400000 Hz)
[  507.978917] s3c-sdhci s3c-sdhci.3: clock source 2: sclk_mmc (47642857 Hz)
[  507.983696] mmc3: no vmmc regulator found
[  507.987780] Registered led device: mmc3::
[  507.987977] mmc3: SDHCI controller on samsung-hsmmc [s3c-sdhci.3] using ADMA
[  507.997936] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[  508.001378] s5p-ehci s5p-ehci: S5P EHCI Host Controller
[  508.006423] s5p-ehci s5p-ehci: new USB bus registered, assigned bus number 1
[  508.015492] s5p-ehci s5p-ehci: irq 87, io mem 0xec200000
[  508.026969] s5p-ehci s5p-ehci: USB 0.0 started, EHCI 1.00
[  508.027591] hub 1-0:1.0: USB hub found
[  508.027764] hub 1-0:1.0: 1 port detected
[  508.035245] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[  508.037902] s5p-ohci s5p-ohci: EXYNOS OHCI Host Controller
[  508.043344] s5p-ohci s5p-ohci: new USB bus registered, assigned bus number 2
[  508.050339] s5p-ohci s5p-ohci: irq 87, io mem 0xec300000
[  508.113562] hub 2-0:1.0: USB hub found
[  508.113610] hub 2-0:1.0: 1 port detected
[  508.114372] usbcore: registered new interface driver usbserial
[  508.114424] usbserial: USB Serial Driver core
[  508.114461] Initializing USB Mass Storage driver...
[  508.114697] usbcore: registered new interface driver usb-storage
[  508.121991] USB Mass Storage support registered.
[  508.124687] s3c-udc : S3C HS USB Device Controller Driver, (c) 2008-2009 Samsung Electronics
[  508.124693] s3c-udc : version 15 March 2009 (DMA Mode)
[  508.143499] android_usb gadget: Mass Storage Function, version: 2009/09/11
[  508.144890] android_usb gadget: Number of LUNs=1
[  508.149552]  lun0: LUN: removable file: (no medium)
[  508.154640] android_usb gadget: android_usb ready
[  508.179628] Registered gadget driver 'android_usb'
[  508.179968] mousedev: PS/2 mouse device common for all mice
[  508.180698] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[  508.181441] touchscreen-1wire    initialized
[  508.181477] backlight-1wire    initialized
[  508.183840] setup_irq: ret = 0
[  508.186808] PWM clock = 66700000
[  508.190085] TCNT_FOR_SAMPLE_BIT = 3472, TCFG1 = 00000000
[  508.197681] input: fa_ts_input as /devices/virtual/input/input1
[  508.201714] ts-if    initialized
[  508.204468] S3C24XX RTC, (c) 2004,2006 Simtec Electronics
[  508.209658] s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
[  508.218184] s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
[  508.220576] s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
[  508.225919] s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
[  508.231370] s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
[  508.239272] using rtc device, s3c, for alarms
[  508.240981] s3c-rtc s3c64xx-rtc: rtc core: registered s3c as rtc0
[  508.247374] i2c /dev entries driver
[  508.251344] Linux video capture interface: v2.00
[  508.255379] mfc_init: <6>S5PC110 MFC Driver, (c) 2009 Samsung Electronics
[  508.255385]  
[  508.266250] S3C JPEG Driver, (c) 2007 Samsung Electronics
[  508.268871] JPEG driver for S5PV210
[  508.272936] i2c i2c-1: attached s5p_ddc into i2c adapter successfully
[  508.278887] S5PC11X HPD Driver, (c) 2010 Samsung Electronics
[  508.284740] S5PC11X CEC Driver, (c) 2010 Samsung Electronics
[  508.290903] usbcore: registered new interface driver uvcvideo
[  508.295734] USB Video Class driver (v1.1.0)
[  508.341638] input: mma7660 as /devices/platform/s3c2440-i2c.0/i2c-0/0-004c/input/input2
[  508.341908] mma7660 0-004c: MMA7660 device is probed successfully.
[  508.342079] i2c-core: driver [mma7660] using legacy suspend method
[  508.342132] i2c-core: driver [mma7660] using legacy resume method
[  508.345726] MMA7660 sensor driver registered.
[  508.350060] S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
[  508.356209] s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
[  508.364503] device-mapper: uevent: version 1.0.3
[  508.368607] device-mapper: ioctl: 4.20.0-ioctl (2011-02-02) initialised: dm-devel@redhat.com
[  508.376603] Bluetooth: HCI UART driver ver 2.2
[  508.380994] Bluetooth: HCI H4 protocol initialized
[  508.385763] Bluetooth: HCILL protocol initialized
[  508.390602] cpuidle: using governor ladder
[  508.394729] cpuidle: using governor menu
[  508.405150] usbcore: registered new interface driver usbhid
[  508.405200] usbhid: USB HID core driver
[  508.408995] ALSA device list:
[  508.410716]   No soundcards found.
[  508.414095] oprofile: hardware counters not available
[  508.419130] oprofile: using timer interrupt.
[  508.423466] GACT probability NOT on
[  508.426841] Mirror/redirect action on
[  508.430475] u32 classifier
[  508.433159]     Actions configured
[  508.436545] Netfilter messages via NETLINK v0.30.
[  508.441282] nf_conntrack version 0.5.0 (6199 buckets, 24796 max)
[  508.448099] ctnetlink v0.93: registering with nfnetlink.
[  508.452538] NF_TPROXY: Transparent proxy support initialized, version 4.1.0
[  508.459417] NF_TPROXY: Copyright (c) 2006-2007 BalaBit IT Ltd.
[  508.465567] xt_time: kernel timezone is -0000
[  508.471141] ip_tables: (C) 2000-2006 Netfilter Core Team
[  508.475007] arp_tables: (C) 2002 David S. Miller
[  508.479489] TCP cubic registered
[  508.483654] NET: Registered protocol family 10
[  508.491966] Mobile IPv6
[  508.492018] ip6_tables: (C) 2000-2006 Netfilter Core Team
[  508.495098] IPv6 over IPv4 tunneling driver
[  508.503581] NET: Registered protocol family 17
[  508.503646] NET: Registered protocol family 15
[  508.507998] Bluetooth: RFCOMM TTY layer initialized
[  508.512721] Bluetooth: RFCOMM socket layer initialized
[  508.517825] Bluetooth: RFCOMM ver 1.11
[  508.521552] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  508.526842] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[  508.532961] NET: Registered protocol family 35
[  508.537257] Registering the dns_resolver key type
[  508.541858] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 2
[  508.549456] ThumbEE CPU extension supported.
[  508.553912] s5pv210_cpufreq_init: S5PV210 cpu-freq driver
[  508.559664] regulator_init_complete: pd_mfc_supply: disabling
[  508.564801] regulator_init_complete: pd_tv_supply: disabling
[  508.570475] s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
[  508.575914] s3c-rtc s3c64xx-rtc: setting system clock to 2012-12-10 03:42:40 UTC (1355110960)
[  508.590281] FIMC0 registered successfully
[  508.591692] FIMC1 registered successfully
[  508.593774] FIMC2 registered successfully
[  508.596463] S5PC1XX TVOUT Driver, (c) 2009 Samsung Electronics
[  508.602697] s5p-tvout s5p-tvout: hpd status is cable removed
[  508.636366] usb 1-1: new high speed USB device number 2 using s5p-ehci
[  508.678494] VFS: could not find a valid V7 on mtdblock4.
[  508.691204] yaffs: dev is 32505860 name is "mtdblock4" rw
[  508.691250] yaffs: passed flags ""
[  508.691283] yaffs: yaffs: Attempting MTD mount of 31.4,"mtdblock4"
[  508.691294] yaffs: auto selecting yaffs2
[  508.773122] hub 1-1:1.0: USB hub found
[  508.773302] hub 1-1:1.0: 4 ports detected
[  509.000947] yaffs: block 3 is bad
[  509.001076] yaffs: block 4 is bad
[  509.111937] yaffs: block 377 is bad
[  510.389611] yaffs: yaffs_read_super: is_checkpointed 0
[  510.389650] VFS: Mounted root (yaffs filesystem) on device 31:4.
[  510.389750] Freeing init memory: 172K
[  511.626205] s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
[  511.687134] dm9000 dm9000: eth0: link down
[  511.687411] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 此帖被happyzlz在2012-12-10 22:03重新编辑 ]
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5407
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11054 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2012-12-10 21:33
解决了我一直想解决的一个问题,谢谢分享
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 侠客
UID: 81596
精华: 0
发帖: 61
金钱: 310 两
威望: 62 点
贡献值: 0 点
综合积分: 122 分
注册时间: 2012-11-11
最后登录: 2016-12-26
2楼  发表于: 2012-12-15 12:32
继续支持 大神的贡献
级别: 新手上路
UID: 83745
精华: 0
发帖: 3
金钱: 15 两
威望: 3 点
贡献值: 0 点
综合积分: 6 分
注册时间: 2012-12-11
最后登录: 2012-12-18
3楼  发表于: 2012-12-18 21:54
好样的,很棒啊,支持
级别: 新手上路
UID: 84032
精华: 0
发帖: 13
金钱: 65 两
威望: 13 点
贡献值: 0 点
综合积分: 26 分
注册时间: 2012-12-16
最后登录: 2013-01-15
4楼  发表于: 2012-12-29 21:57
这个厉害,记号一下。
级别: 新手上路
UID: 86557
精华: 0
发帖: 16
金钱: 80 两
威望: 16 点
贡献值: 0 点
综合积分: 32 分
注册时间: 2013-01-19
最后登录: 2016-06-20
5楼  发表于: 2013-07-07 00:46
这个要顶,太详细了。
级别: 禁止发言
UID: 99116
精华: 0
发帖: 55
金钱: 295 两
威望: 59 点
贡献值: 0 点
综合积分: 110 分
注册时间: 2013-12-18
最后登录: 2014-09-22
6楼  发表于: 2014-01-17 16:24
用户被禁言,该主题自动屏蔽!
级别: 新手上路
UID: 51491
精华: 0
发帖: 2
金钱: 10 两
威望: 2 点
贡献值: 0 点
综合积分: 4 分
注册时间: 2011-07-04
最后登录: 2014-08-11
7楼  发表于: 2014-08-11 16:39
能否向前辈请教一下KGDB的搭建过程?
我一直在用串口打印调试,很多时候不是很方便,所以想搭建KGDB但是看了很多文档还是没搞成。
级别: 新手上路
UID: 104297
精华: 0
发帖: 28
金钱: 140 两
威望: 28 点
贡献值: 0 点
综合积分: 56 分
注册时间: 2014-05-20
最后登录: 2017-02-16
8楼  发表于: 2014-09-04 17:20
ding !!!!!!!!!!!!!!
级别: 新手上路
UID: 125948
精华: 0
发帖: 4
金钱: 20 两
威望: 4 点
贡献值: 0 点
综合积分: 8 分
注册时间: 2016-06-15
最后登录: 2016-07-04
9楼  发表于: 2016-06-15 12:49
我有这能力就太好了
  • «
  • 1
  • 2
  • 3
  • »
  • Pages: 1/3     Go