如何在内核4.12.28上调试内核崩溃?

时间:2019-07-08 01:19:34

标签: linux-kernel kernel embedded-linux powerpc

我正在尝试调试嵌入式Linux内核4.12.28,这崩溃并显示内核崩溃。我在blocks / genhd.c里面放了一些打印件来打印disk_name。我看到它崩溃了-在为disk_name为“ ram0”的bdgt_disk获取“ bdget_disk”时。我正在使用Power PC架构。 我对应该如何解决此问题或如何调试感到有些困惑。我无法理解根本原因。我的理解是ram0就像系统初始启动所需的RAM磁盘。 initrd的内容将被复制到ram0进行引导。我不明白为什么会崩溃。我可以断定这与地址错误有关。但是真正的原因是什么以及如何 调试吗?

我的defconfig有-

CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=32768

内核恐慌日志是-

Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 16, base_baud = 19531250) is a 16550A
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 17, base_baud = 19531250) is a 16550A
console [ttyS1] enabled
console [ttyS1] enabled
bootconsole [udbg0] disabled
bootconsole [udbg0] disabled
Custom Debug..DEBUG: Passed bdget_disk 765
Custom Debug.. the disc name is ram0
Unable to handle kernel paging request for data at address 0x00005484
Faulting instruction address: 0xc0100154
Oops: Kernel access of bad area, sig: 11 [#1]
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 4.12.28-standard #1
task: df416a60 task.stack: df42a000
NIP: c0100154 LR: c011d158 CTR: c02bd990
REGS: df42bcb0 TRAP: 0300   Not tainted  (4.12.28-standard)
MSR: 00009032 <EE,ME,IR,DR,RI>
  CR: 242c0484  XER: 00000000
DAR: 00005484 DSISR: 20000000
GPR00: c02406bc df42bd60 df416a60 df407800 00000001 c011cb4c c011cb64 df42bd68
GPR08: 00000005 00000001 c0660000 00000000 222c0824 00000000 c00040f0 00000000
GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 c0660000 c05fa2dc
GPR24: 00000007 00000093 df50d00c df50d060 00000000 df50d058 00000000 df50d040
NIP [c0100154] iget5_locked+0xc/0x250
LR [c011d158] bdget+0x40/0xf4
Call Trace:
[df42bd60] [c0652708] log_wait+0x0/0x8 (unreliable)
[df42bd80] [c02406bc] bdget_disk+0xac/0xf8
[df42bda0] [c0241780] device_add_disk+0x3f4/0x43c
[df42bdf0] [c060ed5c] brd_init+0xa8/0x184
[df42be20] [c0003a5c] do_one_initcall+0x48/0x18c
[df42be90] [c05faafc] kernel_init_freeable+0x130/0x228
[df42bf20] [c0004108] kernel_init+0x18/0x110
[df42bf40] [c00103f0] ret_from_kernel_thread+0x5c/0x64
Instruction dump:
741d7e44 3f090d7e ea9463ef 3a7ebecd fc607969 24b8044d a251c1c7 2c91258b
242aaa92 9887d4e0 2f4a22b5 8b2ef93c <8b9c5484> 7ecf225d 6a9c4a5b 1a5791d4
---[ end trace 47ca8dc77d8de71b ]---

Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Rebooting in 180 seconds..

1 个答案:

答案 0 :(得分:0)

简单来说,内核正在搜索/ dev / ram0找不到的。

可能的根本原因::您没有提供适当的命令行参数来初始化initrd。请发布您的内核命令行。我们可以解决它。