有时会遇到当在u-boot中执行完bootm后,打印出start kernel后串口就没有再输出任何信息了。此时就需要打开内核早期的log:
make menuconfig
Kernel hacking --->
[*] Kernel low-level debugging functions (read help!)
Kernel low-level debugging port (UKernel low-level debugging messages via AM33XX UART1)
[*] Early printk
对于earlyprintk,还需要在bootargs中添加参数earlyprintk才能生效,有了上面这几个配置,会有下面几个宏生效:
CONFIG_DEBUG_AM33XXUART1=y
CONFIG_DEBUG_OMAP2PLUS_UART=y
CONFIG_DEBUG_LL_INCLUDE="debug/omap2plus.S"
CONFIG_DEBUG_UNCOMPRESS=y
CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
CONFIG_EARLY_PRINTK=y
=========================================
注意:要使CONFIG_DEBUG_UNCOMPRESS生效,需要求改一下 arch/arm/Kconfig.debug
=========================================
将default y if DEBUG_LL && !DEBUG_OMAP2PLUS_UART && \
改default y if DEBUG_LL && (!DEBUG_OMAP2PLUS_UART || !ZBOOT_ROM) && \
下面说明源码调用过程
arch\arm\boot\compressed\misc.c
内核解压decompress_kernel() ==>putstr("Uncompressing Linux...")==>putc
putc 定义在 arch\arm\boot\compressed\debug.S
ENTRY(putc)
addruart r1, r2, r3 (1)执行结果r1 <=LSR ,r2 <=omap_uart_virt
waituart r3, r1 (2)这是一个空宏
senduart r0, r1 (3)将putc的参数写入(r1&0xff),也就是写入THR
busyuart r3, r1 (4)循环读LSR,判断是否发送完成
mov pc, lr
ENDPROC(putc)
(1)addruart r1, r2, r3 (rp=r1,rv=r2,tmp=r3) 执行完后r1存放omap_uart_phys
addruart 定义在 "./arch/arm/include/debug/omap2plus.S"
.macro addruart, rp, rv, tmp
...
.endm
(2)
.macro waituart,rd,rx
.endm
(3)
.macro senduart,rd,rx
orr \rd, \rd, \rx, lsl #24 @ preserve LSR reg offset
bic \rx, \rx, #0xff @ get base (THR) reg address
strb \rd, [\rx] @ send lower byte of rd
orr \rx, \rx, \rd, lsr #24 @ restore original rx (LSR)
bic \rd, \rd, #(0xff << 24) @ restore original rd
.endm
(4)
.macro busyuart,rd,rx
1001: ldrb \rd, [\rx] @ rx contains UART_LSR address
and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
bne 1001b
.endm
(2)waituart r3, r1
阅读(2876) | 评论(0) | 转发(0) |